emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] [TINYCHANGE] optional `bookmark-set'
@ 2013-07-19  9:42 Oleh
  0 siblings, 0 replies; only message in thread
From: Oleh @ 2013-07-19  9:42 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 200 bytes --]

Hi all,

I've added an option to customize the bookmark
names that org-mode sets.

I'm new to this list and I'd appreciate some feedback.
I've posted yesterday, but there was no reply.

regards,
Oleh

[-- Attachment #1.2: Type: text/html, Size: 357 bytes --]

[-- Attachment #2: 0001-Capture-Refile-use-bookmark-set-conditionally.patch --]
[-- Type: application/octet-stream, Size: 3471 bytes --]

From ba40a05dedab66aa501a9d4583e91f604da34d14 Mon Sep 17 00:00:00 2001
From: oleh <wave@mail.ua>
Date: Thu, 18 Jul 2013 14:37:59 +0200
Subject: [PATCH] Capture/Refile: use `bookmark-set' conditionally

* lisp/org.el:
  * added `org-bookmark-names-plist' with defualt tags:
    * :last-capture - "org-capture-last-stored"
    * :last-refile - "org-refile-last-stored"
    * :last-capture-marker - "org-capture-last-stored-marker"
  * changed 2 calls to `bookmark-set' to obey `org-bookmark-names-plist'
* lisp/org-capture.el:
  * changed 1 call to `bookmark-set' to obey `org-bookmark-names-plist'

The default bookmark setting behavior remains unchanged,
but now the user gets an option to customize `org-bookmark-names-plist'
to either change the default bookmark names, or to turn them off.

TINYCHANGE
---
 lisp/org-capture.el |  6 ++++--
 lisp/org.el         | 17 ++++++++++++-----
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index a4f0fd0..a81d14e 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1267,8 +1267,10 @@ 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 fb5099e..1957e63 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -63,6 +63,9 @@
 ;;; Code:
 
 (defvar org-inhibit-highlight-removal nil) ; dynamically scoped param
+(defvar org-bookmark-names-plist
+  '(:last-capture "org-capture-last-stored" :last-refile "org-refile-last-stored" :last-capture-marker "org-capture-last-stored-marker"))
+
 (defvar org-table-formula-constants-local nil
   "Local version of `org-table-formula-constants'.")
 (make-variable-buffer-local 'org-table-formula-constants-local)
@@ -4837,7 +4840,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) ":")
@@ -11623,13 +11626,17 @@ 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))))
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-07-19  9:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-19  9:42 [PATCH] [TINYCHANGE] optional `bookmark-set' Oleh

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).