Commit Graph

189 Commits

Author SHA1 Message Date
Nicolas Goaziou 73ddb3c49c Remove references to `org-protected' `org-example' and `original-indentation'
* lisp/org-macs.el (org-if-unprotected, org-if-unprotected-1,
  org-if-unprotected-at): Removed macros.
(org-re-search-forward-unprotected): Removed function.
* lisp/org.el (org-format-latex): Remove reference to `org-protected'.
* lisp/org-list.el (org-list-struct): Remove reference to
  `org-example' and `org-protected'.
* lisp/org-footnote.el (org-footnote-at-reference-p): Remove reference
  to `org-protected'.
* lisp/org-capture.el (org-capture-fill-template): Remove reference to
  `org-protected'.
* contrib/lisp/org-wikinodes.el (org-wikinodes-process-links-for-export):
  Remove reference to `org-protected' value.

These text properties were used by the old export framework. They are
not needed anymore.
2013-02-06 23:06:31 +01:00
Bastien Guerry bbea8d348b Allow to contextualize capture and agenda commands by checking the name of the buffer
* org.el (org-contextualize-validate-key): Check against two
new context predicates [not-]in-buffer.

* org-capture.el (org-capture-templates-contexts):
* org-agenda.el (org-agenda-custom-commands-contexts):
Document the new [not-]in-buffer context predicates.

Thanks to Paul Sexton for triggering this and for proposing a patch.
2013-01-31 11:06:04 +01:00
Bastien Guerry 09f108ec57 Merge branch 'maint' 2013-01-12 09:20:22 +01:00
Bastien Guerry a0ad34b8d4 Docstring fixes.
* org-capture.el (org-capture-templates-contexts):
* org-agenda.el (org-agenda-custom-commands-contexts):
Docstring fix.
2013-01-12 09:20:17 +01:00
Bastien Guerry 5fc740a230 Merge branch 'maint' 2013-01-08 15:04:40 +01:00
Bastien Guerry 72bc144c15 Update Copyright lines to match Emacs format. 2013-01-08 15:04:32 +01:00
Bastien Guerry 60b23bdeac Merge branch 'maint'
Conflicts:
	contrib/lisp/htmlize.el
	etc/schema/od-manifest-schema-v1.2-os.rnc
	etc/schema/od-schema-v1.2-os.rnc
	lisp/org-exp-blocks.el
2013-01-01 16:06:17 +01:00
Bastien Guerry 98cd4687a2 Update copyright years.
Happy new year!
2013-01-01 16:04:24 +01:00
Bastien Guerry 5de94e46e4 Merge branch 'maint' 2012-12-20 13:16:47 +01:00
Dmitry Antipov bfb9f9d10f Use (point-marker) instead of (move-marker (make-marker) (point))
* org-agenda.el (org-agenda-get-restriction-and-command): Use `point-marker'.
* org-capture.el (org-capture-place-template): Likewise.
* org-colview-xemacs.el (org-dblock-write:columnview): Likewise.
* org-colview.el (org-dblock-write:columnview): Likewise.
* org-mobile.el (org-mobile-locate-entry): Likewise.
* org-table.el (org-table-convert-region): Likewise.
* org.el (org-update-statistics-cookies): Likewise.
* contrib/lisp/org-invoice.el (org-dblock-write:invoice): Likewise.
2012-12-20 13:16:41 +01:00
Bastien Guerry 1bfea39fd4 Support `C-1' prefix for `org-agenda-capture' and `org-capture'.
* org.el (org-get-cursor-date): New optional argument
WITH-TIME to add the time of the day.

* org-capture.el (org-capture): When capturing from the agenda
and with a non-nil value for `org-capture-use-agenda-date', a
`C-1' prefix will set the capture time to the HH:MM of the
current line or the current HH:MM.

* org-agenda.el (org-agenda-capture): New optional argument
WITH-TIME: when set to 1, the capture time will be set to the
HH:MM time of the current line, or the current HH:MM time.

From an agenda buffer, C-1 k (i.e. org-agenda-capture) and
C-1 M-x org-capture RET will use the time of the day of the
current line, or the current time of the day.  The date is
not changed by using this prefix.

