From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: breadcrumbs for Info . . . . . . Date: Thu, 12 Jun 2008 23:27:12 -0400 Message-ID: References: <009d01c8cb55$13d53e20$0200a8c0@us.oracle.com> <87fxrkltma.fsf@jurta.org> <00ae01c8cb71$c26aeef0$0200a8c0@us.oracle.com> <873ankqou6.fsf@jurta.org> <00d901c8cbc9$7df36fb0$0200a8c0@us.oracle.com> <87tzfzk331.fsf@jurta.org> <00a501c8ccdd$93328720$c2b22382@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1213327654 12779 80.91.229.12 (13 Jun 2008 03:27:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Jun 2008 03:27:34 +0000 (UTC) Cc: 'Juri Linkov' , emacs-devel@gnu.org To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 13 05:28:17 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K6zxU-00022s-Bm for ged-emacs-devel@m.gmane.org; Fri, 13 Jun 2008 05:28:13 +0200 Original-Received: from localhost ([127.0.0.1]:38423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K6zwf-0005xQ-36 for ged-emacs-devel@m.gmane.org; Thu, 12 Jun 2008 23:27:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K6zwb-0005xJ-2y for emacs-devel@gnu.org; Thu, 12 Jun 2008 23:27:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K6zwZ-0005wv-G7 for emacs-devel@gnu.org; Thu, 12 Jun 2008 23:27:16 -0400 Original-Received: from [199.232.76.173] (port=51731 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K6zwZ-0005ws-9b for emacs-devel@gnu.org; Thu, 12 Jun 2008 23:27:15 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:5404) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K6zwY-0003Gt-6a for emacs-devel@gnu.org; Thu, 12 Jun 2008 23:27:15 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao0FAGqFUUhMCpzv/2dsb2JhbACBW60G X-IronPort-AV: E=Sophos;i="4.27,635,1204520400"; d="scan'208";a="22474575" Original-Received: from smtp.pppoe.ca (HELO smtp.teksavvy.com) ([65.39.196.238]) by ironport2-out.teksavvy.com with ESMTP; 12 Jun 2008 23:27:12 -0400 Original-Received: from pastel.home ([76.10.156.239]) by smtp.teksavvy.com (Internet Mail Server v1.0) with ESMTP id TJO41412; Thu, 12 Jun 2008 23:27:12 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 134A085E3; Thu, 12 Jun 2008 23:27:12 -0400 (EDT) In-Reply-To: <00a501c8ccdd$93328720$c2b22382@us.oracle.com> (Drew Adams's message of "Thu, 12 Jun 2008 15:42:20 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:99057 Archived-At: >> 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'm not so sure. The same reasons that might push someone to want to see "*Note ::" in the main text might push someone to want to see them in the breadcrumbs. The reasons are typically the someone unclea(r|n) behavior of invisible text when you move cursor around or when you copy&paste it. So if you want to trat it as a bug, a better fix would be to really refrain from inserting "* Note ::" in the first place. I.e. use a different buffer-text representation for your breadcrumbs. This may not be very easy to do either because you then have to change all the link-following code to deal with the new hyperlink format used in the breadcrumbs. I think it's a good feature, so I suggest you go back to the previous version which didn't mess around with Info-hide-note-references, then rework the code to stay with the 80-columns limit, and then someone can maybe install it. I do worry about the (string= "Top" up) test: what happens if your info file is slightly messed up and you never hit a reference to "Top"? Stefan > 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. > 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