summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2013-08-08 12:43:03 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2013-08-08 12:43:03 +0200
commit131e7a679e310fdd1e54423892ce9db24594ffba (patch)
treeb728a69f3e9f56d98c95aec8f7fa9d7c2d5a9992
parent59eff74fad2ba48140ccb957ac9e27b6cc5d38bb (diff)
downloadorg-mode-131e7a679e310fdd1e54423892ce9db24594ffba.tar.gz
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.
-rw-r--r--lisp/org-capture.el7
-rw-r--r--lisp/org.el31
2 files changed, 31 insertions, 7 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index a4f0fd0..bc0a21f 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1267,8 +1267,11 @@ Of course, if exact position has been required, just put it there."
(save-restriction
(widen)
(goto-char pos)
- (with-demoted-errors
- (bookmark-set "org-capture-last-stored"))
+ (let ((bookmark-name (plist-get org-bookmark-names-plist
+ :last-capture)))
+ (when bookmark-name
+ (with-demoted-errors
+ (bookmark-set bookmark-name))))
(move-marker org-capture-last-stored-marker (point)))))))
(defun org-capture-narrow (beg end)
diff --git a/lisp/org.el b/lisp/org.el
index 6360bea..b1a2fa8 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1032,6 +1032,21 @@ commands in the Help buffer using the `?' speed command."
(function)
(sexp))))))
+(defcustom org-bookmark-names-plist
+ '(:last-capture "org-capture-last-stored"
+ :last-refile "org-refile-last-stored"
+ :last-capture-marker "org-capture-last-stored-marker")
+ "Names for bookmarks automatically set by some Org commands.
+This can provide strings as names for a number of bookmakrs Org sets
+automatically. The following keys are currently implemented:
+ :last-capture
+ :last-capture-marker
+ :last-refile
+When a key does not show up in the property list, the corresponding bookmark
+is not set."
+ :group 'org-structure
+ :type 'plist)
+
(defgroup org-cycle nil
"Options concerning visibility cycling in Org-mode."
:tag "Org Cycle"
@@ -4837,7 +4852,7 @@ Support for group tags is controlled by the option
;; Process the tags.
(when (and (not tags) org-tag-alist)
(setq tags
- (mapcar
+ (mapcar
(lambda (tg) (cond ((eq (car tg) :startgroup) "{")
((eq (car tg) :endgroup) "}")
((eq (car tg) :grouptags) ":")
@@ -11589,13 +11604,19 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(and org-auto-align-tags
(let ((org-loop-over-headlines-in-active-region nil))
(org-set-tags nil t)))
- (with-demoted-errors
- (bookmark-set "org-refile-last-stored"))
+ (let ((bookmark-name (plist-get org-bookmark-names-plist
+ :last-refile)))
+ (when bookmark-name
+ (with-demoted-errors
+ (bookmark-set bookmark-name))))
;; If we are refiling for capture, make sure that the
;; last-capture pointers point here
(when (org-bound-and-true-p org-refile-for-capture)
- (with-demoted-errors
- (bookmark-set "org-capture-last-stored-marker"))
+ (let ((bookmark-name (plist-get org-bookmark-names-plist
+ :last-capture-marker)))
+ (when bookmark-name
+ (with-demoted-errors
+ (bookmark-set bookmark-name))))
(move-marker org-capture-last-stored-marker (point)))
(if (fboundp 'deactivate-mark) (deactivate-mark))
(run-hooks 'org-after-refile-insert-hook))))