emacs-diffs
[Top][All Lists]
Advanced

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

scratch/etags-regen 570f132 03/11: etags.c: Implement the -L flag


From: Dmitry Gutov
Subject: scratch/etags-regen 570f132 03/11: etags.c: Implement the -L flag
Date: Sun, 3 Jan 2021 19:06:30 -0500 (EST)

branch: scratch/etags-regen
commit 570f132500bdc65cb8d6f42858e02e800414a2a7
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    etags.c: Implement the -L flag
---
 lib-src/etags.c               |  3 ++-
 lisp/progmodes/etags-regen.el | 12 ++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib-src/etags.c b/lib-src/etags.c
index b5c18e0..d79c6f4 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -1112,7 +1112,7 @@ main (int argc, char **argv)
   /* When the optstring begins with a '-' getopt_long does not rearrange the
      non-options arguments to be at the end, but leaves them alone. */
   optstring = concat ("-ac:Cf:Il:o:Qr:RSVhH",
-                     (CTAGS) ? "BxdtTuvw" : "Di:",
+                     (CTAGS) ? "BxdtTuvw" : "Di:L:",
                      "");
 
   while ((opt = getopt_long (argc, argv, optstring, longopts, NULL)) != EOF)
@@ -1124,6 +1124,7 @@ main (int argc, char **argv)
        break;
 
       case 1:
+      case 'L':
        /* This means that a file name has been seen.  Record it. */
        argbuffer[current_arg].arg_type = at_filename;
        argbuffer[current_arg].what     = optarg;
diff --git a/lisp/progmodes/etags-regen.el b/lisp/progmodes/etags-regen.el
index 837a18e..a1053a8 100644
--- a/lisp/progmodes/etags-regen.el
+++ b/lisp/progmodes/etags-regen.el
@@ -41,10 +41,6 @@
   ;; How do we get the correct etags here?
   ;; E.g. "~/vc/emacs-master/lib-src/etags"
   ;;
-  ;; ctags's etags requires '-L -' for stdin input.
-  ;; It also looks broken here (indexes only some of the input files).
-  ;;
-  ;; If our etags supported '-L', we could use any version of etags.
   )
 
 (defun etags-regen--maybe-generate ()
@@ -84,7 +80,10 @@
             files)
       (shell-command-on-region
        (point-min) (point-max)
-       (format "%s - -o %s" etags-regen-program etags-regen--tags-file)
+       ;; ctags's etags requires '-L -' for stdin input.
+       ;; It looks half-broken here (indexes only some of the input files),
+       ;; but better-maintained versions of it exist (like universal-ctags).
+       (format "%s -L - -o %s" etags-regen-program etags-regen--tags-file)
        nil nil "*etags-project-tags-errors*" t))))
 
 (defun etags-regen--update-file ()
@@ -167,6 +166,7 @@
         (advice-add 'tags-completion-at-point-function :before
                     #'etags-regen--maybe-generate))
     (advice-remove 'etags--xref-backend #'etags-regen--maybe-generate)
-    (advice-remove 'tags-completion-at-point-function 
#'etags-regen--maybe-generate)))
+    (advice-remove 'tags-completion-at-point-function 
#'etags-regen--maybe-generate)
+    (etags-regen--tags-cleanup)))
 
 ;;; etags-regen.el ends here



reply via email to

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