From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Boruch Baum Newsgroups: gmane.emacs.bugs Subject: bug#48179: bookmark-fontify [PATCH] Date: Wed, 5 May 2021 12:30:38 -0400 Message-ID: <20210505163038.bq4oupkuiago6kcd@E15-2016.optimum.net> References: <20210503001358.mjafsjlumdamrlvh@E15-2016.optimum.net> <87zgxcdzh3.fsf@gnus.org> <20210503091204.qhc2tda76wh6345w@E15-2016.optimum.net> <87im40cgxz.fsf@gnus.org> <20210503095828.66mcqkxyznb2vdja@E15-2016.optimum.net> <87v97yan85.fsf@gnus.org> <87lf8uan2m.fsf@gnus.org> <87zgxan7lx.fsf@tcd.ie> <878s4t8up2.fsf@gnus.org> <8735v1jrit.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6217"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: NeoMutt/20180716 Cc: Lars Ingebrigtsen , 48179@debbugs.gnu.org To: "Basil L. Contovounesios" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 05 18:31:37 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1leKQx-0001Pa-It for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 05 May 2021 18:31:35 +0200 Original-Received: from localhost ([::1]:35266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leKQw-0006KL-Eh for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 05 May 2021 12:31:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leKQQ-0006Dq-KO for bug-gnu-emacs@gnu.org; Wed, 05 May 2021 12:31:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49885) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leKQQ-0006Ef-9x for bug-gnu-emacs@gnu.org; Wed, 05 May 2021 12:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1leKQQ-0006Ox-73 for bug-gnu-emacs@gnu.org; Wed, 05 May 2021 12:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Boruch Baum Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 May 2021 16:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48179 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch fixed Original-Received: via spool by 48179-submit@debbugs.gnu.org id=B48179.162023225324552 (code B ref 48179); Wed, 05 May 2021 16:31:02 +0000 Original-Received: (at 48179) by debbugs.gnu.org; 5 May 2021 16:30:53 +0000 Original-Received: from localhost ([127.0.0.1]:33185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1leKQG-0006Nw-PF for submit@debbugs.gnu.org; Wed, 05 May 2021 12:30:53 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:43023) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1leKQD-0006Ne-Lc for 48179@debbugs.gnu.org; Wed, 05 May 2021 12:30:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620232242; bh=X4aDMYHdo3Nu1vkhWDU9atVQZY8q7r+XUi/eOQFhOzI=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=LJCGUHmY2mpM4GdT7iak52xYqqDkZrM16S6ZaItwK4aZqKuNxbDrpooFk2GgZc0RA DzBfaKXoscISbvOGsoPccWupSD24uQCWp4kcaqdDTnxx4A1gz/2JSVnttrriMuYhuq fG+tLOkaiQmLB7QHwve9lNjE5b23+3/sYZPY+UPM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from E15-2016.optimum.net ([70.19.86.82]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MrhUK-1lAY693WcO-00ne77; Wed, 05 May 2021 18:30:42 +0200 Content-Disposition: inline In-Reply-To: <8735v1jrit.fsf@tcd.ie> X-Provags-ID: V03:K1:259qdofWAAtwGZFXi7+s93+XXn5ABNmlLJbmsxwcXQHRUBJGG2a QG5v+Ei4u0B5SdmKThobmUUES1syf50VxNZMBb6VGC7EIn55eeL+17jjwjxhCymeL76L0xo 89+W6Ngcdac8lGmruLb+pF3AL22qBAXF7nAWcRDag/E1wFrWK9cJhddsNUv/Nk1EKm8b5Cz Y9XQOeRkkM/EOHupS0h+Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:usatxDi92+I=:5llpCiqqSgBDIuqaTG1VWy c8CXWGeFH+oEf8w/jUF4v/Ri39JHHBlLxX8xlIwAWGxeZlt5xQQezix83qj5NYPk2Xoob/BZl oyyVJedABReTj1le2ERi6ppn8dhw5L05cLgjoR2J6PDfxe9ZO8eW0b2u86xsZi3PH81t+SMlW cEFfeiHMJ+WNuwCijskIvqGt1L/DnLYaew0eE0SpYijT7Sek6aGxaVnDY5VAfeRLwR1Od5zFO RGdFuPzhciFIVikdITQ44mlUjMrSOysLlEY75tXOs5n/GjJzbaWrMO7aq09njSio3K9OvOQBM Mij695c6gDSaWvh22rm67o1v1uochZtzA7prfPEubrUzqZpeqzPxPhOHXfcNqSJPbnPqn9S5G l/rBF7Kgzstjpfx16dQ+afKWW//AP6wrjs9UqppYHM+mdWfxI01K2FVlISGHomTPTyRxXKj2z +YqEAFIVjoG1edMkceN1Gpo6aqACGKvvBKMUBkrPve6hsolCtyKU47h05xF+BOCTT891iS+XI fW5QBFCNb8eF2wKPK894OO6DdrK2whMXb5OPMnHwPw3+bGabsIzq8Hkv9VSMjmroZDA/KP2fI rWJ8qNTmBD1cfSPPxDMdwhxP7bKdZFd5sIsCeOnaFa1akAhdniNwz/kGrfmpF3a1eHMdPdoWb /Sh25dxtry44LHN1EPjmXOLBJ3ynt52b5Y0uSQyWQH7Wx5QsNmk6UPSDBjDyAk5naD+Lxy2hD wBcA83Ojjk+QT8u/QqmGsxc9c6L/e36ZCFE+0X2SlkRI2hsDnwC13X9DnWWGwuFo+QPWS0h5 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:205725 Archived-At: On 2021-05-05 13:26, Basil L. Contovounesios wrote: > Lars Ingebrigtsen writes: > > "Basil L. Contovounesios" writes: > > > >> If you 'C-x r m' more than once in the same file, the first overlay > >> remains even after deleting the bookmark. Shouldn't the first overla= y > >> be deleted when its bookmark position is overwritten? > > > > You mean when giving the bookmark the same name? > > Yes, sorry, I meant multiple 'C-x r m RET' in the same buffer. > > > (You can have several bookmarks in the same file with different > > names.) > > > > Yes, that would make sense. > > Thanks, Basil, I went to start doing more work on this and see you made a commit in the interim so let me coordinate before we end up cross-commiting (For me, this is especially important since I'm working with debian v27.1 locally and applying patches to v28 which you seem to using locally). 1) For function bookmark--unfontify If more than one buffer in the list can be acted upon, then variable 'found' @line ~472 should be set nil at this point. If only one buffer in the list can be acted upon, then @line ~469 should either check variable 'found' or @line ~476 should set the list nil, both easier using the prior pop idiom than the dolist idiom. 2) For function bookmark-delete-all This seems to be a new function in v28, that I don't have locally. I see it when performing a diff. Because it takes a (reasonable and efficient) 'short-cut' method, it won't delete any fontified overlays, so it needs a variation of function bookmark--unfontify: (defun bookmark--unfontify-all () "Remove all bookmarks' colorized overlays. This function is meant to be called by function `bookmark-delete-all'." (dolist (buf (buffer-list)) (with-current-buffer buf (save-restriction (widen) (remove-overlays (point-min) (point-max) 'category 'bookmark)))= )) 3) For function bookmark-set-internal Additional logic is required in order to account for argument variable 'overwrite-or-push'. If I'm understanding those features correctly, @lines ~875-878 should be amended to something like: ((eq overwrite-or-push 'overwrite) (when (setq prior-bm (bookmark-get-bookmark str t)) (bookmark--unfontify prior-bm)) (bookmark-store str (cdr record) nil)) ((eq overwrite-or-push 'push) (when (setq prior-bm (bookmark-get-bookmark str t)) (bookmark--unfontify prior-bm)) (bookmark-store str (cdr record) t)) For the above snippet, variable 'prior-bm' should be defined locally scoped @line ~861 4) I was expecting to find some sort of bookmark hook function in variable 'find-file-hooks'. The idea would be thatd when a file is read it's stored bookmarks are immediately fontified. (defun bookmark--find-file-hook-function () "Fontify all bookmarks in newly found file." (let (pos overlay) (dolist (bm (mapcar 'cdr bookmark-alist)) (when (and (equal buffer-file-name (expand-file-name (or (cdr (assq 'filename bm))= ""))) (setq pos (cdr (assq 'position bm)))) (save-excursion (goto-char pos) (setq overlay (make-overlay (point-at-bol) (min (point-max) (1+ (point-at-eo= l))))) (overlay-put overlay 'category 'bookmark) (overlay-put overlay 'face 'bookmark-face)))))) That should go some way to account for your catch and some other scenarios. There may be others that crop up. =2D- hkp://keys.gnupg.net CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0