Commit Graph

299 Commits

Author SHA1 Message Date
Nicolas Goaziou b49f2e0b75 org-capture: Fix bd3a2cb (part 2)
* lisp/org-capture.el (org-capture-fill-template): Allow more than one
  word when filling %{prompt} place holders.

Reported-by: Eric S Fraga <e.fraga@ucl.ac.uk>
<http://permalink.gmane.org/gmane.emacs.orgmode/103251>
2015-12-02 22:22:24 +01:00
Nicolas Goaziou fb32b28057 org-capture: Fix bd3a2cb
* lisp/org-capture.el (org-capture-fill-template): Fix regexp and type
  for KEY.

Reported-by: Eric S Fraga <e.fraga@ucl.ac.uk>
<http://permalink.gmane.org/gmane.emacs.orgmode/103214>
2015-12-01 23:20:44 +01:00
Nicolas Goaziou 813d04f8d4 org-capture: Silence byte-compiler
* lisp/org-capture.el (org-capture-fill-template): Silence
  byte-compiler.
2015-11-29 22:01:30 +01:00
Nicolas Goaziou bd3a2cbf2f org-capture: Prevent recursive evaluation of %(...) placeholders
* lisp/org-capture.el (org-capture-templates): Improve docstring.
(org-capture-fill-template): Prevent recursive evaluation of %(...)
placeholders.  Fix escaping of % character in templates.
* testing/lisp/test-org-capture.el: New file.

Reported-by: Thomas Preindl <thomas.preindl@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/103018>
2015-11-29 16:58:14 +01:00
Nicolas Goaziou e1cb24288e org-capture: Silence byte-compiler
* lisp/org-capture.el (org-capture-place-template): Remove unused
  `org-capture-target-marker'.
2015-11-07 23:09:47 +01:00
Aaron Ecay 07e16c2fc5 Use setq-local and defvar-local.
* lisp/org-macs.el (org-set-local): Remove.  All callers changed.
* lisp/org-clock.el:
* lisp/org-colview.el:
* lisp/org-macro.el:
* lisp/org-mouse.el:
* lisp/org-table.el:
* lisp/org.el: Use defvar-local.
* lisp/org-agenda.el:
* lisp/org-capture.el:
* lisp/org-crypt.el:
* lisp/org-ctags.el:
* lisp/org-plot.el:
* lisp/org.el:
* lisp/ox-odt.el:
* lisp/ox.el: Use setq-local instead of set + make-local-variable.

Changes in contrib:

* contrib/lisp/org-colview-xemacs.el (org-colview-xemacs-set-local): New
macro. Adjust old callers of `org-set-local'.
2015-11-05 16:47:38 +00:00
Jan Seeger d183c59e46 org-capture: Reverse capture finalize and refile, hack buffer killing
* org-capture.el (org-capture-refile): Call finalize first, then
  refile. If the capture buffer needs to be killed afterwards, kill
  after refiling.

Refiling before finalizing led to an incorrect cursor position during
refile.  Since adjusting the buffer position and bounds for the refiled
entry is difficult, I reverted the `org-capture-refile' function to its
original order of finalizing and then refiling.  However, this leads to
a bug with killing the buffer on capture, described in
<http://permalink.gmane.org/gmane.emacs.orgmode/78027/>.  To work around
this, now the :kill-buffer flag is cleared before calling finalize, and
the capture buffer is killed after `org-refile' is called.