Thanks to Rene for triggering this change.
2012-12-12 15:21:10 +01:00
Nicolas Goaziou d94a0bcd61 org-capture: Fix docstring
* lisp/org-capture.el (org-capture--expand-keyword-in-embedded-elisp):
  Fix docstring.
2012-11-05 13:38:18 +01:00
Ryo TAKAISHI fb143b6787 org-capture: Expand keywords within %(sexp) placeholder in template
* lisp/org-capture.el: (org-capture--expand-keyword-in-embedded-elisp): New function.
(org-capture-expand-embedded-elisp): Use new function.
2012-11-05 01:29:25 +01:00
Bastien Guerry 116c09053f Run `bookmark-set' within `with-demoted-errors'.
* org.el (org-refile): Run within `with-demoted-errors' so
that a corrupted bookmark file does not stop the refile
process.

* org-capture.el (org-capture-bookmark-last-stored-position):
Ditto for the capture process.

Note: we do not prevent such errors in org-remember.el as this
libary will be obsoleted for the next major release of Org.
2012-10-26 14:55:08 +02:00
Bastien Guerry 5c762bbdc6 Remove some autoloads and clean up code.
* org.el (turn-on-orgtbl): Moved here from org-table.el.
(org-clock-persistence-insinuate): Moved here from org-clock.el.
(org-update-all-dblocks, org-map-entries)
(org-require-autoloaded-modules, org-forward-element)
(org-backward-element, org-up-element)
(org-element-greater-elements, org-drag-element-backward)
(org-drag-element-forward, org-mark-element)
(org-narrow-to-element, org-transpose-element)
(org-unindent-buffer): Don't autoload.

* org-clock.el (org-clock-get-clocktable): Rename from
`org-get-clocktable'.
(org-clock-persistence-insinuate): Move to org.el.

