all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [patch] 21.2 lisp-mnt.el - Regexp fix + faster find-file
@ 2003-09-14 17:43 Jari Aalto+mail.linux
  0 siblings, 0 replies; only message in thread
From: Jari Aalto+mail.linux @ 2003-09-14 17:43 UTC (permalink / raw)



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/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-09-14 17:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-14 17:43 [patch] 21.2 lisp-mnt.el - Regexp fix + faster find-file Jari Aalto+mail.linux

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.