TINYCHANGE
2015-10-13 21:42:47 +02:00
Kyle Meyer ef3ea9d02d Use prefix for outline functions
* lisp/ob-lilypond.el (org-babel-lilypond-mark-error-line):
* lisp/org-agenda.el (org-agenda-goto):
(org-agenda-show-and-scroll-up):
(org-agenda-show-1):
* lisp/org-archive.el (org-archive-subtree):
(org-archive-to-archive-sibling):
(org-toggle-archive-tag):
* lisp/org-capture.el:
(org-capture-place-template):
* lisp/org-colview.el:
(org-columns-eval):
* lisp/org-crypt.el (org-encrypt-entry):
* lisp/org-feed.el (org-feed-update):
* lisp/org-mouse.el (org-mouse-popup-global-menu):
* lisp/org.el (org-cycle):
(org-cycle-internal-global):
(org-cycle-internal-local):
(org-global-cycle):
(org-set-startup-visibility):
(org-set-visibility-according-to-property):
(org-overview):
(org-content):
(org-clean-visibility-after-subtree-move):
(org-set-outline-overlay-data):
(org-tree-to-indirect-buffer):
(org-move-subtree-down):
(org-paste-subtree):
(org-sort-entries):
(orgstruct-setup):
(org-show-set-visibility):
(org-mode-map):
(org-check-before-invisible-edit):
(org-kill-note-or-show-branches):
(org-org-menu):
(org-yank-generic):
* lisp/ox-org.el (org-org-publish-to-org): Use prefix for outline
  functions.
* lisp/org-compat.el: Add compatibility functions for outline functions
  that are under the "outline-" prefix as of Emacs 25.
2015-10-04 02:31:16 -04:00
Kyle Meyer 077810e521 Modify quote-related backport
These changes are in line with the changes proposed on the mailing list,
but many of those changes weren't necessary because they had already
been reverted in the Emacs repo.

<http://permalink.gmane.org/gmane.emacs.orgmode/100896/>
2015-09-21 18:38:39 -04:00
Kyle Meyer d77a52a502 Backport quote-related commits from Emacs
These changes are the combination of the commits below (in order
applied).  Unlike other backports, these are applied in one commit
because they are closely related and because some of the later commits
reverse changes in earlier commits.  Changes to message and help quote
display for Emacs 25 seem to be here to stay.  The quote protections are
required to ensure grave accents and apostrophes are displayed as
intended in Emacs 25, and they should not affect earlier versions.

  Quoting fixes in lisp/org
  6cd2629bd1b3ce77d29ac28e29237c94a4197116
  Paul Eggert
  Mon Aug 31 00:29:40 2015 -0700

  More-conservative ‘format’ quote restyling
  fbb5531fa11d13854b274d28ccd329c9b6652cfc
  Paul Eggert
  Sun Aug 23 22:39:06 2015 -0700

  Prefer directed to neutral quotes
  875a5d0ead827d3da32ecbd30e739a29f07bbc87
  Paul Eggert
  Mon Aug 24 23:57:25 2015 -0700

  Escape ` and ' in doc
  19532d147b431a4fe34f088d6de07891c48e2c5c
  Paul Eggert
  Tue Sep 1 18:23:21 2015 -0700

  Fix some more docstring etc. quoting problems
  26bd978d87dfbf9baa115cd961a67d42b416c4bf
  Paul Eggert
  Thu Sep 3 15:32:54 2015 -0700

  Go back to grave quoting in source-code docstrings etc.
  6afef3f6ca2f3009c722b84e249903b7f807b044
  Paul Eggert
  Mon Sep 7 16:09:27 2015 -0700
2015-09-21 18:38:18 -04:00
Nicolas Goaziou 3a6c9f5f06 org-capture: Fix bindings in header line
* lisp/org-capture.el (org-capture-mode): Display currently used
  bindings in header line.
2015-08-22 00:54:14 +02:00
Nicolas Goaziou 2316925ecb Revert "org-capture: Fix datetree capture"
This reverts commit a834a5939f.
2015-08-21 23:48:36 +02:00
Nicolas Goaziou a834a5939f org-capture: Fix datetree capture
* lisp/org-capture.el (org-capture-set-target-location): Fix
  file+datetree capture with non-nil `org-datetree-add-timestamp.

Reported-by: Gregor Zattler <telegraph@gmx.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/100300>
2015-08-21 23:31:23 +02:00
Bastien 0d0d0ad56e Merge branch 'backport-master'
Conflicts:
	lisp/org-table.el
