all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Juri Linkov'" <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: RE: breadcrumbs for Info . . . . . .
Date: Thu, 12 Jun 2008 15:42:20 -0700	[thread overview]
Message-ID: <00a501c8ccdd$93328720$c2b22382@us.oracle.com> (raw)
In-Reply-To: <87tzfzk331.fsf@jurta.org>

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

> > IOW, is this a real problem in practice or just a 
> > hypothetical problem?
> 
> There were reports about Info taking substantial time to read
> Info subfiles on slow connections.  You can search for e.g.
> "Info slow connection" keywords and find posts like
> http://thread.gmane.org/gmane.emacs.devel/17436/focus=18058
> I don't know how often such situations happen nowadays.
> 
> Anyway, Info already scans the whole manual on the first visit
> to find the index nodes, so it could build an internal node tree
> as well on the same pass.

I will let others debate and decide that.

> There is also another visual problem: when Info-hide-note-references
> is nil, the displayed breadcrumbs line is not nice looking:
> 
> *Note Top:: > *Note Files::  > *Note Saving::  > *Note Backup::

That's a bug. I had tried to take care of that in the patch, but I missed some
parts. Please try the attached patch, which should fix it.

I also fixed an infinite recursion bug that occurred sometimes, due to
Info-goto-node calling Info-fontify-node and (from the patch) vice versa.

The change log remains the same.

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

diff -u -w "info.el" "info-patched-2008-06-12.el"
--- info.el	2008-06-10 16:24:28.000000000 -0700
+++ info-patched-2008-06-12.el	2008-06-12 15:29:32.000000000 -0700
@@ -3756,6 +3756,32 @@
 		((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
+                       (let ((Info-fontify-maximum-menu-size nil)) ; Prevents infinite recursion
+                           (Info-goto-node up))
+                       (setq nod Info-current-node)
+                       (when crumbs (setq crumbs (concat " > " crumbs)))
+                       (setq crumbs (concat "*Note " nod ":: " crumbs))))))
+            (let ((Info-fontify-maximum-menu-size nil)) ; Prevents infinite recursion
+                (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 +3843,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 (or Info-hide-note-references (<= (line-number-at-pos) 4))
+                (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 " ")
@@ -3913,11 +3941,14 @@
                                             (match-end 0)
                                             '(font-lock-face t))))))
             (when not-fontified-p
-              (when (memq Info-hide-note-references '(t hide))
+              (when (or (memq Info-hide-note-references '(t hide))
+                          (<= (line-number-at-pos) 4))
                 (add-text-properties (match-beginning 3) (match-end 3)
                                      '(invisible t front-sticky nil rear-nonsticky t))
                 ;; Unhide the file name of the external reference in parens
-                (if (and (match-string 6) (not (eq Info-hide-note-references 'hide)))
+                (if (and (match-string 6)
+                         (not (eq Info-hide-note-references 'hide))
+                         (> (line-number-at-pos) 4))
                     (remove-text-properties (match-beginning 6) (match-end 6)
                                             '(invisible t front-sticky nil rear-nonsticky t)))
                 ;; Unhide newline because hidden newlines cause too long lines
@@ -3932,7 +3963,9 @@
                         (remove-text-properties (+ beg3 (match-beginning 0))
                                                 (+ beg3 (match-end 0))
                                                 '(invisible t front-sticky nil rear-nonsticky t))))))
-              (when (and Info-refill-paragraphs Info-hide-note-references)
+              (when (and Info-refill-paragraphs
+                         (or Info-hide-note-references
+                               (<= (line-number-at-pos) 4)))
                 (push (set-marker (make-marker) start)
                       paragraph-markers))))))
 
@@ -4019,7 +4052,8 @@
 				  (setq hl (cdr hl))))
                               res))) 'info-xref-visited 'info-xref)))
 	      (when (and not-fontified-p
-			 (memq Info-hide-note-references '(t hide))
+			 (or (memq Info-hide-note-references '(t hide))
+                               (<= (line-number-at-pos) 4))
 			 (not (Info-index-node)))
 		(put-text-property (match-beginning 2) (1- (match-end 6))
 				   'invisible t)

Diff finished at Thu Jun 12 15:34:19

  parent reply	other threads:[~2008-06-12 22:42 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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='00a501c8ccdd$93328720$c2b22382@us.oracle.com' \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=juri@jurta.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.