]> code.delx.au - gnu-emacs-elpa/commitdiff
* packages/all-1.0.el: Change version. Address byte-compiler warnings.
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 20 Apr 2011 16:40:17 +0000 (13:40 -0300)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 20 Apr 2011 16:40:17 +0000 (13:40 -0300)
Rename the `marker' property to `all-marker'.
(all-mode-map): Move initialization into declaration.
(all-buffer): Mark buffer-local.
(all-mode): Use define-derived-mode.  Setup the change-functions
buffer-locally.
(all): Use read-string.  Let-bind all-initialization-p.
(all-insert): Use a `match' face text property rather then
a `highlight' face overlay for the match highlight.
* admin/archive-contents.el (batch-make-archive-contents): Don't burp
if a commentary section is missing.
* .bzrignore: Ignore .elc files.
* packages/load-dir-0.0.2.el: Update Commentary from
load-dir-readme.txt.

.bzrignore [new file with mode: 0644]
ChangeLog
admin/archive-contents.el
packages/all-1.0.el [moved from packages/all-19970304.el with 65% similarity]
packages/all-readme.txt
packages/archive-contents
packages/load-dir-0.0.2.el

diff --git a/.bzrignore b/.bzrignore
new file mode 100644 (file)
index 0000000..c531d98
--- /dev/null
@@ -0,0 +1 @@
+*.elc
index ce5bde290f07b83b278000ca97b51f8092196511..758ba04e3ae86e48506d98fb0744b60d9518737b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2011-04-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * packages/all-1.0.el: Change version.  Address byte-compiler warnings.
+       Rename the `marker' property to `all-marker'.
+       (all-mode-map): Move initialization into declaration.
+       (all-buffer): Mark buffer-local.
+       (all-mode): Use define-derived-mode.  Setup the change-functions
+       buffer-locally.
+       (all): Use read-string.  Let-bind all-initialization-p.
+       (all-insert): Use a `match' face text property rather then
+       a `highlight' face overlay for the match highlight.
+       * admin/archive-contents.el (batch-make-archive-contents): Don't burp
+       if a commentary section is missing.
+       * .bzrignore: Ignore .elc files.
+       * packages/load-dir-0.0.2.el: Update Commentary from
+       load-dir-readme.txt.
+
 2011-04-20  Per Abrahamsen  <abraham@dina.kvl.dk>
 
        * packages/all-19970304.el: New package.
index 75c75e7f3d0d10185213732e102e30a5e31cb721..5254fbe24d7c2f2b191e5f3bfc9f33fa3e7e8f7b 100644 (file)
                                                 (concat pkg "-readme.txt"))
                             (erase-buffer)
                             (emacs-lisp-mode)
