]> git.eshelyaron.com Git - emacs.git/commitdiff
(makefile-browser-map, makefile-mode-syntax-table): Move init inside decl.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 28 May 2006 20:56:34 +0000 (20:56 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 28 May 2006 20:56:34 +0000 (20:56 +0000)
(makefile-fill-paragraph): Use the default comment-filling code.

lisp/ChangeLog
lisp/progmodes/make-mode.el

index fe49db5163f526ff8ee9c75108ff34092040317d..1211aed5d2737303b9259d58e21e3bb939a93f33 100644 (file)
@@ -1,3 +1,9 @@
+2006-05-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/make-mode.el (makefile-browser-map)
+       (makefile-mode-syntax-table): Move initialization inside declaration.
+       (makefile-fill-paragraph): Use the default comment-filling code.
+
 2006-05-28  Chong Yidong  <cyd@stupidchicken.com>
 
        * replace.el (query-replace-defaults): New variable.
@@ -44,7 +50,7 @@
        Move tumme commands to Operate, Regexp and Immediate menus.
        Change "Add Comment" to "Add Image Comment".  Change "Add Image
        Tag" to "Add Image Tags".
-       
+
        * tumme.el (tumme-delete-tag): Rename from `tumme-tag-remove'.
        (tumme-setup-dired-keybindings): Change `tumme-add-remove' to
        `tumme-delete-tag'.
index 66507dd78df62d70768f3dfc7edeeb29d285e0b2..d22aedb6058bd7bf18fe9546759895d1d3989614 100644 (file)
@@ -291,6 +291,9 @@ not be enclosed in { } or ( )."
 ;; that if you change this regexp you might have to fix the imenu index in
 ;; makefile-imenu-generic-expression.
 (defconst makefile-macroassign-regex
+  ;; We used to match not just the varname but also the whole value
+  ;; (spanning potentially several lines).
+  ;; "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=[ \t]*\\(\\(?:.+\\\\\n\\)*.+\\)\\|[*:+]?[:?]?=[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)\\)"
   "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)"
   "Regex used to find macro assignment lines in a makefile.")
 
@@ -623,39 +626,38 @@ The function must satisfy this calling convention:
     map)
   "The keymap that is used in Makefile mode.")
 
-(defvar makefile-browser-map nil
+
+(defvar makefile-browser-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "n"    'makefile-browser-next-line)
+    (define-key map "\C-n" 'makefile-browser-next-line)
+    (define-key map "p"    'makefile-browser-previous-line)
+    (define-key map "\C-p" 'makefile-browser-previous-line)
+    (define-key map " "    'makefile-browser-toggle)
+    (define-key map "i"    'makefile-browser-insert-selection)
+    (define-key map "I"    'makefile-browser-insert-selection-and-quit)
+    (define-key map "\C-c\C-m" 'makefile-browser-insert-continuation)
+    (define-key map "q"    'makefile-browser-quit)
+    ;; disable horizontal movement
+    (define-key map "\C-b" 'undefined)
+    (define-key map "\C-f" 'undefined)
+    map)
   "The keymap that is used in the macro- and target browser.")
-(if makefile-browser-map
-    ()
-  (setq makefile-browser-map (make-sparse-keymap))
-  (define-key makefile-browser-map "n"    'makefile-browser-next-line)
-  (define-key makefile-browser-map "\C-n" 'makefile-browser-next-line)
-  (define-key makefile-browser-map "p"    'makefile-browser-previous-line)
-  (define-key makefile-browser-map "\C-p" 'makefile-browser-previous-line)
-  (define-key makefile-browser-map " "    'makefile-browser-toggle)
-  (define-key makefile-browser-map "i"    'makefile-browser-insert-selection)
-  (define-key makefile-browser-map "I"    'makefile-browser-insert-selection-and-quit)
-  (define-key makefile-browser-map "\C-c\C-m" 'makefile-browser-insert-continuation)
-  (define-key makefile-browser-map "q"    'makefile-browser-quit)
-  ;; disable horizontal movement
-  (define-key makefile-browser-map "\C-b" 'undefined)
-  (define-key makefile-browser-map "\C-f" 'undefined))
-
-
-(defvar makefile-mode-syntax-table nil)
-(if makefile-mode-syntax-table
-    ()
-  (setq makefile-mode-syntax-table (make-syntax-table))
-  (modify-syntax-entry ?\( "()    " makefile-mode-syntax-table)
-  (modify-syntax-entry ?\) ")(    " makefile-mode-syntax-table)
-  (modify-syntax-entry ?\[ "(]    " makefile-mode-syntax-table)
-  (modify-syntax-entry ?\] ")[    " makefile-mode-syntax-table)
-  (modify-syntax-entry ?\{ "(}    " makefile-mode-syntax-table)
-  (modify-syntax-entry ?\} "){    " makefile-mode-syntax-table)
-  (modify-syntax-entry ?\' "\"     " makefile-mode-syntax-table)
-  (modify-syntax-entry ?\` "\"     " makefile-mode-syntax-table)
-  (modify-syntax-entry ?#  "<     " makefile-mode-syntax-table)
-  (modify-syntax-entry ?\n ">     " makefile-mode-syntax-table))
+
+
+(defvar makefile-mode-syntax-table
+  (let ((st (make-syntax-table)))
+    (modify-syntax-entry ?\( "()    " st)
+    (modify-syntax-entry ?\) ")(    " st)
+    (modify-syntax-entry ?\[ "(]    " st)
+    (modify-syntax-entry ?\] ")[    " st)
+    (modify-syntax-entry ?\{ "(}    " st)
+    (modify-syntax-entry ?\} "){    " st)
+    (modify-syntax-entry ?\' "\"    " st)
+    (modify-syntax-entry ?\` "\"    " st)
+    (modify-syntax-entry ?#  "<     " st)
+    (modify-syntax-entry ?\n ">     " st)
+    st))
 
 (defvar makefile-imake-mode-syntax-table (copy-syntax-table
                                          makefile-mode-syntax-table))
@@ -1303,29 +1305,8 @@ definition and conveniently use this command."
     (beginning-of-line)
     (cond
      ((looking-at "^#+")
-      ;; Found a comment.  Set the fill prefix, and find the paragraph
-      ;; boundaries by searching for lines that look like comment-only
-      ;; lines.
-      (let ((fill-prefix (match-string-no-properties 0))
-           (fill-paragraph-function nil))
-       (save-excursion
-         (save-restriction
-           (narrow-to-region
-            ;; Search backwards.
-            (save-excursion
-              (while (and (zerop (forward-line -1))
-                          (looking-at "^#")))
-              ;; We may have gone too far.  Go forward again.
-              (or (looking-at "^#")
-                  (forward-line 1))
-              (point))
-            ;; Search forwards.
-            (save-excursion
-              (while (looking-at "^#")
-                (forward-line))
-              (point)))
-           (fill-paragraph nil)
-           t))))
+      ;; Found a comment.  Return nil to let normal filling take place.
+      nil)
 
      ;; Must look for backslashed-region before looking for variable
      ;; assignment.
@@ -1354,7 +1335,9 @@ definition and conveniently use this command."
          (makefile-backslash-region (point-min) (point-max) nil)
          (goto-char (point-max))
          (if (< (skip-chars-backward "\n") 0)
-             (delete-region (point) (point-max))))))
+             (delete-region (point) (point-max)))))
+      ;; Return non-nil to indicate it's been filled.
+      t)
 
      ((looking-at makefile-macroassign-regex)
       ;; Have a macro assign.  Fill just this line, and then backslash
@@ -1363,10 +1346,13 @@ definition and conveniently use this command."
        (narrow-to-region (point) (line-beginning-position 2))
        (let ((fill-paragraph-function nil))
          (fill-paragraph nil))
-       (makefile-backslash-region (point-min) (point-max) nil)))))
+       (makefile-backslash-region (point-min) (point-max) nil))
+      ;; Return non-nil to indicate it's been filled.
+      t)
 
-  ;; Always return non-nil so we don't fill anything else.
-  t)
+     (t
+      ;; Return non-nil so we don't fill anything else.
+      t))))
 
 \f
 
@@ -1882,5 +1868,5 @@ If it isn't in one, return nil."
 
 (provide 'make-mode)
 
-;;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0
+;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0
 ;;; make-mode.el ends here