2015-08-05 01:01:46 +02:00
Nicolas Goaziou 14d07c0e7d org-table: Improve tables' speed in large buffers
* lisp/org-table.el (org-table-auto-recalculate-regexp):
(org-table-recalculate-regexp):
(org-table-calculate-mark-regexp):
(org-table-column-names):
(org-table-column-name-regexp):
(org-table-local-parameters):
(org-table-named-field-locations):
(org-table-current-line-types):
(org-table-current-begin-pos):
(org-table-current-ncol):
(org-table-dlines):
(org-table-hlines): Improve docstrings.

(org-table-current-begin-line): Remove variable.

(org-table-save-field): New macro.

(org-table-get-specials): Remove function.
(org-table-analyze): New function, renamed from
`org-table-get-specials'.

(org-table-find-row-type): Remove function.
(org-table--row-type): New function, renamed from
`org-table-find-row-type'.

(org-table-align): Use new macro.

(org-table-field-info):
(org-table-insert-column):
(org-table-delete-column):
(org-table-move-column):
(org-table-sort-lines):
(org-table-paste-rectangle):
(org-table-wrap-region):
(org-table-current-field-formula):
(org-table-get-formula):
(org-table-maybe-recalculate-line):
(org-table-eval-formula):
(org-table-get-range):
(org-table--descriptor-line):
(org-table-recalculate):
(org-table-expand-lhs-ranges):
(org-table-edit-formulas):
(org-table-show-reference):
(org-table-get-remote-range): Apply changes above.  Refactor code.

(org-table-check-inside-data-field):
(org-table-current-column):
(org-table-current-dline):
(org-table-line-to-dline):
(org-table-copy-region):
(org-table-rotate-recalc-marks):
(org-table-fedit-post-command):
(org-table-fedit-convert-buffer):
(org-table-highlight-rectangle): Refactor code.

(org-table-goto-field): New function.

* lisp/org-capture.el (org-capture-place-table-line): Apply change made
  to table internals.

The point of this commit is to remove dependency on `org-current-line'
and `org-goto-line', which are both expensive in large buffers.  Now,
lines are relative to the beginning of the current table instead of
global (i.e., relative to the beginning of the buffer).
2015-08-02 18:01:12 +02:00
Kyle Meyer 6f9184a294 Merge branch 'maint' into backport-master 2015-07-26 23:56:50 -04:00
Paul Eggert 6b04312e85 Backport commit 96794d2 from Emacs master branch
Don't quote nil and t in doc strings
96794d2f97cd064e4c2bf4f71459b42558cc8c79
Paul Eggert
Thu May 21 10:06:44 2015 -0700
2015-07-26 23:29:31 -04:00
Eric S Fraga 0b0bbf6194 org-capture: Place capture buffer in other window
* org-capture.el (org-capture-fill-template): The capture template
  buffer will be displayed in another window, keeping original window
  visible if appropriate.
2015-06-25 14:21:56 +02:00
Nicolas Goaziou b27e630bab org-capture: Fix "org-find-olp: Wrong type argument: stringp, nil"
* lisp/org-capture.el (org-capture-expand-file): Empyt string defaults
  to `org-default-notes-file'.
* lisp/org.el (org-default-notes-file): Do not fallback on
`remember-data-file' since "org-capture.el" is not based off
"remember.el" anymore.