-                            (insert commentary)
+                            (insert (or commentary
+                                        (prog1 "No description"
+                                          (message "Missing Commentary in %s"
+                                                   file))))
                             (goto-char (point-min))
                             (while (looking-at ";*[ \t]*\\(commentary[: \t]*\\)?\n")
                               (delete-region (match-beginning 0)
similarity index 65%
rename from packages/all-19970304.el
rename to packages/all-1.0.el
index e5ddf14b91c9a186c33499663ebdc0d22f5ffe31..0d2fe22787b7cfea863dcc0678f8dbf765ee0fd0 100644 (file)
@@ -1,10 +1,10 @@
-;;; all.el --- Edit all lines matching a given regexp.
+;;; all.el --- Edit all lines matching a given regexp
 
-;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1992, 1994, 2011 Free Software Foundation, Inc.
 ;; Copyright (C) 1994 Per Abrahamsen
 
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
-;; Version: $Id: all.el,v 5.2 1997/03/04 10:29:42 abraham Exp $
+;; Version: 1.0
 ;; Keywords: matching
 
 ;; LCD Archive Entry:
 
 ;;; Commentary:
 
-;; Just like occur, except that changes in the *All* buffer is
+;; Just like occur, except that changes in the *All* buffer are
 ;; propagated to the original buffer.
 
-;; I also added highlighting of the matches.
-
 ;; You can no longer use mouse-2 to find a match in the original file,
-;; since the default definition of mouse to is useful.  
+;; since the default definition of mouse too is useful.
 ;; However, `C-c C-c' still works.
 
 ;; Line numbers are not listed in the *All* buffer.
 ;; Some limitations:
 
 ;; - Undo in the *All* buffer is an ordinary change in the original.
-;; - Changes to the original buffer is not reflected in the *All* buffer.
+;; - Changes to the original buffer are not reflected in the *All* buffer.
 ;; - A single change in the *All* buffer must be limited to a single match.
 
-;; Requires GNU Emacs 19.23 or later.
-
 ;;; Code: 
 
-(defvar all-mode-map ())
-
-(if all-mode-map
-    ()
-  (setq all-mode-map (make-sparse-keymap))
-  (define-key all-mode-map "\C-c\C-c" 'all-mode-goto))
+(defvar all-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\C-c\C-c" 'all-mode-goto)
+    map))
 
 (defvar all-buffer nil)
+(make-variable-buffer-local 'all-buffer)
 
-(defun all-mode ()
+(define-derived-mode all-mode fundamental-mode "All"
   "Major mode for output from \\[all].
 
 All changes made in this buffer will be propagated to the buffer where
 you ran \\[all].
 
 Press \\[all-mode-goto] to go to the same spot in the original buffer."
-  (kill-all-local-variables)
-  (use-local-map all-mode-map)
-  (setq major-mode 'all-mode)
-  (setq mode-name "All")
-  (make-local-variable 'all-buffer)
-  (run-hooks 'all-mode-hook))
+  (add-hook 'before-change-functions 'all-before-change-function nil 'local)
+  (add-hook 'after-change-functions 'all-after-change-function nil 'local))
 
 (defun all-mode-find (pos)
   ;; Find position in original buffer corresponding to POS.
   (let ((overlay (all-mode-find-overlay pos)))
     (if overlay
-       (+ (marker-position (overlay-get overlay 'marker))
+       (+ (marker-position (overlay-get overlay 'all-marker))
           (- pos (overlay-start overlay))))))
 
 (defun all-mode-find-overlay (pos)
   ;; Find the overlay containing POS.
   (let ((overlays (overlays-at pos)))
-    (while (and overlays (null (overlay-get (car overlays) 'marker)))
+    (while (and overlays (null (overlay-get (car overlays) 'all-marker)))
       (setq overlays (cdr overlays)))
     (car-safe overlays)))
 
@@ -100,7 +91,7 @@ Press \\[all-mode-goto] to go to the same spot in the original buffer."
 (defvar all-initialization-p nil)
 
 (defun all-before-change-function (from to)
-  ;; Check that change is legal
+  ;; Check that change is legal.
   (and all-buffer
        (not all-initialization-p)
        (let ((start (all-mode-find-overlay from))
@@ -108,8 +99,6 @@ Press \\[all-mode-goto] to go to the same spot in the original buffer."
         (not (and start (eq start end))))
        (error "Changes should be limited to a single text piece")))
 
-(add-hook 'before-change-functions 'all-before-change-function)
-
 (defun all-after-change-function (from to length)
   ;; Propagate changes from *All* buffer.
   (and all-buffer
@@ -117,15 +106,11 @@ Press \\[all-mode-goto] to go to the same spot in the original buffer."
        (let ((buffer (current-buffer))
             (pos (all-mode-find from)))
         (if pos
-            (progn
-              (set-buffer all-buffer)
-              (delete-region pos (+ pos length))
+            (with-current-buffer all-buffer
               (save-excursion
                 (goto-char pos)
-                (insert-buffer-substring buffer from to))
-              (set-buffer buffer))))))
-
-(add-hook 'after-change-functions 'all-after-change-function)
+                 (delete-region pos (+ pos length))
+                (insert-buffer-substring buffer from to)))))))
 
 ;;;###autoload
 (defun all (regexp &optional nlines)
@@ -140,29 +125,24 @@ Interactively it is the prefix arg.
 
 The lines are shown in a buffer named `*All*'.
 Any changes made in that buffer will be propagated to this buffer."
-  (interactive (list (let* ((default (car regexp-history))
-                           (input 
-                            (read-from-minibuffer
-                             (if default
-                                 (format 
-   "Edit lines matching regexp (default `%s'): " default)
-                               "Edit lines matching regexp: ")
-                             nil nil nil
-                             'regexp-history)))
-                      (if (> (length input) 0) input
-                        (setcar regexp-history default)))
-                    current-prefix-arg))
+  (interactive
+   (list (let* ((default (car regexp-history)))
+           (read-string
+            (if default
+                (format 
+                 "Edit lines matching regexp (default `%s'): " default)
+              "Edit lines matching regexp: ")
+            nil 'regexp-history default))
+         current-prefix-arg))
   (setq nlines (if nlines (prefix-numeric-value nlines)
                 list-matching-lines-default-context-lines))
-  (setq all-initialization-p t)
-  (let ((first t)
-       (buffer (current-buffer))
+  (let ((all-initialization-p t)
+        (buffer (current-buffer))
        (prevend nil)
        (prevstart nil)
        (prevpos (point-min)))
     (with-output-to-temp-buffer "*All*"
-      (save-excursion
-       (set-buffer standard-output)
+      (with-current-buffer standard-output
        (all-mode)
        (setq all-buffer buffer)
        (insert "Lines matching ")
@@ -172,7 +152,7 @@ Any changes made in that buffer will be propagated to this buffer."
       (if (eq buffer standard-output)
          (goto-char (point-max)))
       (save-excursion
-       (beginning-of-buffer)
+       (goto-char (point-min))
        ;; Find next match, but give up if prev match was at end of buffer.
        (while (and (not (= prevpos (point-max)))
                    (re-search-forward regexp nil t))
@@ -189,39 +169,36 @@ Any changes made in that buffer will be propagated to this buffer."
                        (if (> nlines 0)
                            (forward-line (1+ nlines))
                            (forward-line 1))
-                       (point)))
-                marker)
+                       (point))))
            (cond ((null prevend)
                   (setq prevstart start
                        prevend end))
                  ((> start prevend)
-                  (all-insert)
+                  (all-insert prevstart prevend regexp nlines)
                   (setq prevstart start
                         prevend end))
                  (t
                   (setq prevend end)))))
        (if prevend
-           (all-insert)))))
-  (setq all-initialization-p nil))
+           (all-insert prevstart prevend regexp nlines))))))
 
