diff options
| author | Daniel Pfeiffer | 2005-05-19 02:20:34 +0000 |
|---|---|---|
| committer | Daniel Pfeiffer | 2005-05-19 02:20:34 +0000 |
| commit | dfa89b5db85f8612b2b6bb44d95d696c80d2089b (patch) | |
| tree | 3b789e231eb6aae8d8b470aab434dd8cce9fea4f | |
| parent | ae0c69273e4d8887db9bb5e7de0d5c6f6ce48d4c (diff) | |
| download | emacs-dfa89b5db85f8612b2b6bb44d95d696c80d2089b.tar.gz emacs-dfa89b5db85f8612b2b6bb44d95d696c80d2089b.zip | |
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
(makefile-add-this-line-macro): Simplify and integrate into `makefile-pickup-macros.
(makefile-pickup-filenames-as-targets): Simplify.
(makefile-previous-dependency, makefile-match-dependency): Don't stumble over `::'.
| -rw-r--r-- | lisp/ChangeLog | 15 | ||||
| -rw-r--r-- | lisp/progmodes/make-mode.el | 105 |
2 files changed, 55 insertions, 65 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7b97acbe33b..67baf0be47f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,6 +1,19 @@ | |||
| 1 | 2005-05-19 Daniel Pfeiffer <occitan@esperanto.org> | ||
| 2 | |||
| 3 | * font-lock.el (lisp-font-lock-keywords-2): Do \\) only in | ||
| 4 | strings, because (eq ... ?\\) is fairly frequent. | ||
| 5 | |||
| 6 | * progmodes/make-mode.el (makefile-add-this-line-targets): | ||
| 7 | Simplify and integrate into `makefile-pickup-targets'. | ||
| 8 | (makefile-add-this-line-macro): Simplify and integrate into | ||
| 9 | `makefile-pickup-macros. | ||
| 10 | (makefile-pickup-filenames-as-targets): Simplify. | ||
| 11 | (makefile-previous-dependency, makefile-match-dependency): Don't | ||
| 12 | stumble over `::'. | ||
| 13 | |||
| 1 | 2005-05-19 Nick Roberts <nickrob@snap.net.nz> | 14 | 2005-05-19 Nick Roberts <nickrob@snap.net.nz> |
| 2 | 15 | ||
| 3 | * subr.el (post-command-idle-hook, post-command-idle-delay): | 16 | * subr.el (post-command-idle-hook, post-command-idle-delay): |
| 4 | Remove obsoletion of post-command-idle-hook and | 17 | Remove obsoletion of post-command-idle-hook and |
| 5 | post-command-idle-delay. | 18 | post-command-idle-delay. |
| 6 | 19 | ||
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index 886f47802db..b4ed05957db 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el | |||
| @@ -891,8 +891,8 @@ Makefile mode can be configured by modifying the following variables: | |||
| 891 | (beginning-of-line) | 891 | (beginning-of-line) |
| 892 | ;; makefile-match-dependency done backwards: | 892 | ;; makefile-match-dependency done backwards: |
| 893 | (catch 'found | 893 | (catch 'found |
| 894 | (while (and (< (skip-chars-backward makefile-dependency-skip) 0) | 894 | (while (progn (skip-chars-backward makefile-dependency-skip) |
| 895 | (not (bobp))) | 895 | (not (bobp))) |
| 896 | (or (prog1 (eq (char-after) ?=) | 896 | (or (prog1 (eq (char-after) ?=) |
| 897 | (backward-char)) | 897 | (backward-char)) |
| 898 | (get-text-property (point) 'face) | 898 | (get-text-property (point) 'face) |
| @@ -998,74 +998,56 @@ Anywhere else just self-inserts." | |||
| 998 | (defun makefile-pickup-targets () | 998 | (defun makefile-pickup-targets () |
| 999 | "Notice names of all target definitions in Makefile." | 999 | "Notice names of all target definitions in Makefile." |
| 1000 | (interactive) | 1000 | (interactive) |
| 1001 | (if (not makefile-need-target-pickup) | 1001 | (when makefile-need-target-pickup |
| 1002 | nil | 1002 | (setq makefile-need-target-pickup nil |
| 1003 | (setq makefile-need-target-pickup nil) | 1003 | makefile-target-table nil |
| 1004 | (setq makefile-target-table nil) | 1004 | makefile-has-prereqs nil) |
| 1005 | (setq makefile-has-prereqs nil) | ||
| 1006 | (save-excursion | 1005 | (save-excursion |
| 1007 | (goto-char (point-min)) | 1006 | (goto-char (point-min)) |
| 1008 | (while (makefile-match-dependency nil) | 1007 | (while (makefile-match-dependency nil) |
| 1009 | (makefile-add-this-line-targets))) | 1008 | (goto-char (match-beginning 1)) |
| 1010 | (message "Read targets OK."))) | 1009 | (while (let ((target-name |
| 1011 | 1010 | (buffer-substring-no-properties (point) | |
| 1012 | (defun makefile-add-this-line-targets () | 1011 | (progn |
| 1013 | (save-excursion | 1012 | (skip-chars-forward "^ \t:#") |
| 1014 | (beginning-of-line) | 1013 | (point)))) |
| 1015 | (let ((done-with-line nil) | ||
| 1016 | (line-number (1+ (count-lines (point-min) (point))))) | ||
| 1017 | (while (not done-with-line) | ||
| 1018 | (skip-chars-forward " \t") | ||
| 1019 | (if (not (setq done-with-line (or (eolp) | ||
| 1020 | (char-equal (char-after (point)) ?:)))) | ||
| 1021 | (progn | ||
| 1022 | (let* ((start-of-target-name (point)) | ||
| 1023 | (target-name | ||
| 1024 | (progn | ||
| 1025 | (skip-chars-forward "^ \t:#") | ||
| 1026 | (buffer-substring start-of-target-name (point)))) | ||
| 1027 | (has-prereqs | 1014 | (has-prereqs |
| 1028 | (not (looking-at ":[ \t]*$")))) | 1015 | (not (looking-at ":[ \t]*$")))) |
| 1029 | (if (makefile-remember-target target-name has-prereqs) | 1016 | (if (makefile-remember-target target-name has-prereqs) |
| 1030 | (message "Picked up target \"%s\" from line %d" | 1017 | (message "Picked up target \"%s\" from line %d" |
| 1031 | target-name line-number))))))))) | 1018 | target-name (line-number-at-pos))) |
| 1019 | (skip-chars-forward " \t") | ||
| 1020 | (not (or (eolp) (eq (char-after) ?:))))) | ||
| 1021 | (forward-line))) | ||
| 1022 | (message "Read targets OK."))) | ||
| 1032 | 1023 | ||
| 1033 | (defun makefile-pickup-macros () | 1024 | (defun makefile-pickup-macros () |
| 1034 | "Notice names of all macro definitions in Makefile." | 1025 | "Notice names of all macro definitions in Makefile." |
| 1035 | (interactive) | 1026 | (interactive) |
| 1036 | (if (not makefile-need-macro-pickup) | 1027 | (when makefile-need-macro-pickup |
| 1037 | nil | 1028 | (setq makefile-need-macro-pickup nil |
| 1038 | (setq makefile-need-macro-pickup nil) | 1029 | makefile-macro-table nil) |
| 1039 | (setq makefile-macro-table nil) | ||
| 1040 | (save-excursion | 1030 | (save-excursion |
| 1041 | (goto-char (point-min)) | 1031 | (goto-char (point-min)) |
| 1042 | (while (re-search-forward makefile-macroassign-regex nil t) | 1032 | (while (re-search-forward makefile-macroassign-regex nil t) |
| 1043 | (makefile-add-this-line-macro) | 1033 | (goto-char (match-beginning 1)) |
| 1044 | (forward-line 1))) | 1034 | (let ((macro-name (buffer-substring-no-properties (point) |
| 1035 | (progn | ||
| 1036 | (skip-chars-forward "^ \t:#=*") | ||
| 1037 | (point))))) | ||
| 1038 | (if (makefile-remember-macro macro-name) | ||
| 1039 | (message "Picked up macro \"%s\" from line %d" | ||
| 1040 | macro-name (line-number-at-pos)))) | ||
| 1041 | (forward-line))) | ||
| 1045 | (message "Read macros OK."))) | 1042 | (message "Read macros OK."))) |
| 1046 | 1043 | ||
| 1047 | (defun makefile-add-this-line-macro () | ||
| 1048 | (save-excursion | ||
| 1049 | (beginning-of-line) | ||
| 1050 | (skip-chars-forward " \t") | ||
| 1051 | (unless (eolp) | ||
| 1052 | (let* ((start-of-macro-name (point)) | ||
| 1053 | (line-number (1+ (count-lines (point-min) (point)))) | ||
| 1054 | (macro-name (progn | ||
| 1055 | (skip-chars-forward "^ \t:#=*") | ||
| 1056 | (buffer-substring start-of-macro-name (point))))) | ||
| 1057 | (if (makefile-remember-macro macro-name) | ||
| 1058 | (message "Picked up macro \"%s\" from line %d" | ||
| 1059 | macro-name line-number)))))) | ||
| 1060 | |||
| 1061 | (defun makefile-pickup-everything (arg) | 1044 | (defun makefile-pickup-everything (arg) |
| 1062 | "Notice names of all macros and targets in Makefile. | 1045 | "Notice names of all macros and targets in Makefile. |
| 1063 | Prefix arg means force pickups to be redone." | 1046 | Prefix arg means force pickups to be redone." |
| 1064 | (interactive "P") | 1047 | (interactive "P") |
| 1065 | (if arg | 1048 | (if arg |
| 1066 | (progn | 1049 | (setq makefile-need-target-pickup t |
| 1067 | (setq makefile-need-target-pickup t) | 1050 | makefile-need-macro-pickup t)) |
| 1068 | (setq makefile-need-macro-pickup t))) | ||
| 1069 | (makefile-pickup-macros) | 1051 | (makefile-pickup-macros) |
| 1070 | (makefile-pickup-targets) | 1052 | (makefile-pickup-targets) |
| 1071 | (if makefile-pickup-everything-picks-up-filenames-p | 1053 | (if makefile-pickup-everything-picks-up-filenames-p |
| @@ -1076,17 +1058,12 @@ Prefix arg means force pickups to be redone." | |||
| 1076 | Checks each filename against `makefile-ignored-files-in-pickup-regex' | 1058 | Checks each filename against `makefile-ignored-files-in-pickup-regex' |
| 1077 | and adds all qualifying names to the list of known targets." | 1059 | and adds all qualifying names to the list of known targets." |
| 1078 | (interactive) | 1060 | (interactive) |
| 1079 | (let* ((dir (file-name-directory (buffer-file-name))) | 1061 | (mapc (lambda (name) |
| 1080 | (raw-filename-list (if dir | 1062 | (or (file-directory-p name) |
| 1081 | (file-name-all-completions "" dir) | 1063 | (string-match makefile-ignored-files-in-pickup-regex name) |
| 1082 | (file-name-all-completions "" "")))) | 1064 | (if (makefile-remember-target name) |
| 1083 | (mapcar (lambda (name) | 1065 | (message "Picked up file \"%s\" as target" name)))) |
| 1084 | (if (and (not (file-directory-p name)) | 1066 | (file-name-all-completions "" (or (file-name-directory (buffer-file-name)) "")))) |
| 1085 | (not (string-match makefile-ignored-files-in-pickup-regex | ||
| 1086 | name))) | ||
| 1087 | (if (makefile-remember-target name) | ||
| 1088 | (message "Picked up file \"%s\" as target" name)))) | ||
| 1089 | raw-filename-list))) | ||
| 1090 | 1067 | ||
| 1091 | 1068 | ||
| 1092 | 1069 | ||
| @@ -1704,8 +1681,8 @@ Checks that the colon has not already been fontified, else we | |||
| 1704 | matched in a rule action." | 1681 | matched in a rule action." |
| 1705 | (catch 'found | 1682 | (catch 'found |
| 1706 | (let ((pt (point))) | 1683 | (let ((pt (point))) |
| 1707 | (while (and (> (skip-chars-forward makefile-dependency-skip bound) 0) | 1684 | (while (progn (skip-chars-forward makefile-dependency-skip bound) |
| 1708 | (not (eobp))) | 1685 | (not (eobp))) |
| 1709 | (forward-char) | 1686 | (forward-char) |
| 1710 | (or (eq (char-after) ?=) | 1687 | (or (eq (char-after) ?=) |
| 1711 | (get-text-property (1- (point)) 'face) | 1688 | (get-text-property (1- (point)) 'face) |