emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

resend: [PATCH] ignoring Info extensions


From: Jan Nieuwenhuizen
Subject: resend: [PATCH] ignoring Info extensions
Date: Thu, 11 Mar 2004 20:47:57 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

Let's try this one again.

From: Jan Nieuwenhuizen <address@hidden>
Subject: [PATCH] ignoring Info extensions
To: address@hidden (Karl Berry)
cc: address@hidden
Date: Thu, 26 Feb 2004 12:12:36 +0100
Message-ID: <address@hidden>

Karl Berry writes:

>     We may want to skip some whitespace around the
>     cookie...
>
> I think [..] we do want to skip a newline after a cookie.

> I think it would be good to post the code to the list and ask "someone"
> to make sure it gets into the RC branch (somehow).

Done, patch below.

Greetings,
Jan.

Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.5713
diff -p -u -r1.5713 ChangeLog
--- lisp/ChangeLog      25 Feb 2004 00:07:33 -0000      1.5713
+++ lisp/ChangeLog      26 Feb 2004 01:38:24 -0000
@@ -1,3 +1,8 @@
+2004-02-25  Jan Nieuwenhuizen  <address@hidden>
+
+       * info.el (Info-hide-cookies-node): New function.
+       (Info-select-node): Use it.
+
 2004-02-24  Vinicius Jose Latorre  <address@hidden>
 
        * ebnf-abn.el: New file, implements an ABNF parser.
Index: lisp/info.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/info.el,v
retrieving revision 1.376
diff -p -u -r1.376 info.el
--- lisp/info.el        29 Dec 2003 19:18:53 -0000      1.376
+++ lisp/info.el        26 Feb 2004 01:38:35 -0000
@@ -1139,6 +1139,23 @@ any double quotes or backslashes must be
               start (point) `(display ,image rear-nonsticky (display)))))))
     (set-buffer-modified-p nil)))
 
+;; Texinfo 4.7 will add cookies of the form address@hidden CONTENTS 
address@hidden
+;; Hide any construct of the general form address@hidden@-^_][ ...  
address@hidden@-^_]],
+;; including one optional trailing newline.
+(defun Info-hide-cookies-node ()
+  "Hide unrecognised cookies in current node."
+  (save-excursion
+    (let ((inhibit-read-only t)
+         (case-fold-search t))
+      (goto-char (point-min))
+      (while (re-search-forward
+             "\\(\0[\0-\37][[][^\0]*\0[\0-\37][]]\n?\\)"
+             nil t)
+       (let* ((start (match-beginning 1)))
+         (if (not (get-text-property start 'invisible))
+             (put-text-property start (point) 'invisible t)))))
+    (set-buffer-modified-p nil)))
+
 (defun Info-select-node ()
   "Select the info node that point is in."
   ;; Bind this in case the user sets it to nil.
@@ -1175,6 +1192,7 @@ any double quotes or backslashes must be
        (if Info-enable-active-nodes (eval active-expression))
        (Info-fontify-node)
        (Info-display-images-node)
+       (Info-hide-cookies-node)
        (run-hooks 'Info-selection-hook)))))
 
 (defun Info-set-mode-line ()

-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]