-(defun all-insert ()
+(defun all-insert (start end regexp nlines)
   ;; Insert match.
-  (save-excursion
-    (setq marker (make-marker))
-    (set-marker marker prevstart)
-    (set-buffer standard-output)
-    (let ((from (point))
-         to)
-      (insert-buffer-substring buffer prevstart prevend)
-      (setq to (point))
-      (overlay-put (make-overlay from to) 'marker marker)
-      (goto-char from)
-      (while (re-search-forward regexp to t)
-       (overlay-put (make-overlay (match-beginning 0) (match-end 0))
-                    'face 'highlight))
-      (goto-char to)
-      (if (> nlines 0)
-         (insert "--------\n")))))
+  (let ((marker (copy-marker start))
+        (buffer (current-buffer)))
+    (with-current-buffer standard-output
+      (let ((from (point))
+            to)
+        (insert-buffer-substring buffer start end)
+        (setq to (point))
+        (overlay-put (make-overlay from to) 'all-marker marker)
+        (goto-char from)
+        (while (re-search-forward regexp to t)
+          (put-text-property (match-beginning 0) (match-end 0)
+                             'face 'match))
+        (goto-char to)
+        (if (> nlines 0)
+            (insert "--------\n"))))))
 
 (provide 'all)
 
index ebceec939c31ff7d2938a7bb821f5f5b92479c98..e09ec22b395deaf02e8c1f8ba7fa9bbbc43877d7 100644 (file)
@@ -1,10 +1,8 @@
-Just like occur, except that changes in the *All* buffer is
+Just like occur, except that changes in the *All* buffer are
 propagated to the original buffer.
 
-I also added highlighting of the matches.
-
 You can no longer use mouse-2 to find a match in the original file,
-since the default definition of mouse to is useful.  
+since the default definition of mouse too is useful.
 However, `C-c C-c' still works.
 
 Line numbers are not listed in the *All* buffer.
@@ -14,7 +12,5 @@ Ok, it is _not_ just like occur.
 Some limitations:
 
 - Undo in the *All* buffer is an ordinary change in the original.
-- Changes to the original buffer is not reflected in the *All* buffer.
+- Changes to the original buffer are not reflected in the *All* buffer.
 - A single change in the *All* buffer must be limited to a single match.
-
-Requires GNU Emacs 19.23 or later.
index 7870263aa6ecb7a4b9169359afabe03b2db47e1b..7c0f776980421af117c666ccaadf58b6197a8365 100644 (file)
@@ -1,7 +1,7 @@
 (1
  (all .
-      [(19970304)
-       nil "Edit all lines matching a given regexp." single])
+      [(1 0)
+       nil "Edit all lines matching a given regexp" single])
  (auctex .
         [(11 86)
          nil "Integrated environment for *TeX*" tar])
index cec7ce5d583e31b90ca00ac24613e96d506b42e4..1d4e0b63009c1d697f84ba5e906fc0a583378c18 100644 (file)
 
 ;;; Commentary:
 
-;; This library will load all Lisp files found in the `load-dirs' variable.
-;; (you may also want to set `load-dir-debug', `load-dir-recursive',
-;;  and `load-dir-ignore-errors')
-
-;; Normal usage in .emacs:
-
-;; (setq load-dirs '("~/mystuff")) ;; or Customize it
-;; (require 'load-dir) ;; this will add `load-dirs' to your `after-init-hook'
-
-;; Then after startup:
-
-;; Explicitly load new files only...
-;; M-x load-dirs
-
-;; Or reload all your files...
-;; M-x load-dirs-reload
+;; This package provides a way to load all Emacs Lisp snippets (they
+;; don't have to be libraries) in a directory on startup or when Emacs is
+;; already running.  It won't reload snippets unless the user requests
+;; it, so for instance adding a lambda to a hook is usually safe.
+;;
+;; You can specify ~/.emacs.d/load.d, a single directory, or a list of
+;; directories.  The file search can be recursive.
+;;
+;; The intent with ~/.emacs.d/load.d is to give package installers like
+;; el-get.el (see https://github.com/dimitri/el-get) and other tools a
+;; way to easily bootstrap themselves without necessarily modifying your
+;; .emacs or custom files directly.
 
 ;;; Code: