From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Jamie Beardslee Newsgroups: gmane.emacs.devel Subject: [PATCH] Add user option to disable location in bookmarks Date: Sun, 21 Jun 2020 07:27:48 +1200 Message-ID: <87sgep35cb.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="114376"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: emacs-devel@gnu.org Cancel-Lock: sha1:sqX+uJflqYKpmS1dXmJoUoY1Eo8= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 20 21:28:31 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jmjAE-000Tj3-Ok for ged-emacs-devel@m.gmane-mx.org; Sat, 20 Jun 2020 21:28:30 +0200 Original-Received: from localhost ([::1]:48704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jmjAD-0001FS-QO for ged-emacs-devel@m.gmane-mx.org; Sat, 20 Jun 2020 15:28:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmj9m-0000o4-KI for emacs-devel@gnu.org; Sat, 20 Jun 2020 15:28:02 -0400 Original-Received: from ciao.gmane.io ([159.69.161.202]:52290) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmj9l-0004u1-26 for emacs-devel@gnu.org; Sat, 20 Jun 2020 15:28:02 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1jmj9i-000T3X-Ao for emacs-devel@gnu.org; Sat, 20 Jun 2020 21:27:58 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=159.69.161.202; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/20 15:27:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 20 X-Spam_score: 2.0 X-Spam_bar: ++ X-Spam_report: (2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:252458 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-user-option-to-disable-location-in-bookmarks.patch Content-Transfer-Encoding: quoted-printable From=2017db59cbb7e060bed4c181f459b80cb67c1163b5 Mon Sep 17 00:00:00 2001 From: Jamie Beardslee 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. =2D-- 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 =2D-- 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") =20 +(defcustom bookmark-use-location t + "Whether to open the specific location of bookmarked files. +See also `save-place-mode'." + :type 'boolean) =20 ;;; No user-serviceable parts beyond this point. =20 @@ -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))))) =2D (if place (goto-char place)) =2D ;; Go searching forward first. Then, if forward-str exists and =2D ;; was found in the file, we can search backward for behind-str. =2D ;; Rationale is that if text was inserted between the two in the =2D ;; file, it's better to be put before it so you can read it, =2D ;; rather than after and remain perhaps unaware of the changes. =2D (when (and forward-str (search-forward forward-str (point-max) t)) =2D (goto-char (match-beginning 0))) =2D (when (and behind-str (search-backward behind-str (point-min) t)) =2D (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)) =20 ;;;###autoload =2D-=20 2.27.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFNBAEBCAA3FiEElxJbPtj12sn/xkPXc0qyklu3X7MFAl7uYzUZHGJlYXJkc2xl ZWphbWllQGdtYWlsLmNvbQAKCRBzSrKSW7dfs76DCACamqY/sYAA2XB3L+nKZ0vp 6g/JB9wccmLv/0VPbx98fEdP9svjHwmq+Kbc564fp4t37rUyrSlCSaEYmFnUSav4 cj2ijSI6zpT6Qmj7mF9/b/EqvHVBd5bHLwynphQgsPeA3dSzHEQUHP/VdnR03fRs uuGd/lnmHmod/hIV/0z4m82XPNBmrwNMvUfgd1l+b2hOBzSwAPk12+635M0aEFFS 4f1t12RQkfpS0v9XG5RXMyrkbDTnzDaWo+kVURtNA5U2D3suavzANfHqpCPysNjb iguY6bzMKwo7JMSAiPrnTaQznQULtAiaFyshYfcRbTWYCZ4wnU2Du/3oYMm7eNKd =nuwc -----END PGP SIGNATURE----- --==-=-=--