Reported-by: Florian Lindner <mailinglists@xgm.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/97448>
2015-05-08 11:32:35 +02:00
Nicolas Goaziou 98a1bc868a Replace `org-end-of-meta-data-and-drawers'
* lisp/org.el (org-end-of-meta-data): New function.
(org-end-of-meta-data-and-drawers): Remove function.

* lisp/org-capture.el (org-capture-place-plain-text): Use new
  function.

* testing/lisp/test-org.el (test-org/end-of-meta-data): New test.

* etc/ORG-NEWS: Document removal.
2015-01-30 19:31:27 +01:00
Nicolas Goaziou fbcdc5d6d5 Merge branch 'maint' 2014-11-02 10:42:09 +01:00
Roberto Huelga Díaz cdb0a962bc org-capture.el: Fix expand template order
* lisp/org-capture.el (org-capture-fill-template): Expand %(sexp) after
  %:keywords, per documentation about capture templates expansion.

When a template is expanded first the simple %-escapes, %:keywords and
after that the %(sexp).

TINYCHANGE
2014-11-02 10:40:31 +01:00
Andrew Burgess 587280ea68 org-capture: Better indentation when creating a new list
lisp/org-capture.el (org-capture-place-item): When starting a new list
use org-indent-line to establish the correct indentation rather than
just using 0.

Creating an entry in org-capture-templates of type item adds entries
into a list, however, currently, if the list is empty then the first
list item will always be indented to depth 0 (so hard on the left),
which looks like this:

  * Top Level
  ** Second Level
  - item #1
  - item #2
  - item #3

This is fine if org-adapt-indentation is nil, however, with the
default value of t lists should be indented more like this:

  * Top Level
  ** Second Level
     - item #1
     - item #2
     - item #3

The patch below changes org-capture-place-item so that, when starting
a new list, the items are indented as above.

Care is taken to preserve two features of the existing behaviour,
first, when adding to an existing list, new items are indented to
match the items already in the list.  And secondly, when there is some
introductory text before the list new items are inserted after the
text, like this:

  * Top Level
  ** Second Level
     This is some introductory text:
     - item #1
     - item #2
     - item #3

TINYCHANGE
2014-10-14 22:24:30 +02:00
Bastien Guerry 7f21cfc658 Merge branch 'maint' 2014-07-28 18:08:44 +02:00
Bastien Guerry 1387694888 org-capture.el (org-capture-fill-template): Small fix
* org-capture.el (org-capture-fill-template): Take
`org-extend-today-until' into account when setting the format
time string.
2014-07-28 18:08:34 +02:00
Bastien Guerry 99580828e6 Merge branch 'maint' 2014-05-23 21:51:23 +02:00
Alex Kosorukoff 942a95cd59 org-capture.el (org-capture-fill-template): Set `mark-active' to nil
* org-capture.el (org-capture-fill-template): Set
`mark-active' to nil.

TINYCHANGE
2014-05-23 21:50:24 +02:00
Bastien Guerry 567241e986 Revert "org-capture.el (org-capture-steal-local-variables): Don't steal `mark-active'"
This reverts commit ee5a88cd01.
2014-05-23 21:49:19 +02:00
Bastien Guerry d6775b8751 Merge branch 'maint' 2014-05-23 14:01:45 +02:00
Bastien Guerry ee5a88cd01 org-capture.el (org-capture-steal-local-variables): Don't steal `mark-active'
* org-capture.el (org-capture-steal-local-variables): Don't
steal `mark-active', which should be nil in the target buffer.

Thanks to Alex Kosorukoff for raising this issue.
2014-05-23 14:01:39 +02:00
Bastien Guerry 20b70a1716 Merge branch 'maint' 2014-04-29 13:08:23 +02:00
Bastien Guerry 3104f7de7b org-capture.el (org-capture-fill-template): Fix bug
* org-capture.el (org-capture-fill-template): Deactivate
region while trying to align tags on the current headline.

Thanks to Alex Kosorukoff for reporting this.
2014-04-29 13:05:04 +02:00
Thomas Holst 176125c32f org-capture.el: Allow `:table-line-pos' to be a function name, a string or a variable
* lisp/org-capture.el (org-capture-place-table-line): If the value of
`:table-line-pos' is a function name, used its return value to set the
position inside the table.  The return value must be a string like
"II-3".  Else `:table-line-pos' is 'eval'ed.