* org-capture.el: Do no set `generated-autoload-file' locally.
Minor code clean up.

* org-agenda.el (org-agenda-list): Use
`org-clock-get-clocktable'.  Do no set
`generated-autoload-file' locally.

* org-table.el (org-table-iterate-buffer-tables): Minor
reformatting.
(turn-on-orgtbl): Move to org.el.

* org-html.el (org-export-htmlize-generate-css): Don't autoload.

* org-timer.el (org-timer-pause-or-continue, org-timer-stop):
Ditto.

* ob-tangle.el (org-babel-tangle-lang-exts): Ditto.

* ob-lob.el (org-babel-lob-ingest): Ditto.

* org-id.el (org-id-copy)
(org-id-get-with-outline-path-completion)
(org-id-get-with-outline-drilling): Ditto.

* org-lparse.el (org-lparse-and-open, org-lparse-batch)
(org-lparse-to-buffer, org-replace-region-by)
(org-lparse-region): Ditto.

* org-mobile.el (org-mobile-create-sumo-agenda): Ditto.
2012-10-02 10:03:15 +02:00
Bastien Guerry e4c31cf98b Use generated-autoload-file: "org-loaddefs.el" as a local variable. 2012-10-02 08:50:46 +02:00
Bastien Guerry c7ffcf9246 Uncomment :version "24.3" cookies.
* org.el (org-url-hexify-p, org-doi-server-url)
(org-latex-preview-ltxpng-directory, org-custom-properties)
(org-sparse-tree-default-date-type): Add :version "24.3".

* org-agenda.el (org-agenda-sticky)
(org-agenda-custom-commands-contexts): Ditto.

* org-capture.el (org-capture-bookmark)
(org-capture-templates-contexts)
(org-capture-use-agenda-date): Ditto.

* org-latex.el (org-export-latex-hyperref-options-format)
(org-export-latex-link-with-unknown-path-format): Ditto.

* org-id.el (org-id-link-to-org-use-id): Ditto.

* org-datetree.el (org-datetree-add-timestamp): Ditto.
2012-09-29 23:46:02 +02:00
Bastien Guerry 453be213ce org-capture.el (org-capture-templates): Fix typo in docstring
* org-capture.el (org-capture-templates): Fix typo in docstring.
2012-09-27 00:54:20 +02:00
Bastien Guerry c1b6920568 Fix a compiler warning. 2012-09-26 15:18:49 +02:00
Bastien Guerry 0b65064961 org-capture.el: Add declarations and check is `org-crypt' is loaded (Fix commit ac6409fe)
* org-capture.el (org-at-encrypted-entry-p)
(org-encrypt-entry, org-decrypt-entry): Declare.
(org-capture-set-target-location): Check whether `org-crypt'
has been loaded.

Thanks to Mike McLean for reporting this.
2012-09-26 08:25:05 +02:00
Bastien Guerry ac6409feae Allow using an encrypted headline as a capture target.
* org-capture.el (org-capture-finalize): Maybe re-encrypt
the target headline if it was decrypted.
(org-capture-set-target-location): Maybe decrypt the target
headline.

* org-crypt.el (org-at-encrypted-entry-p): New function.

Thanks to Guilherme Gondim for suggesting this.
2012-09-25 17:29:44 +02:00
Bastien Guerry b61ff117bc org-capture.el: Set a correct time value with file+datetree+prompt
* org-capture.el (org-capture-set-target-location): Set a
correct time value when storing a note in a datetree and
prompting the user for a date.

Thanks to Gregor Zattler for reporting this.
2012-09-24 08:28:45 +02:00
Bastien Guerry ec9f52d185 org-capture.el (org-capture-mode): Fix bug: don't run the mode's hook twice
* org-capture.el (org-capture-mode): Fix bug: don't run the
mode's hook twice.

Thanks to Kalev Takkis for reporting this.
2012-09-24 07:07:43 +02:00
Bastien Guerry 1fc19ce5bc org-capture.el (org-capture-fill-template): Fix checking of protected template entries
* org-capture.el (org-capture-fill-template): Fix checking of
protected template entries.

Thanks to Myles English for spotting this.
2012-09-22 11:08:20 +02:00
Bastien Guerry d66cbad3d9 org-capture.el: Fix bug in `org-capture-string'
* org-capture.el (org-capture-entry): New variable.
(org-capture-string, org-capture): Use it to possibly skip the
interactive prompt for a capture template.
2012-09-17 18:42:11 +02:00
Bastien Guerry f011496ceb `k' now calls org-agenda-capture from agenda. Also add `org-capture-use-agenda-date' option.
* org-capture.el (org-capture-use-agenda-date): New option.
(org-capture): Use it.

* org-agenda.el (org-agenda-capture): New command.
(org-agenda-mode-map): Bind it to `k'.
(org-agenda-menu): Add it to the menu.

* org.texi (Agenda commands): Document the new command and the
new option.

Thanks to Eric Abrahamsen who suggested this change, along with
other merging about bulk actions.
2012-09-02 12:52:38 +02:00
Bastien Guerry b121753490 org-capture.el (org-capture): Update docstring
* org-capture.el (org-capture): Update docstring.
2012-09-02 12:30:56 +02:00
Bastien Guerry a3f82f430b org-capture.el: When capturing from an agenda buffer use the cursor date at the default date
* org-capture.el (org-capture): When called from an agenda
buffer, use the cursor date at the default date.
2012-09-02 12:29:59 +02:00
Bastien Guerry dd31878ee7 org-capture.el: Protect the text used for replacement from being further replaced
* org-capture.el (org-capture-fill-template): Protect the text
used for replacement from being further replaced.

Thanks to Moritz Ulrich for reporting this bug.
2012-08-24 15:45:03 +02:00
Bastien Guerry 10dbdf5fc2 Update the handling of agenda/capture keys contextualization.
* org.el (org-contextualize-keys): Rename from
`org-contextualize-agenda-or-capture'.  Fix normalization to
handle empty key replacement string.
(org-contextualize-validate-key): Rename from
`org-contexts-validate'.  Allow checking against a custom
function.

* org-agenda.el (org-agenda-custom-commands-contexts): Update.
(org-agenda): Use `org-contextualize-keys'.

* org-capture.el (org-capture-templates-contexts): Ditto.

