]> git.eshelyaron.com Git - emacs.git/commitdiff
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
authorDaniel Pfeiffer <occitan@esperanto.org>
Thu, 19 May 2005 02:20:34 +0000 (02:20 +0000)
committerDaniel Pfeiffer <occitan@esperanto.org>
Thu, 19 May 2005 02:20:34 +0000 (02:20 +0000)
(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 `::'.

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

index 7b97acbe33b46d468afd99c16da49e7c045088f0..67baf0be47f6f4479d20a7eba06dd4516a460b00 100644 (file)
@@ -1,6 +1,19 @@
+2005-05-19  Daniel Pfeiffer  <occitan@esperanto.org>
+
+       * font-lock.el (lisp-font-lock-keywords-2): Do \\) only in
+       strings, because (eq ... ?\\) is fairly frequent.
+
+       * progmodes/make-mode.el (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 `::'.
+
 2005-05-19  Nick Roberts  <nickrob@snap.net.nz>
 
-       * subr.el (post-command-idle-hook, post-command-idle-delay): 
+       * subr.el (post-command-idle-hook, post-command-idle-delay):
        Remove obsoletion of post-command-idle-hook and
        post-command-idle-delay.
 
index 886f47802db66651f730230543e7dd738044a074..b4ed05957db2dd9d4f833c8519def7aa43a86141 100644 (file)
@@ -891,8 +891,8 @@ Makefile mode can be configured by modifying the following variables:
     (beginning-of-line)
     ;; makefile-match-dependency done backwards:
     (catch 'found
-      (while (and (< (skip-chars-backward makefile-dependency-skip) 0)
-                 (not (bobp)))
+      (while (progn (skip-chars-backward makefile-dependency-skip)
+                   (not (bobp)))
        (or (prog1 (eq (char-after) ?=)
              (backward-char))
            (get-text-property (point) 'face)
@@ -998,74 +998,56 @@ Anywhere else just self-inserts."
 (defun makefile-pickup-targets ()
   "Notice names of all target definitions in Makefile."
   (interactive)
-  (if (not makefile-need-target-pickup)
-      nil
-    (setq makefile-need-target-pickup nil)
-    (setq makefile-target-table nil)
-    (setq makefile-has-prereqs nil)
+  (when makefile-need-target-pickup
+    (setq makefile-need-target-pickup nil
+         makefile-target-table nil
+         makefile-has-prereqs nil)
     (save-excursion
       (goto-char (point-min))
       (while (makefile-match-dependency nil)
-       (makefile-add-this-line-targets)))
-    (message "Read targets OK.")))
-
-(defun makefile-add-this-line-targets ()
-  (save-excursion
-    (beginning-of-line)
-    (let ((done-with-line nil)
-         (line-number (1+ (count-lines (point-min) (point)))))
-      (while (not done-with-line)
-       (skip-chars-forward " \t")
-       (if (not (setq done-with-line (or (eolp)
-                                         (char-equal (char-after (point)) ?:))))
-           (progn
-             (let* ((start-of-target-name (point))
-                    (target-name
-                     (progn
-                       (skip-chars-forward "^ \t:#")
-                       (buffer-substring start-of-target-name (point))))
+       (goto-char (match-beginning 1))
+       (while (let ((target-name
+                     (buffer-substring-no-properties (point)
+                                                     (progn
+                                                       (skip-chars-forward "^ \t:#")
+                                                       (point))))
                     (has-prereqs
                      (not (looking-at ":[ \t]*$"))))
-               (if (makefile-remember-target target-name has-prereqs)
-                   (message "Picked up target \"%s\" from line %d"
-                            target-name line-number)))))))))
+                (if (makefile-remember-target target-name has-prereqs)
+                    (message "Picked up target \"%s\" from line %d"
+                             target-name (line-number-at-pos)))
+                (skip-chars-forward " \t")
+                (not (or (eolp) (eq (char-after) ?:)))))
+       (forward-line)))
+    (message "Read targets OK.")))
 
 (defun makefile-pickup-macros ()
   "Notice names of all macro definitions in Makefile."
   (interactive)
-  (if (not makefile-need-macro-pickup)
-      nil
-    (setq makefile-need-macro-pickup nil)
-    (setq makefile-macro-table nil)
+  (when makefile-need-macro-pickup
+    (setq makefile-need-macro-pickup nil
+         makefile-macro-table nil)
     (save-excursion
       (goto-char (point-min))
       (while (re-search-forward makefile-macroassign-regex nil t)
-       (makefile-add-this-line-macro)
-       (forward-line 1)))
+       (goto-char (match-beginning 1))
+       (let ((macro-name (buffer-substring-no-properties (point)
+                                                         (progn
+                                                           (skip-chars-forward "^ \t:#=*")
+                                                           (point)))))
+         (if (makefile-remember-macro macro-name)
+             (message "Picked up macro \"%s\" from line %d"
+                      macro-name (line-number-at-pos))))
+       (forward-line)))
     (message "Read macros OK.")))
 
-(defun makefile-add-this-line-macro ()
-  (save-excursion
-    (beginning-of-line)
-    (skip-chars-forward " \t")
-    (unless (eolp)
-      (let* ((start-of-macro-name (point))
-            (line-number (1+ (count-lines (point-min) (point))))
-            (macro-name (progn
-                          (skip-chars-forward "^ \t:#=*")
-                          (buffer-substring start-of-macro-name (point)))))
-       (if (makefile-remember-macro macro-name)
-           (message "Picked up macro \"%s\" from line %d"
-                    macro-name line-number))))))
-
 (defun makefile-pickup-everything (arg)
   "Notice names of all macros and targets in Makefile.
 Prefix arg means force pickups to be redone."
   (interactive "P")
   (if arg
-      (progn
-       (setq makefile-need-target-pickup t)
-       (setq makefile-need-macro-pickup t)))
+      (setq makefile-need-target-pickup t
+           makefile-need-macro-pickup t))
   (makefile-pickup-macros)
   (makefile-pickup-targets)
   (if makefile-pickup-everything-picks-up-filenames-p
@@ -1076,17 +1058,12 @@ Prefix arg means force pickups to be redone."
 Checks each filename against `makefile-ignored-files-in-pickup-regex'
 and adds all qualifying names to the list of known targets."
   (interactive)
-  (let* ((dir (file-name-directory (buffer-file-name)))
-        (raw-filename-list (if dir
-                               (file-name-all-completions "" dir)
-                             (file-name-all-completions "" ""))))
-    (mapcar (lambda (name)
-              (if (and (not (file-directory-p name))
-                       (not (string-match makefile-ignored-files-in-pickup-regex
-                                          name)))
-                  (if (makefile-remember-target name)
-                      (message "Picked up file \"%s\" as target" name))))
-           raw-filename-list)))
+  (mapc (lambda (name)
+         (or (file-directory-p name)
+             (string-match makefile-ignored-files-in-pickup-regex name)
+             (if (makefile-remember-target name)
+                 (message "Picked up file \"%s\" as target" name))))
+       (file-name-all-completions "" (or (file-name-directory (buffer-file-name)) ""))))
 
 \f
 
@@ -1704,8 +1681,8 @@ Checks that the colon has not already been fontified, else we
 matched in a rule action."
   (catch 'found
     (let ((pt (point)))
-      (while (and (> (skip-chars-forward makefile-dependency-skip bound) 0)
-                 (not (eobp)))
+      (while (progn (skip-chars-forward makefile-dependency-skip bound)
+                   (not (eobp)))
        (forward-char)
        (or (eq (char-after) ?=)
            (get-text-property (1- (point)) 'face)