From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: 67687@debbugs.gnu.org, eskinjp@gmail.com, stefankangas@gmail.com
Subject: bug#67687: Feature request: automatic tags management
Date: Sat, 30 Dec 2023 09:33:58 +0200 [thread overview]
Message-ID: <83tto0400p.fsf@gnu.org> (raw)
In-Reply-To: <1a8c51fb-a114-42a4-ae40-8314d3f21104@gutov.dev> (message from Dmitry Gutov on Sat, 30 Dec 2023 05:05:01 +0200)
> Date: Sat, 30 Dec 2023 05:05:01 +0200
> Cc: 67687@debbugs.gnu.org, eskinjp@gmail.com, stefankangas@gmail.com
> From: Dmitry Gutov <dmitry@gutov.dev>
>
> >> +(defcustom etags-regen-tags-file "TAGS"
> >> + "Name of the tags file to create inside the project.
> >
> > This and the other defcustom's here should say in the first line of
> > the doc string that they are for etags-regen-mode. This will help
> > discoverability and also produce a more helpful display with the
> > various apropos commands.
>
> I've tried, but it seems hard to fit into most of them while keeping to
> the requisite max number of columns. Only managed to fit that into
> etags-regen-program and etags-regen-file-extensions.
>
> TBH, most of the time it would seem superfluous, given the namespaced
> names. But it's probably good to mention in 'etags-regen-program', on
> balance.
I suggest some minor improvements in this area below.
> >> +;;;###autoload
> >> +(put 'etags-regen-file-extensions 'safe-local-variable
> >> + (lambda (value) (and (listp value) (seq-every-p #'stringp value))))
> >
> > Why not use list-of-strings-p here?
>
> Again, that "core ELPA" consideration. We could deploy this feature to a
> number of released Emacs versions, if we don't introduce such dependencies.
Isn't this covered by the compat package on ELPA? If not, I think it
should be.
> >> + (lambda (f) (or (not (string-match-p match-re f))
> >> + (string-match-p "/\\.#" f)
> >
> > Is that '/' there to detect regexps for absolute file names? If so,
> > that won't work for Windows.
>
> It's to detect backup files.
Can you add a comment there to that effect?
>
> >> +(defun etags-regen--ignore-regexp (ignore)
> >> + (require 'dired)
> >> + ;; It's somewhat brittle to rely on Dired.
> >> + (let ((re (dired-glob-regexp ignore)))
> >> + ;; We could implement root anchoring here, but \\= doesn't work in
> >> + ;; string-match :-(.
> >> + (concat (unless (eq ?/ (aref re 3)) "/")
> >> + ;; Cutting off the anchors.
> >> + (substring re 2 (- (length re) 2))
> >> + (unless (eq ?/ (aref re (- (length re) 3)))
> >> + ;; Either match a full name segment, or eos.
> >> + "\\(?:/\\|\\'\\)"))))
> >
> > Same here: what is the purpose of comparisons with a slash? I think
> > we need some more comments there explaining the logic of the code.
>
> We compare with a slash to see whether the glob was matching against a
> directory (in which case it's already anchored to the name of a file
> name segment), otherwise we add such anchoring to either the end of a
> file name segment or eos (thus allowing a glob match both directory
> names and file names).
>
> Added a shorter comment saying the same.
Thanks, but I miss in that comment explanations of the "magic"
constants 2 and 3. Could we add that, please?
> >> +(defun etags-regen--append-tags (&rest file-names)
> >> + (goto-char (point-max))
> >> + (let ((options (etags-regen--build-program-options (etags-regen--ctags-p)))
> >> + (inhibit-read-only t))
> >> + ;; XXX: call-process is significantly faster, though.
> >> + ;; Like 10ms vs 20ms here.
> >> + (shell-command
> >> + (format "%s %s %s -o -"
> >> + etags-regen-program (mapconcat #'identity options " ")
> >> + (mapconcat #'identity file-names " "))
> >> + t etags-regen--errors-buffer-name))
> >
> > Should we indeed use call-process?
>
> Something for later improvement.
>
> Looking at the code, I believe I decided to use 'shell-command' for the
> first version because of how easy it makes to output stderr to a
> separate buffer. call-process only offers writing them to a file.
How about mentioning this issue in that comment?
> +(defcustom etags-regen-tags-file "TAGS"
> + "Name of the tags file to create inside the project.
I suggest
Name of the tags file to create inside the project by `etags-regen-mode'.
> +(defcustom etags-regen-program-options nil
> + "List of additional options to pass to the etags program."
I suggest
List of additional options for etags program invoked by `etags-regen-mode'.
> +(defcustom etags-regen-regexp-alist nil
> + "Mapping of languages to additional regexps for tags.
I suggest
Mapping of languages to etags regexps for `etags-regen-mode'.
> +(define-minor-mode etags-regen-mode
> + "Generate and update the tags automatically.
I suggest
Minor mode to automatically generate and update tags tables.
Thanks.
next prev parent reply other threads:[~2023-12-30 7:33 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-07 11:43 bug#67687: Feature request: automatic tags management Jon Eskin
2023-12-07 15:57 ` Dmitry Gutov
2023-12-07 19:57 ` Jon Eskin
2023-12-10 2:41 ` Dmitry Gutov
2023-12-10 11:38 ` Jon Eskin
2023-12-20 21:11 ` Jon Eskin
2023-12-21 0:24 ` Dmitry Gutov
2023-12-21 7:40 ` Eli Zaretskii
2023-12-21 16:46 ` Dmitry Gutov
2023-12-21 23:37 ` Dmitry Gutov
2023-12-24 1:43 ` Dmitry Gutov
2023-12-28 9:30 ` Eli Zaretskii
2023-12-30 3:05 ` Dmitry Gutov
2023-12-30 7:33 ` Eli Zaretskii [this message]
2023-12-30 23:43 ` Dmitry Gutov
2023-12-31 1:02 ` Stefan Kangas
2023-12-31 23:29 ` Dmitry Gutov
2024-01-02 0:40 ` Stefan Kangas
2024-01-02 1:31 ` Dmitry Gutov
2023-12-31 7:07 ` Eli Zaretskii
2023-12-31 15:21 ` Dmitry Gutov
2023-12-29 22:29 ` Stefan Kangas
2023-12-30 1:50 ` Dmitry Gutov
2023-12-30 20:31 ` Stefan Kangas
2023-12-30 22:50 ` Dmitry Gutov
2023-12-30 23:25 ` Stefan Kangas
2023-12-30 23:58 ` Dmitry Gutov
2023-12-31 7:23 ` Eli Zaretskii
2023-12-31 15:31 ` Dmitry Gutov
2023-12-29 22:17 ` Stefan Kangas
2023-12-30 1:31 ` Dmitry Gutov
2023-12-30 20:56 ` Stefan Kangas
2023-12-30 23:23 ` Dmitry Gutov
2023-12-31 0:03 ` Stefan Kangas
2023-12-31 6:34 ` Eli Zaretskii
2023-12-31 7:22 ` Stefan Kangas
2023-12-31 15:22 ` Dmitry Gutov
2023-12-31 15:25 ` Dmitry Gutov
2023-12-31 16:42 ` Eli Zaretskii
2023-12-31 17:53 ` Dmitry Gutov
2023-12-31 19:27 ` Eli Zaretskii
2024-01-01 1:23 ` Dmitry Gutov
2024-01-01 12:07 ` Eli Zaretskii
2024-01-01 15:47 ` Dmitry Gutov
2024-01-01 16:50 ` Eli Zaretskii
2024-01-01 17:23 ` Dmitry Gutov
2024-01-01 17:39 ` Eli Zaretskii
2024-01-01 18:48 ` Dmitry Gutov
2024-01-01 19:25 ` Eli Zaretskii
2024-01-02 1:40 ` Dmitry Gutov
2024-01-04 1:56 ` Dmitry Gutov
2024-01-02 10:41 ` Francesco Potortì
2024-01-02 13:09 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83tto0400p.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=67687@debbugs.gnu.org \
--cc=dmitry@gutov.dev \
--cc=eskinjp@gmail.com \
--cc=stefankangas@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).