* org.texi (Templates in contexts, Setting Options): Update to
reflect changes in how contexts options are processed.
2012-08-24 12:18:05 +02:00
Bastien Guerry 6c94ea0518 Implement key replacement depending on the contexts.
* org.el (org-contextualize-agenda-or-capture): Handle key
replacement depending on the contexts.

* org-capture.el (org-capture-templates-contexts): Allow to
use the context as a way to replace one capture template by
another one.

* org-agenda.el (org-agenda-custom-commands-contexts): Allow
to use the context as a way to replace one agenda custom
command by another one.

* org.texi (Templates in contexts): Document the new structure
of the variables `org-agenda-custom-commands-contexts' and
`org-capture-templates-contexts'.

In the setup below, X is not a real capture template, it is just
an alias to templates A and B in .txt and .el files.  A and B are
deactivated by default in all files.

(setq org-capture-templates
      '(("X" "Nothing but an alias")
	("A" "AAAA" entry (file+headline [...]))
	("B" "BBBB" entry (file+headline [...]))))

(setq org-capture-templates-contexts
      '(("A" "A" ((not-in-file . ".*")))
	("B" "B" ((not-in-file . ".*")))
	("X" "A" ((in-file . "\\.txt")))
	("X" "B" ((in-file . "\\.el")))))

Thanks to Carsten for suggesting this "key-replacement" idea!
2012-08-24 12:17:58 +02:00
Bastien Guerry d378c7b41b Implement context filtering for agenda commands and capture templates.
* org.el (org-contextualize-agenda-or-capture)
(org-rule-validate): New functions, implement context
filtering for agenda commands and capture templates.

* org-agenda.el (org-agenda-custom-commands-contexts): New
option.
(org-agenda): Use it.

* org-capture.el (org-capture-templates-contexts): New option.
(org-capture-select-template): Use it.

* org.texi (Templates in contexts): Document the new option
`org-capture-templates-contexts'.
(Storing searches): Document the new option
`org-agenda-custom-commands-contexts'.

This idea comes from Sylvain Rousseau, who implemented a similar
feature with org-context.el: https://github.com/thisirs/org-context

This implementation is a bit simpler and more general.  Simpler
because it relies on existing templates, no need to define other
contextual ones.  More general because contexts can be defined
wrt files and modes.

Thanks *very much* to Sylvain for paving the way -- certainly a
great addition to Org.
2012-08-23 11:08:47 +02:00
Bastien Guerry b4df37076d Don't use :version "24.3" until Emacs 24.3 is released and/or Org sync'ed in Emacs 2012-08-20 07:49:16 +02:00
Bastien Guerry 92271aecea org-capture.el (org-capture-place-table-line): Fix bug
* org-capture.el (org-capture-place-table-line): Fix bug.

Thanks to Ian Barton for reporting this.
2012-08-19 17:41:01 +02:00
Bastien Guerry 76b0d582b8 Replace Emacs version to "24.2" by "24.3"
This is needed because the current HEAD of the git repository
will not be synced with Emacs 24.2 but more likely with Emacs 24.3.
2012-08-16 09:24:58 +02:00
Bastien Guerry 722e0e0c83 Remove `org-substring-no-properties' and some redundant code
* org-macs.el (org-no-properties): Allow a new parameter
`restricted' to restrict the properties removal to those in
`org-rm-props'.  The default is now to remove all properties.

* org-compat.el (org-substring-no-properties): Remove unused
defun.

* org-remember.el (org-remember-apply-template): Remove
redundant removal of text properties.
(org-remember-apply-template): Use `org-no-properties'.

* org-capture.el (org-capture-fill-template): Remove redundant
removal of text properties.
(org-capture-fill-template): Use `org-no-properties'.

* org-gnus.el (org-gnus-open, org-gnus-follow-link): Use
`org-no-properties'.
2012-08-15 09:35:21 +02:00
Michael Brand e1d5a31786 Improve parsing of org-capture-inside-embedded-elisp-p
* org-capture.el (org-capture-inside-embedded-elisp-p): Improve parsing.
2012-08-12 12:12:04 +02:00
Bastien Guerry e5c93760c8 org-capture.el (org-capture): Fix bug introduced by commit 1737d3
* org-capture.el (org-capture): Fix bug introduced by commit
1737d3.

