From: Jamie Beardslee <beardsleejamie@gmail.com>
To: emacs-devel@gnu.org
Subject: [PATCH] Add user option to disable location in bookmarks
Date: Sun, 21 Jun 2020 07:27:48 +1200 [thread overview]
Message-ID: <87sgep35cb.fsf@gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 238 bytes --]
Hi,
I've just started using save-place-mode, and found that bookmarks really
get in the way. I figure there are probably a lot of people that use
bookmarks just to save some common files, rather than locations within a
file.
--
Jamie
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Add-user-option-to-disable-location-in-bookmarks.patch --]
[-- Type: text/x-patch, Size: 2584 bytes --]
From 17db59cbb7e060bed4c181f459b80cb67c1163b5 Mon Sep 17 00:00:00 2001
From: Jamie Beardslee <beardsleejamie@gmail.com>
Date: Sun, 21 Jun 2020 06:59:12 +1200
Subject: [PATCH] Add user option to disable location in bookmarks
When `bookmark-use-location' set to nil, bookmark-default-handler
won't try to jump to the right location in the file.
This way bookmarks can be used to just save regularly used files, and
save-place (or similar) can be relied on to, well, save the place.
---
lisp/bookmark.el | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 5bb1698171..3687a0b20f 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -170,6 +170,10 @@ bookmark-menu-heading
"Face used to highlight the heading in bookmark menu buffers."
:version "22.1")
+(defcustom bookmark-use-location t
+ "Whether to open the specific location of bookmarked files.
+See also `save-place-mode'."
+ :type 'boolean)
;;; No user-serviceable parts beyond this point.
@@ -1224,16 +1228,17 @@ bookmark-default-handler
((and buf (get-buffer buf)))
(t ;; If not, raise error.
(signal 'bookmark-error-no-filename (list 'stringp file)))))
- (if place (goto-char place))
- ;; Go searching forward first. Then, if forward-str exists and
- ;; was found in the file, we can search backward for behind-str.
- ;; Rationale is that if text was inserted between the two in the
- ;; file, it's better to be put before it so you can read it,
- ;; rather than after and remain perhaps unaware of the changes.
- (when (and forward-str (search-forward forward-str (point-max) t))
- (goto-char (match-beginning 0)))
- (when (and behind-str (search-backward behind-str (point-min) t))
- (goto-char (match-end 0)))
+ (when bookmark-use-location
+ (if place (goto-char place))
+ ;; Go searching forward first. Then, if forward-str exists and
+ ;; was found in the file, we can search backward for behind-str.
+ ;; Rationale is that if text was inserted between the two in the
+ ;; file, it's better to be put before it so you can read it,
+ ;; rather than after and remain perhaps unaware of the changes.
+ (when (and forward-str (search-forward forward-str (point-max) t))
+ (goto-char (match-beginning 0)))
+ (when (and behind-str (search-backward behind-str (point-min) t))
+ (goto-char (match-end 0))))
nil))
;;;###autoload
--
2.27.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]
next reply other threads:[~2020-06-20 19:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-20 19:27 Jamie Beardslee [this message]
2020-06-20 21:35 ` [PATCH] Add user option to disable location in bookmarks Drew Adams
2020-06-20 22:24 ` Jamie Beardslee
2020-06-20 22:50 ` Stefan Monnier
2020-06-20 23:37 ` Drew Adams
2020-06-20 23:34 ` Drew Adams
2020-06-21 0:22 ` Jamie Beardslee
2020-06-21 5:19 ` Drew Adams
2020-06-21 9:56 ` Basil L. Contovounesios
2020-06-21 9:13 ` Yuri Khan
2020-06-21 18:44 ` Drew Adams
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sgep35cb.fsf@gmail.com \
--to=beardsleejamie@gmail.com \
--cc=emacs-devel@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.