TINYCHANGE
2014-03-19 09:34:58 +01:00
Bastien Guerry 423133efe9 org-capture.el: Use `org-buffer-narrowed-p'
* org-capture.el (org-capture-put-target-region-and-position):
Use `org-buffer-narrowed-p'.
2014-03-13 10:49:48 +01:00
Bastien Guerry 94f104ad5c org-capture.el: Fix wrong narrowing with :prepend set to `t'
* org-capture.el (org-capture-finalize): Ensure to widen the
buffer when the target buffer is not initially narrowed.

Thanks to Adam Spiers and Thomas Proschinger for reporting this bug.
2014-03-13 10:45:08 +01:00
Bastien Guerry a6bac51c5b org-capture.el: Fix wrong narrowing with :prepend set to `t'
* org-capture.el (org-capture-finalize): Ensure to widen the
buffer when the target buffer is not initially narrowed.

Thanks to Adam Spiers and Thomas Proschinger for reporting this bug.
2014-03-13 10:44:41 +01:00
Oleh Krehel 367780d133 Enforce `org-bookmark-names-plist'
* lisp/org-capture.el (org-capture-goto-last-stored): Use
  `org-bookmark-names-plist'.
* lisp/org.el (org-refile-goto-last-stored): Use
  `org-bookmark-names-plist'.
2014-03-07 14:09:16 +01:00
Bastien Guerry f8e1745440 Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-07 14:19:03 +01:00
Bastien Guerry 7d9a883b50 Update copyright years again.
Hint: copyright years are all updated in Emacs.
2014-01-07 14:18:17 +01:00
Bastien Guerry c41f5075ac Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-05 06:36:11 +01:00
Bastien Guerry 0beda99171 Revert "Update copyright years."
This reverts commit 21105594fc.
2014-01-05 06:28:07 +01:00
Bastien Guerry 096ff7e078 Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-04 18:58:12 +01:00
Bastien Guerry 21105594fc Update copyright years. 2014-01-04 18:56:11 +01:00
York Zhao f1583aab46 Fix problem with :exact-positions in capture
* lisp/org-capture.el (org-capture-place-entry): Set :exact-position
before doing other stuff, to allow function with other target settings

TINYCHANGE

Assuming file "test.org" has a single headline "* Level 1" (ended with
newline character), when trying to use function type capture target in
an org-capture template, as shown in the example:

(setq org-capture-templates
      `(("t"
         "Test function type target"
         entry
         (function
          (lambda ()
            (set-buffer (org-capture-target-buffer "test.org"))
            (goto-char (point-max))))
         "* Level 2")))

When this template gets filled, file "test.org" becomes:

* Level 1
* Level 2

Instead of:

* Level 1
** Level 2

This is because when using function type target, `:exact-position' is
used to store buffer position returned by user's function (the lambda
function here), and function `org-capture-place-entry' will never
insert template as a child of current entry when `:exact-position' is
used.

The problem is addressed by not special casing for `:exact-position'
in function `org-capture-place-entry'.

York
2013-11-26 06:28:07 +01:00
Bastien Guerry 47b0eec8dc org-capture.el (org-capture-refile): Don't finalize prematurely
* org-capture.el (org-capture-refile): Don't finalize
prematurely.

Thanks to Rodrigo Amestica for reporting this.
2013-11-06 16:26:38 +01:00
Bastien Guerry 747f46aa1f org-capture: Fix bug when capturing with templates using `function'
* org-capture.el (org-capture): Store :return-to-wconf
earlier.
(org-capture-place-template): Don't store :return-to-wconf
when called from a capture template using `function', rely on
the early :return-to-wconf value store from `org-capture'.

