Mercurial > emacs
changeset 71030:6e1192ac395f
(makefile-browser-map, makefile-mode-syntax-table): Move init inside decl.
(makefile-fill-paragraph): Use the default comment-filling code.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sun, 28 May 2006 20:56:34 +0000 |
parents | 0182f7d67a2c |
children | 80e86267b70b |
files | lisp/ChangeLog lisp/progmodes/make-mode.el |
diffstat | 2 files changed, 51 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sun May 28 20:19:17 2006 +0000 +++ b/lisp/ChangeLog Sun May 28 20:56:34 2006 +0000 @@ -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'.
--- a/lisp/progmodes/make-mode.el Sun May 28 20:19:17 2006 +0000 +++ b/lisp/progmodes/make-mode.el Sun May 28 20:56:34 2006 +0000 @@ -291,6 +291,9 @@ ;; 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 @@ 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 @@ (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 @@ (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 @@ (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)))) @@ -1882,5 +1868,5 @@ (provide 'make-mode) -;;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0 +;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0 ;;; make-mode.el ends here