emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Oleh <ohwoeowho@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: org-mode automatically sets bookmarks org-capture-last-stored etc.
Date: Thu, 18 Jul 2013 14:42:50 +0200	[thread overview]
Message-ID: <CAA01p3oY61UYj7Ztp5mtC2dokCUxZ-TSn1RRNFyxLQW480gP9g@mail.gmail.com> (raw)
In-Reply-To: <CAA01p3qfYxkTwuTGxijC_aDEwNMXPk-FT+bBgdkrqOjEA9AKPw@mail.gmail.com>


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

On Thu, Jul 18, 2013 at 2:41 PM, Oleh <ohwoeowho@gmail.com> wrote:

> Since there's no reaction, I'll just show my view of how it could be done.
> I attach the patch.
>
> regards,
> Oleh
>
>
> On Thu, Jul 18, 2013 at 10:34 AM, Oleh <ohwoeowho@gmail.com> wrote:
>
>> Hi all,
>>
>> I'd like to point out that it's inconvenient for me
>> that org stores the bookmarks "org-capture-last-stored",
>> "org-refile-last-stored" and "org-capture-last-stored-marker" when I do
>> capture/refile.
>> I'd like an option to turn them off selectively.
>> Also it would be nice to customize the default names of these bookmarks.
>>
>> For the moment, I've just disabled in the source the
>> "org-capture-last-stored-marker"
>> and renamed the others to "oc:  org-capture-last-stored-marker" and "or:
>> org-refile-last-stored".
>> But messing with the source is not a permanent solution.
>>
>>
>> regards,
>> Oleh
>>
>>
>>
>>
>

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

[-- Attachment #2: 0001-org.el-added-org-bookmark-names-plist.patch --]
[-- Type: application/octet-stream, Size: 3009 bytes --]

From 1a5a0e612474e0881d9bd5a6f9f392819b4c9e28 Mon Sep 17 00:00:00 2001
From: oleh <wave@mail.ua>
Date: Thu, 18 Jul 2013 14:37:59 +0200
Subject: [PATCH] org.el: added `org-bookmark-names-plist'.

Whenever org calls `bookmark-set', it should get the bookmark name
from `org-bookmark-names-plist'.
When it's not there, don't call `bookmark-set'.
---
 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


  reply	other threads:[~2013-07-18 12:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18  8:34 org-mode automatically sets bookmarks org-capture-last-stored etc Oleh
2013-07-18 12:41 ` Oleh
2013-07-18 12:42   ` Oleh [this message]
2013-08-08  6:46 ` Carsten Dominik
2013-08-08 10:44   ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA01p3oY61UYj7Ztp5mtC2dokCUxZ-TSn1RRNFyxLQW480gP9g@mail.gmail.com \
    --to=ohwoeowho@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).