unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* breadcrumbs for Info . . . . . .
@ 2008-06-10 23:52 Drew Adams
  2008-06-11  0:04 ` Juri Linkov
  0 siblings, 1 reply; 41+ messages in thread
From: Drew Adams @ 2008-06-10 23:52 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]

Breadcrumbs are an orientation and navigation aid for hypertext. They tell you
where you are in the node hierarchy and let you go directly to any ancestor
node. The orientation aid alone is very helpful, particularly when you are
following cross-reference links - it lets you know exactly where in the document
structure you have arrived.

Attached is a patch for adding breadcrumbs to Info.

There is currently no option for turning this off. That could be added if you
think this is something some people won't want sometimes.

I chose not to put any breadcrumbs at the top level (Top) of a manual, and there
is no entry for the manuals directory (dir) in a breadcrumbs chain. These could
be added, if people think it is worth it.

Breadcrumbs look like this (this is for Emacs manual node Numbered Backups),
where each step is a link to the given ancestor node:

  Top > Files > Saving > Backup

Breadcrumbs are on a single line, directly under the node navigation line (which
is just under the header line).

Change log entry:

2008-06-10 Drew Adams  <drew.adams@oracle.com>
	* info.el:
	(Info-fontify-node): Added breadcrumbs.

[-- Attachment #2: info-el-2008-06-10.patch --]
[-- Type: application/octet-stream, Size: 2577 bytes --]

diff -u -w info.el info-patched-2008-06-10.el
--- info.el	2008-06-10 16:24:28.000000000 -0700
+++ info-patched-2008-06-10.el	2008-06-10 16:27:08.000000000 -0700
@@ -3756,6 +3756,30 @@
 		((string-equal (downcase tag) "prev") Info-prev-link-keymap)
 		((string-equal (downcase tag) "next") Info-next-link-keymap)
 		((string-equal (downcase tag) "up"  ) Info-up-link-keymap))))))
+        
+        ;; Add breadcrumbs
+        (unless (string= "Top" Info-current-node)
+          (let ((nod Info-current-node)
+                (onode Info-current-node)
+                (crumbs nil)
+                (done nil))
+            (while (not done)
+              (let ((up (Info-extract-pointer "up")))
+                (cond ((string= "Top" up)
+                       (setq crumbs (if crumbs
+                                        (concat "*Note Top:: > " crumbs)
+                                      "*Note Top::"))
+                       (setq done t))
+                      (t
+                       (Info-goto-node up)
+                       (setq nod Info-current-node)
+                       (when crumbs (setq crumbs (concat " > " crumbs)))
+                       (setq crumbs (concat "*Note " nod ":: " crumbs))))))
+            (Info-goto-node onode)
+            (forward-line 1)
+            (insert (concat crumbs "\n\n"))))
+        
+        ;; Treat header line
         (when Info-use-header-line
           (goto-char (point-min))
           (let* ((header-end (line-end-position))
@@ -3817,13 +3841,15 @@
       ;; Fontify cross references
       (goto-char (point-min))
       (when (or not-fontified-p fontify-visited-p)
-        (while (re-search-forward "\\(\\*Note[ \n\t]+\\)\\([^:]*\\)\\(:[ \t]*\\([^.,:(]*\\)\\(\\(([^)]*)\\)[^.,:]*\\)?[,:]?\n?\\)" nil t)
+        (while (re-search-forward "\\(\\*Note[ \n\t]+\\)\\([^:]*\\)\\(:[ \t]*\
+\\([^.,:(]*\\)\\(\\(([^)]*)\\)[^.,:]*\\)?[,:]?\n?\\)" nil t)
           (let ((start (match-beginning 0))
                 (next (point))
                 other-tag)
             (when not-fontified-p
               (when Info-hide-note-references
-                (when (not (eq Info-hide-note-references 'hide))
+                (when (and (not (eq Info-hide-note-references 'hide))
+                           (> (line-number-at-pos) 4)) ; Skip breadcrumbs
                   ;; *Note is often used where *note should have been
                   (goto-char start)
                   (skip-syntax-backward " ")

Diff finished.  Tue Jun 10 16:27:37 2008

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

end of thread, other threads:[~2008-06-15 19:46 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-10 23:52 breadcrumbs for Info . . . . . Drew Adams
2008-06-11  0:04 ` Juri Linkov
2008-06-11  3:18   ` Drew Adams
2008-06-11  9:34     ` Juri Linkov
2008-06-11 13:46       ` Drew Adams
2008-06-11 18:59         ` Eli Zaretskii
2008-06-11 22:40         ` Juri Linkov
2008-06-12  2:01           ` Miles Bader
2008-06-12 22:42           ` Drew Adams
2008-06-13  3:27             ` Stefan Monnier
2008-06-13  6:34               ` Drew Adams
2008-06-13  8:43                 ` Thien-Thi Nguyen
2008-06-13 13:55                   ` Drew Adams
2008-06-13 17:17                     ` Thien-Thi Nguyen
2008-06-13 17:52                       ` Drew Adams
2008-06-13 19:55                         ` Thien-Thi Nguyen
2008-06-13 20:10                           ` Drew Adams
2008-06-15 18:19                           ` Juri Linkov
2008-06-13 14:05                   ` Stefan Monnier
2008-06-13 15:12                     ` Drew Adams
2008-06-13 17:16                       ` Stefan Monnier
2008-06-13 18:32                     ` Thien-Thi Nguyen
2008-06-14  9:47                       ` Eli Zaretskii
2008-06-14 10:01                         ` Thien-Thi Nguyen
2008-06-13 13:58                 ` Stefan Monnier
2008-06-13 15:11                   ` Drew Adams
2008-06-13 20:34                     ` Stefan Monnier
2008-06-13 22:11                       ` Drew Adams
2008-06-13 22:44                         ` Stefan Monnier
2008-06-14  9:45                           ` Drew Adams
2008-06-14 16:16                             ` Stefan Monnier
2008-06-14 17:24                               ` Drew Adams
2008-06-14 18:04                                 ` Stefan Monnier
2008-06-15  0:27                                 ` Juri Linkov
2008-06-15  7:33                                   ` Drew Adams
2008-06-15 18:23                                     ` Juri Linkov
2008-06-15 19:46                                       ` Drew Adams
2008-06-15  0:28                       ` Juri Linkov
2008-06-15  2:04                         ` Stefan Monnier
2008-06-15 18:18                           ` Juri Linkov
2008-06-15  7:55                         ` Drew Adams

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).