bug-gnu-emacs
[Top][All Lists]
Advanced

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

[patch] 21.2 lisp-mnt.el - Regexp fix + faster find-file


From: Jari Aalto+mail.linux
Subject: [patch] 21.2 lisp-mnt.el - Regexp fix + faster find-file
Date: Sun, 14 Sep 2003 20:43:02 +0300
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/20.7 (windows-nt) (i386-*-nt5.0.2195)

The find-file-mode is suppressed because M-x finder-commentary
fails if buffer is in selective display format (folded) and
it cannot find the "Change Log:" etc. headers.

When file is loaded in "pure", then no hook can change the 
buffer content (like folding.el, outline.el etc).

You can see the bug by running:

1. Get folding.el http://www.csd.uu.se/~andersl/emacs.shtml
2. find-file folding.el
3. Make it folded - M-x folding-mode
4. Run M-x finder-commentary RET folding RET
5. Error "Can't find any Commentary section"

    (defun finder-commentary (file)
      "Display FILE's commentary section.
    FILE should be in a form suitable for passing to `locate-library'."
      (interactive "sLibrary name: ")
      (let* ((str (lm-commentary (or (finder-find-library file)
                                     (finder-find-library (concat file ".el"))
                                     (error "Can't find library %s" file)))))
        (if (null str)
=>            (error "Can't find any Commentary section"))



2003-09-14  Jari Aalto  <jari.aalto@poboxes.com>

        * emacs-lisp/lisp-mnt.el (lm-get-header-re): Added
        surrounding \\( and \\) around the header. Like
        for lm-history-header 'Change Log\\|History'. Otherwise
        the regexp is wrong.
        (lm-with-file): Set ` find-file-hooks' nil before
        find-file-noselect. File content is loaded
        in pure format.


===================================================================
RCS file: lisp-mnt.el,v
retrieving revision 1.1
diff -bwu -r1.1 lisp-mnt.el
--- lisp-mnt.el 2003-09-14 19:51:47+03  1.1
+++ lisp-mnt.el 2003-09-14 19:53:02+03
@@ -163,8 +163,8 @@
 If called with optional MODE and with value `section',
 return section regexp instead."
   (if (eq mode 'section)
-      (concat "^;;;;* " header ":[ \t]*$")
-    (concat lm-header-prefix header "[ \t]*:[ \t]*")))
+      (concat "^;;;;* \\(" header "\\):[ \t]*$")
+    (concat lm-header-prefix "\\(" header "\\)[ \t]*:[ \t]*")))
 
 (defun lm-get-package-name ()
   "Return package name by looking at the first line."
@@ -250,7 +250,9 @@
   (let ((filesym (make-symbol "file")))
     `(save-excursion
        (let ((,filesym ,file))
-        (if ,filesym (set-buffer (find-file-noselect ,filesym)))
+        (when ,filesym 
+          (let (find-file-hooks)
+            (set-buffer (find-file-noselect ,filesym))))
         (prog1 (progn ,@body)
           (if (and ,filesym (not (get-buffer-window (current-buffer) t)))
               (kill-buffer (current-buffer))))))))


-- 
http://tiny-tools.sourceforge.net/
Swatch @time   http://www.mir.com.my/iTime/itime.htm
               http://www.ryanthiessen.com/swatch/resources.htm
Use Licenses!  http://www.linuxjournal.com/article.php?sid=6225
Which Licence? http://www.linuxjournal.com/article.php?sid=4825
OSI Licences   http://www.opensource.org/licenses/




reply via email to

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