Thanks to Simon Thum for reporting this.
2012-08-11 19:50:20 +02:00
Bastien Guerry b422af282d org-capture.el: Minor code cleanup 2012-08-11 19:35:34 +02:00
Bastien Guerry 70dd1196d2 Massive code clean-up.
Delete trailing whitespaces.
Indent all sexps correctly.
Sentences end with double spaces.
2012-08-11 19:10:44 +02:00
Michael Brand 042db379fc Add the capture feature sexp to org feed
* org-feed.el (org-feed-format-entry): Require `org-capture'.
Expand Elisp %(...) templates.
(org-feed-default-template): Update docstring.

* org-capture.el (org-capture-expand-embedded-elisp): New
function.
(org-capture-fill-template): Use it.
(org-capture-inside-embedded-elisp-p): New function to tell if
we are within an Elisp %(...) template.
2012-08-11 18:55:12 +02:00
Bastien Guerry 1737d3c4ee New command `org-capture-string'
* org-capture.el (org-capture-string): New command to prompt
for the interactive text interactively.  This can also be used
in Elisp programs to use ̀org-capture' with some initial text.
(org-capture-initial): New variable to store the initial text.
(org-capture): Use `org-capture-initial'.
2012-08-11 11:17:35 +02:00
Bastien Guerry d9ebb7c8be org-capture.el: Fix bug in placing point according to %?
* org-capture.el (org-capture-templates): Docstring clean up.
(org-capture-place-entry, org-capture-place-item)
(org-capture-place-plain-text, org-capture-place-table-line):
Ensure to always position the point according to %?.

Thanks to Gsqual for reporting this and to Nick Dokos for digging into this
issue.
2012-08-10 11:48:54 +02:00
Bastien Guerry 7fdd49dd33 org-capture.el: Fix docstring by adding Gnus to the list of mail clients.
* org-capture.el (org-capture-templates): Fix docstring by
adding Gnus to the list of mail clients.

Thanks to Tassilo Horn for spotting this.
2012-08-03 14:01:19 +02:00
Bastien Guerry 21ec0159b8 org-capture.el: New template %l to insert the literal link.
* org-capture.el (org-capture-templates): New template %l to
insert the literal link pointing at the current buffer.

* org.texi (Template expansion): Document the new %l template.

Thanks to Eric Abrahamsen for this idea.
2012-08-02 17:06:22 +02:00
Bastien Guerry 8eb584331a Add punctuation at the end of the first line of docstrings. Code cleanup. 2012-07-30 10:08:15 +02:00
Bastien Guerry f71d45a913 New option `org-capture-bookmark' (mentioned in the manual.)
* org.texi (Using capture): Mention the
`org-capture-last-stored' bookmark as a way to jump to the
last stored capture.

* org-capture.el (org-capture-bookmark): New option.
(org-capture-finalize): Use it.
2012-05-25 23:45:31 +02:00
Bastien Guerry 1666b910fe org-capture.el: Use %\n instead of %n.
* org-capture.el (org-capture-fill-template): Use %\n instead of %n as a
template element to be replaced with the nth prompted string.
(org-capture-templates): Update docstring.

* org.texi (Template expansion): Update doc to reflect change.

Using %n triggers errors when the template contains escaped strings,
which happens a lot with links.
2012-04-24 11:54:16 +02:00
Toby S. Cubitt b7982a0024 org-capture.el: Fixed bug in org-capture-templates %<n> expandos
* lisp/org-capture.el (org-capture-fill-template): Fixed regexp for
  %<n> expandos to match any positive integer.
  (org-capture-templates): Updated docstring accordingly.

* doc/org.texi: Updated documentation accordingly.
2012-04-23 17:34:15 +02:00
Toby Cubitt e13d182ce8 Allow %<num> escapes to capture templates, expanded to text entered in <num>'th prompt
* org-capture.el (org-capture-fill-template): Expand %<num>
escape sequences into text entered for <num>'th %^{PROMPT} escape.
2012-04-23 12:48:40 +02:00