aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2006-05-28 20:56:34 +0000
committerStefan Monnier2006-05-28 20:56:34 +0000
commitc5301b5c3691708104c8bc257ca1893702cd6f0d (patch)
treeb2b592ea70f536fcee51b225d1ef5a4894da60f9
parentc558b5be6c45379c48009b595b1792dff901b26d (diff)
downloademacs-c5301b5c3691708104c8bc257ca1893702cd6f0d.tar.gz
emacs-c5301b5c3691708104c8bc257ca1893702cd6f0d.zip
(makefile-browser-map, makefile-mode-syntax-table): Move init inside decl.
(makefile-fill-paragraph): Use the default comment-filling code.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/progmodes/make-mode.el106
2 files changed, 53 insertions, 61 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fe49db5163f..1211aed5d27 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12006-05-28 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * progmodes/make-mode.el (makefile-browser-map)
4 (makefile-mode-syntax-table): Move initialization inside declaration.
5 (makefile-fill-paragraph): Use the default comment-filling code.
6
12006-05-28 Chong Yidong <cyd@stupidchicken.com> 72006-05-28 Chong Yidong <cyd@stupidchicken.com>
2 8
3 * replace.el (query-replace-defaults): New variable. 9 * replace.el (query-replace-defaults): New variable.
@@ -44,7 +50,7 @@
44 Move tumme commands to Operate, Regexp and Immediate menus. 50 Move tumme commands to Operate, Regexp and Immediate menus.
45 Change "Add Comment" to "Add Image Comment". Change "Add Image 51 Change "Add Comment" to "Add Image Comment". Change "Add Image
46 Tag" to "Add Image Tags". 52 Tag" to "Add Image Tags".
47 53
48 * tumme.el (tumme-delete-tag): Rename from `tumme-tag-remove'. 54 * tumme.el (tumme-delete-tag): Rename from `tumme-tag-remove'.
49 (tumme-setup-dired-keybindings): Change `tumme-add-remove' to 55 (tumme-setup-dired-keybindings): Change `tumme-add-remove' to
50 `tumme-delete-tag'. 56 `tumme-delete-tag'.
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index 66507dd78df..d22aedb6058 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -291,6 +291,9 @@ not be enclosed in { } or ( )."
291;; that if you change this regexp you might have to fix the imenu index in 291;; that if you change this regexp you might have to fix the imenu index in
292;; makefile-imenu-generic-expression. 292;; makefile-imenu-generic-expression.
293(defconst makefile-macroassign-regex 293(defconst makefile-macroassign-regex
294 ;; We used to match not just the varname but also the whole value
295 ;; (spanning potentially several lines).
296 ;; "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=[ \t]*\\(\\(?:.+\\\\\n\\)*.+\\)\\|[*:+]?[:?]?=[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)\\)"
294 "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)" 297 "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)"
295 "Regex used to find macro assignment lines in a makefile.") 298 "Regex used to find macro assignment lines in a makefile.")
296 299
@@ -623,39 +626,38 @@ The function must satisfy this calling convention:
623 map) 626 map)
624 "The keymap that is used in Makefile mode.") 627 "The keymap that is used in Makefile mode.")
625 628
626(defvar makefile-browser-map nil 629
630(defvar makefile-browser-map
631 (let ((map (make-sparse-keymap)))
632 (define-key map "n" 'makefile-browser-next-line)
633 (define-key map "\C-n" 'makefile-browser-next-line)
634 (define-key map "p" 'makefile-browser-previous-line)
635 (define-key map "\C-p" 'makefile-browser-previous-line)
636 (define-key map " " 'makefile-browser-toggle)
637 (define-key map "i" 'makefile-browser-insert-selection)
638 (define-key map "I" 'makefile-browser-insert-selection-and-quit)
639 (define-key map "\C-c\C-m" 'makefile-browser-insert-continuation)
640 (define-key map "q" 'makefile-browser-quit)
641 ;; disable horizontal movement
642 (define-key map "\C-b" 'undefined)
643 (define-key map "\C-f" 'undefined)
644 map)
627 "The keymap that is used in the macro- and target browser.") 645 "The keymap that is used in the macro- and target browser.")
628(if makefile-browser-map 646
629 () 647
630 (setq makefile-browser-map (make-sparse-keymap)) 648(defvar makefile-mode-syntax-table
631 (define-key makefile-browser-map "n" 'makefile-browser-next-line) 649 (let ((st (make-syntax-table)))
632 (define-key makefile-browser-map "\C-n" 'makefile-browser-next-line) 650 (modify-syntax-entry ?\( "() " st)
633 (define-key makefile-browser-map "p" 'makefile-browser-previous-line) 651 (modify-syntax-entry ?\) ")( " st)
634 (define-key makefile-browser-map "\C-p" 'makefile-browser-previous-line) 652 (modify-syntax-entry ?\[ "(] " st)
635 (define-key makefile-browser-map " " 'makefile-browser-toggle) 653 (modify-syntax-entry ?\] ")[ " st)
636 (define-key makefile-browser-map "i" 'makefile-browser-insert-selection) 654 (modify-syntax-entry ?\{ "(} " st)
637 (define-key makefile-browser-map "I" 'makefile-browser-insert-selection-and-quit) 655 (modify-syntax-entry ?\} "){ " st)
638 (define-key makefile-browser-map "\C-c\C-m" 'makefile-browser-insert-continuation) 656 (modify-syntax-entry ?\' "\" " st)
639 (define-key makefile-browser-map "q" 'makefile-browser-quit) 657 (modify-syntax-entry ?\` "\" " st)
640 ;; disable horizontal movement 658 (modify-syntax-entry ?# "< " st)
641 (define-key makefile-browser-map "\C-b" 'undefined) 659 (modify-syntax-entry ?\n "> " st)
642 (define-key makefile-browser-map "\C-f" 'undefined)) 660 st))
643
644
645(defvar makefile-mode-syntax-table nil)
646(if makefile-mode-syntax-table
647 ()
648 (setq makefile-mode-syntax-table (make-syntax-table))
649 (modify-syntax-entry ?\( "() " makefile-mode-syntax-table)
650 (modify-syntax-entry ?\) ")( " makefile-mode-syntax-table)
651 (modify-syntax-entry ?\[ "(] " makefile-mode-syntax-table)
652 (modify-syntax-entry ?\] ")[ " makefile-mode-syntax-table)
653 (modify-syntax-entry ?\{ "(} " makefile-mode-syntax-table)
654 (modify-syntax-entry ?\} "){ " makefile-mode-syntax-table)
655 (modify-syntax-entry ?\' "\" " makefile-mode-syntax-table)
656 (modify-syntax-entry ?\` "\" " makefile-mode-syntax-table)
657 (modify-syntax-entry ?# "< " makefile-mode-syntax-table)
658 (modify-syntax-entry ?\n "> " makefile-mode-syntax-table))
659 661
660(defvar makefile-imake-mode-syntax-table (copy-syntax-table 662(defvar makefile-imake-mode-syntax-table (copy-syntax-table
661 makefile-mode-syntax-table)) 663 makefile-mode-syntax-table))
@@ -1303,29 +1305,8 @@ definition and conveniently use this command."
1303 (beginning-of-line) 1305 (beginning-of-line)
1304 (cond 1306 (cond
1305 ((looking-at "^#+") 1307 ((looking-at "^#+")
1306 ;; Found a comment. Set the fill prefix, and find the paragraph 1308 ;; Found a comment. Return nil to let normal filling take place.
1307 ;; boundaries by searching for lines that look like comment-only 1309 nil)
1308 ;; lines.
1309 (let ((fill-prefix (match-string-no-properties 0))
1310 (fill-paragraph-function nil))
1311 (save-excursion
1312 (save-restriction
1313 (narrow-to-region
1314 ;; Search backwards.
1315 (save-excursion
1316 (while (and (zerop (forward-line -1))
1317 (looking-at "^#")))
1318 ;; We may have gone too far. Go forward again.
1319 (or (looking-at "^#")
1320 (forward-line 1))
1321 (point))
1322 ;; Search forwards.
1323 (save-excursion
1324 (while (looking-at "^#")
1325 (forward-line))
1326 (point)))
1327 (fill-paragraph nil)
1328 t))))
1329 1310
1330 ;; Must look for backslashed-region before looking for variable 1311 ;; Must look for backslashed-region before looking for variable
1331 ;; assignment. 1312 ;; assignment.
@@ -1354,7 +1335,9 @@ definition and conveniently use this command."
1354 (makefile-backslash-region (point-min) (point-max) nil) 1335 (makefile-backslash-region (point-min) (point-max) nil)
1355 (goto-char (point-max)) 1336 (goto-char (point-max))
1356 (if (< (skip-chars-backward "\n") 0) 1337 (if (< (skip-chars-backward "\n") 0)
1357 (delete-region (point) (point-max)))))) 1338 (delete-region (point) (point-max)))))
1339 ;; Return non-nil to indicate it's been filled.
1340 t)
1358 1341
1359 ((looking-at makefile-macroassign-regex) 1342 ((looking-at makefile-macroassign-regex)
1360 ;; Have a macro assign. Fill just this line, and then backslash 1343 ;; Have a macro assign. Fill just this line, and then backslash
@@ -1363,10 +1346,13 @@ definition and conveniently use this command."
1363 (narrow-to-region (point) (line-beginning-position 2)) 1346 (narrow-to-region (point) (line-beginning-position 2))
1364 (let ((fill-paragraph-function nil)) 1347 (let ((fill-paragraph-function nil))
1365 (fill-paragraph nil)) 1348 (fill-paragraph nil))
1366 (makefile-backslash-region (point-min) (point-max) nil))))) 1349 (makefile-backslash-region (point-min) (point-max) nil))
1350 ;; Return non-nil to indicate it's been filled.
1351 t)
1367 1352
1368 ;; Always return non-nil so we don't fill anything else. 1353 (t
1369 t) 1354 ;; Return non-nil so we don't fill anything else.
1355 t))))
1370 1356
1371 1357
1372 1358
@@ -1882,5 +1868,5 @@ If it isn't in one, return nil."
1882 1868
1883(provide 'make-mode) 1869(provide 'make-mode)
1884 1870
1885;;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0 1871;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0
1886;;; make-mode.el ends here 1872;;; make-mode.el ends here