emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog progmodes/make-mode.el


From: Stefan Monnier
Subject: [Emacs-diffs] emacs/lisp ChangeLog progmodes/make-mode.el
Date: Thu, 03 Dec 2009 03:02:38 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        09/12/03 03:02:37

Modified files:
        lisp           : ChangeLog 
        lisp/progmodes : make-mode.el 

Log message:
        (makefile-special-targets-list): No need for it to be an alist any more.
        (makefile-complete): Use completion-in-region.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16804&r2=1.16805
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/progmodes/make-mode.el?cvsroot=emacs&r1=1.131&r2=1.132

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16804
retrieving revision 1.16805
diff -u -b -r1.16804 -r1.16805
--- ChangeLog   3 Dec 2009 02:58:16 -0000       1.16804
+++ ChangeLog   3 Dec 2009 03:02:34 -0000       1.16805
@@ -1,5 +1,9 @@
 2009-12-03  Stefan Monnier  <address@hidden>
 
+       * progmodes/make-mode.el (makefile-special-targets-list): No need for
+       it to be an alist any more.
+       (makefile-complete): Use completion-in-region.
+
        * progmodes/octave-mod.el (octave-complete-symbol):
        Use completion-in-region.
 

Index: progmodes/make-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/make-mode.el,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -b -r1.131 -r1.132
--- progmodes/make-mode.el      1 Sep 2009 07:24:21 -0000       1.131
+++ progmodes/make-mode.el      3 Dec 2009 03:02:37 -0000       1.132
@@ -231,15 +231,15 @@
 ;; Special targets for DMake, Sun's make ...
 ;;
 (defcustom makefile-special-targets-list
-  '(("DEFAULT")      ("DONE")        ("ERROR")        ("EXPORT")
-    ("FAILED")       ("GROUPEPILOG") ("GROUPPROLOG")  ("IGNORE")
-    ("IMPORT")       ("INCLUDE")     ("INCLUDEDIRS")  ("INIT")
-    ("KEEP_STATE")   ("MAKEFILES")   ("MAKE_VERSION") ("NO_PARALLEL")
-    ("PARALLEL")     ("PHONY")       ("PRECIOUS")     ("REMOVE")
-    ("SCCS_GET")     ("SILENT")      ("SOURCE")       ("SUFFIXES")
-    ("WAIT")         ("c.o")         ("C.o")          ("m.o")
-    ("el.elc")       ("y.c")         ("s.o"))
-  "*List of special targets.
+  '("DEFAULT"      "DONE"        "ERROR"        "EXPORT"
+    "FAILED"       "GROUPEPILOG" "GROUPPROLOG"  "IGNORE"
+    "IMPORT"       "INCLUDE"     "INCLUDEDIRS"  "INIT"
+    "KEEP_STATE"   "MAKEFILES"   "MAKE_VERSION" "NO_PARALLEL"
+    "PARALLEL"     "PHONY"       "PRECIOUS"     "REMOVE"
+    "SCCS_GET"     "SILENT"      "SOURCE"       "SUFFIXES"
+    "WAIT"         "c.o"         "C.o"          "m.o"
+    "el.elc"       "y.c"         "s.o")
+  "List of special targets.
 You will be offered to complete on one of those in the minibuffer whenever
 you enter a \".\" at the beginning of a line in `makefile-mode'."
   :type '(repeat (list string))
@@ -1185,87 +1185,34 @@
                (skip-chars-backward "^$(){}:#= \t\n")
                (point)))
         (try (buffer-substring beg (point)))
-        (do-macros nil)
-        (paren nil))
-
+        (paren nil)
+        (do-macros
     (save-excursion
       (goto-char beg)
       (let ((pc (preceding-char)))
        (cond
-        ;; Beginning of line means anything.
-        ((bolp)
-         ())
-
         ;; Preceding "$" means macros only.
         ((= pc ?$)
-         (setq do-macros t))
+                t)
 
         ;; Preceding "$(" or "${" means macros only.
-        ((and (or (= pc ?{)
-                  (= pc ?\())
+               ((and (memq pc '(?\{ ?\())
               (progn
-                (setq paren pc)
+                       (setq paren (if (eq paren ?\{) ?\} ?\)))
                 (backward-char)
-                (and (not (bolp))
-                     (= (preceding-char) ?$))))
-         (setq do-macros t)))))
+                       (= (preceding-char) ?$)))
+                t)))))
 
-    ;; Try completion.
-    (let* ((table (append (if do-macros
+         (table (apply-partially 'completion-table-with-terminator
+                                   (cond
+                                    (do-macros (or paren ""))
+                                    ((save-excursion (goto-char beg) (bolp)) 
":")
+                                    (t " "))
+                                   (append (if do-macros
                              '()
                            makefile-target-table)
-                         makefile-macro-table))
-          (completion (try-completion try table)))
-      (cond
-       ;; Exact match, so insert closing paren or colon.
-       ((eq completion t)
-       (insert (if do-macros
-                   (if (eq paren ?{)
-                       ?}
-                     ?\))
-                 (if (save-excursion
-                       (goto-char beg)
-                       (bolp))
-                     ":"
-                   " "))))
-
-       ;; No match.
-       ((null completion)
-       (message "Can't find completion for \"%s\"" try)
-       (ding))
-
-       ;; Partial completion.
-       ((not (string= try completion))
-       ;; FIXME it would be nice to supply the closing paren if an
-       ;; exact, unambiguous match were found.  That is not possible
-       ;; right now.  Ditto closing ":" for targets.
-       (delete-region beg (point))
-
-       ;; DO-MACROS means doing macros only.  If not that, then check
-       ;; to see if this completion is a macro.  Special insertion
-       ;; must be done for macros.
-       (if (or do-macros
-               (assoc completion makefile-macro-table))
-           (let ((makefile-use-curly-braces-for-macros-p
-                  (or (eq paren ?{)
-                      makefile-use-curly-braces-for-macros-p)))
-             (delete-backward-char 2)
-             (makefile-do-macro-insertion completion)
-             (delete-backward-char 1))
-
-         ;; Just insert targets.
-         (insert completion)))
-
-       ;; Can't complete any more, so make completion list.  FIXME
-       ;; this doesn't do the right thing when the completion is
-       ;; actually inserted.  I don't think there is an easy way to do
-       ;; that.
-       (t
-       (message "Making completion list...")
-       (let ((list (all-completions try table)))
-         (with-output-to-temp-buffer "*Completions*"
-           (display-completion-list list try)))
-       (message "Making completion list...done"))))))
+                                           makefile-macro-table))))
+    (completion-in-region beg (point) table)))
 
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]