[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 ()
- scratch/etags-regen updated (94437f9 -> 5270872), Dmitry Gutov, 2021/01/03
- scratch/etags-regen 4d0886e 02/11: Move to a separate file and minor mode, Dmitry Gutov, 2021/01/03
- scratch/etags-regen d6285de 05/11: New defcustom: etags-regen-program-options,
Dmitry Gutov <=
- scratch/etags-regen d9e3afe 04/11: Make etags-regen-program a user option, Dmitry Gutov, 2021/01/03
- scratch/etags-regen 798c90b 07/11: Support etags-regen-program-options in --update-file, Dmitry Gutov, 2021/01/03
- scratch/etags-regen 5270872 11/11: Undo the etags.el changes, Dmitry Gutov, 2021/01/03
- scratch/etags-regen aa4eddb 09/11: Ensure errors buffer name is more consistent, Dmitry Gutov, 2021/01/03
- scratch/etags-regen 8ce70eb 06/11: Use `silent' for appending, too, Dmitry Gutov, 2021/01/03
- scratch/etags-regen 46c1f2f 10/11: Solve (hopefully?) the local-variable-satefy issue, Dmitry Gutov, 2021/01/03
- scratch/etags-regen ab5bf3c 01/11: Merge branch 'master' into scratch/etags-regen, Dmitry Gutov, 2021/01/03
- scratch/etags-regen 6f26f60 08/11: Bookkeeping, Dmitry Gutov, 2021/01/03
- scratch/etags-regen 570f132 03/11: etags.c: Implement the -L flag, Dmitry Gutov, 2021/01/03