Thanks to Brett Viren for raising this issue.
2013-11-06 15:51:57 +01:00
Bastien Guerry 6c48056b2b Some clean-up related to org-remember being removed
* org.el (org-directory, org-default-notes-file)
(org-reverse-note-order): Don't use the `org-remember'
customization group.
(org-require-autoloaded-modules): Don't require
`org-remember'.

* org-capture.el: Update commentary section to reflect the
fact that org-remember.el is not used anymore.
2013-11-05 12:13:46 +01:00
oleh 1871bf6933 Allow nil as return of sexp in capture templates
* lisp/org-capture.el (org-capture-expand-embedded-elisp): Throw error if
result is not a string and not nil.  If the result is nil, treat it as
if it was the empty string.
2013-09-01 19:47:37 +02:00
Carsten Dominik 131e7a679e Allow to specify the names of automatic bookmarks
* lisp/org.el (org-bookmark-names-plist): New user option.
(org-set-regexps-and-options-for-tags): Use `org-bookmark-names-plist'.
(org-refile): Use `org-bookmark-names-plist'.
* lisp/org-capture.el (org-capture-bookmark-last-stored-position): Use
`org-bookmark-names-plist'.

Patch modified from a proposal by Oleh.
2013-08-08 12:43:03 +02:00
Bastien Guerry eff77aa85e org-capture.el (org-capture-set-target-location): Don't throw an error when `org-time-was-given' is not bound
* org-capture.el (org-capture-set-target-location): Don't
throw an error when `org-time-was-given' is not bound.

Thanks to Eric S Fraga for reporting this.
2013-06-27 15:35:22 +02:00
Bastien Guerry df4ed8e794 org-capture.el (org-capture-use-agenda-date): Fix docstring
* org-capture.el (org-capture-use-agenda-date): Fix docstring.
2013-04-17 07:00:59 +02:00
Bastien Guerry 35b9983107 org-capture.el (org-mks): Fix bug.
* org-capture.el (org-mks): Fix bug: let-bind
`case-fold-search' to nil while matching the first letter of a
multi-letters template.

Thanks to Robert Goldman for reporting this bug and providing the fix.
2013-04-16 18:27:11 +02:00
Bastien Guerry 8546254ce5 org-capture.el (org-mks): Make cursor invisible
* org-capture.el (org-mks): Make cursor invisible.
2013-04-16 09:23:45 +02:00
Bastien Guerry 2c41456b1d org-capture.el (org-capture-import-remember-templates): Take care of adding :jump-to-captured option if needed
* org-capture.el (org-capture-import-remember-templates): Take
care of adding :jump-to-captured option if needed.
2013-03-30 19:03:09 +01:00
Bastien Guerry 15c3792f2b org-capture.el: New capture template option :jump-to-captured
* org-capture.el (org-capture-templates): Document new option
:jump-to-captured in the docstring.  Offer the complete list
of options when customizing.
(org-capture-finalize): Handle :jump-to-captured.

This emulates the behavior triggered by %& in remember templates.

Thanks to Adam Spiers for reporting this.
2013-03-30 15:43:30 +01:00
Bastien Guerry 4184699910 Revert "org-capture.el (org-capture): Don't store multiple links over lines in the active region"
This reverts commit 2c994218ea.
2013-03-26 14:16:56 +01:00
Bastien Guerry 2c994218ea org-capture.el (org-capture): Don't store multiple links over lines in the active region
* org-capture.el (org-capture): Don't store multiple links
over lines in the active region.

Thanks to Matt Lundin for reporting this.
2013-03-25 23:49:39 +01:00
Bastien Guerry 7e6c632f80 org-capture.el: Fix or add docstrings
* org-capture.el (org-capture-templates, org-capture-string)
(org-capture-steal-local-variables)
(org-capture-empty-lines-before)
(org-capture-empty-lines-after)
(org-capture-insert-template-here)
(org-capture-import-remember-templates): Fix or add docstring.
2013-03-05 16:38:33 +01:00
Bastien Guerry b653e12ec2 Move `org-mks' to org-capture.el and delete org-mks.el.
* org-capture.el (org-mks): Move from org-mks.el.
* org-mks.el: Delete.
2013-03-04 18:21:47 +01:00
Bastien Guerry ffefa9ed86 org-capture.el (org-capture): Cosmetic fix
* org-capture.el (org-capture): Cosmetic fix.
2013-02-28 00:29:24 +01:00
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