emacs-diffs
[Top][All Lists]
Advanced

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

scratch/etags-regen d6285de 05/11: New defcustom: etags-regen-program-op


From: Dmitry Gutov
Subject: scratch/etags-regen d6285de 05/11: New defcustom: etags-regen-program-options
Date: Sun, 3 Jan 2021 19:06:31 -0500 (EST)

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

    New defcustom: etags-regen-program-options
---
 .dir-locals.el                |  9 ++++++++-
 lisp/progmodes/etags-regen.el | 24 ++++++++++++++++--------
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index b313945..785f6c3 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -4,7 +4,14 @@
 ((nil . ((tab-width . 8)
          (sentence-end-double-space . t)
          (fill-column . 70)
-         (bug-reference-url-format . "https://debbugs.gnu.org/%s";)))
+         (bug-reference-url-format . "https://debbugs.gnu.org/%s";)
+         (etags-regen-program-options
+          .
+          ("--regex='{c}/[     ]*DEFVAR_[A-Z_  (]+\"\\([^\"]+\\)\"/\\1/'"
+           "--regex='{c}/[     ]*DEFVAR_[A-Z_  (]+\"[^\"]+\",[         
]\\([A-Za-z0-9_]+\\)/\\1/'"
+           "--regex='{objc}/[  ]*DEFVAR_[A-Z_  (]+\"\\([^\"]+\\)\"/\\1/'"
+           "--regex='{objc}/[  ]*DEFVAR_[A-Z_  (]+\"[^\"]+\",[         
]\\([A-Za-z0-9_]+\\)/\\1/'")
+          )))
  (c-mode . ((c-file-style . "GNU")
             (c-noise-macro-names . ("INLINE" "ATTRIBUTE_NO_SANITIZE_UNDEFINED" 
"UNINIT" "CALLBACK" "ALIGN_STACK"))
             (electric-quote-comment . nil)
diff --git a/lisp/progmodes/etags-regen.el b/lisp/progmodes/etags-regen.el
index e939b9b..d79e61e 100644
--- a/lisp/progmodes/etags-regen.el
+++ b/lisp/progmodes/etags-regen.el
@@ -43,6 +43,11 @@
   ;; always rely on it being installed.  So it might be ctags's etags.
   :type 'file)
 
+(defcustom etags-regen-program-options nil
+  "List of additional options to pass to the etags program."
+  ;; FIXME: How to implement the safety predicate?
+  :type '(repeat string))
+
 (defun etags-regen--maybe-generate ()
   (let (proj)
     (when (and etags-regen--tags-root
@@ -70,20 +75,23 @@
          (extensions '("rb" "js" "py" "pl" "el" "c" "cpp" "cc" "h" "hh" "hpp"
                        "java" "go" "cl" "lisp" "prolog" "php" "erl" "hrl"
                        "F" "f" "f90" "for" "cs" "a" "asm" "ads" "adb" "ada"))
-         (file-regexp (format "\\.%s\\'" (regexp-opt extensions t))))
-    (setq etags-regen--tags-file (make-temp-file "emacs-project-tags-")
+         (file-regexp (format "\\.%s\\'" (regexp-opt extensions t)))
+         (tags-file (make-temp-file "emacs-project-tags-"))
+         ;; 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).
+         (command (format "%s %s -L - -o %s"
+                          etags-regen-program
+                          (mapconcat #'identity etags-regen-program-options " 
")
+                          tags-file)))
+    (setq etags-regen--tags-file tags-file
           etags-regen--tags-root root)
     (with-temp-buffer
       (mapc (lambda (f)
               (when (string-match-p file-regexp f)
                 (insert f "\n")))
             files)
-      (shell-command-on-region
-       (point-min) (point-max)
-       ;; 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)
+      (shell-command-on-region (point-min) (point-max) command
        nil nil "*etags-project-tags-errors*" t))))
 
 (defun etags-regen--update-file ()



reply via email to

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