unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20177: 24.4: bookmark.el: show all annotations does not display in proper order (FIX INCLUDED)
@ 2015-03-23 10:21 Boruch Baum
  2015-03-26  1:56 ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Boruch Baum @ 2015-03-23 10:21 UTC (permalink / raw)
  To: 20177


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

When `bookmark-sort-flag' is set, the bmenu list displays in sorted
order, but the function `bookmark-show-all-annotations' (keybinding
`A'), does not.

The first attached patch file, `simple.patch', is just that.

The second attached patch file, `fancy.patch', adds an option to display
the list of all annotations as a pre-formatted org-mode buffer, based
upon the setting of a new variable,
`bookmark-show-all-annotations-in-org-mode'.

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: simple.patch --]
[-- Type: text/x-patch; name="simple.patch", Size: 539 bytes --]

--- bookmark.el	2015-03-23 04:52:30.503739608 -0400
+++ bookmark-new.el	2015-03-23 05:15:50.763694210 -0400
@@ -1756,7 +1756,7 @@
   (save-selected-window
     (pop-to-buffer (get-buffer-create "*Bookmark Annotation*") t)
     (delete-region (point-min) (point-max))
-    (dolist (full-record bookmark-alist)
+    (dolist (full-record (bookmark-maybe-sort-alist))
       (let* ((name (bookmark-name-from-full-record full-record))
              (ann  (bookmark-get-annotation full-record)))
         (insert (concat name ":\n"))

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: fancy.patch --]
[-- Type: text/x-patch; name="fancy.patch", Size: 1996 bytes --]

--- bookmark.el	2015-03-23 04:52:30.503739608 -0400
+++ bookmark-new.el	2015-03-23 06:08:22.399592029 -0400
@@ -1751,15 +1751,30 @@
           (switch-to-buffer-other-window old-buf))))))
 
 
+
+(defvar bookmark-show-all-annotations-in-org-mode nil
+"When not `nil', the command `bookmark-show-all-annotations' will
+format its display as an org-mode buffer")
+
 (defun bookmark-show-all-annotations ()
   "Display the annotations for all bookmarks in a buffer."
   (save-selected-window
     (pop-to-buffer (get-buffer-create "*Bookmark Annotation*") t)
     (delete-region (point-min) (point-max))
-    (dolist (full-record bookmark-alist)
+    (unless (null bookmark-show-all-annotations-in-org-mode)
+      (org-mode))
+    (let* ((heading-text "Bookmark annotations for ALL bookmarks")
+           (heading (if (null bookmark-show-all-annotations-in-org-mode)
+                      (concat "# " heading-text "\n----------------------------------------\n")
+                     (concat "* " heading-text "\n")))
+           (prefix (unless (null bookmark-show-all-annotations-in-org-mode)
+                     "** ")))
+      (insert heading)
+
+    (dolist (full-record (bookmark-maybe-sort-alist))
       (let* ((name (bookmark-name-from-full-record full-record))
              (ann  (bookmark-get-annotation full-record)))
-        (insert (concat name ":\n"))
+        (insert (concat prefix name ":\n"))
         (if (and ann (not (string-equal ann "")))
             ;; insert the annotation, indented by 4 spaces.
             (progn
@@ -1769,10 +1784,9 @@
                 (beginning-of-line)     ; paranoia
                 (insert "    ")
                 (forward-line)
-                (end-of-line))))))
+                (end-of-line)))))))
     (goto-char (point-min))))
 
-
 (defun bookmark-bmenu-mark ()
   "Mark bookmark on this line to be displayed by \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-select]."
   (interactive)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-06-26 14:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-23 10:21 bug#20177: 24.4: bookmark.el: show all annotations does not display in proper order (FIX INCLUDED) Boruch Baum
2015-03-26  1:56 ` Stefan Monnier
2019-06-25 17:35   ` Lars Ingebrigtsen
2019-06-25 19:43     ` Boruch Baum
2019-06-26 13:55       ` Lars Ingebrigtsen
2019-06-26 14:45         ` Boruch Baum
2019-06-26 14:47           ` Lars Ingebrigtsen
2019-06-26 14:50             ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).