From: Oleh <ohwoeowho@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] [TINYCHANGE] optional `bookmark-set'
Date: Fri, 19 Jul 2013 11:42:00 +0200 [thread overview]
Message-ID: <CAA01p3rcDEcdCJHWseuCEWNk9A9MGGCuJfQEd3assHe1Be7Nzw@mail.gmail.com> (raw)
[-- 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
reply other threads:[~2013-07-19 9:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=CAA01p3rcDEcdCJHWseuCEWNk9A9MGGCuJfQEd3assHe1Be7Nzw@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).