From: Eli Zaretskii <eliz@gnu.org>
To: lux <lx@shellcodes.org>
Cc: ruijie@netyu.xyz, 60562-done@debbugs.gnu.org, rpluim@gmail.com
Subject: bug#60562: [PATCH] Fix split-string error if there is a space in the filename.
Date: Sat, 14 Jan 2023 11:12:05 +0200 [thread overview]
Message-ID: <838ri58opm.fsf@gnu.org> (raw)
In-Reply-To: <tencent_1ED514DCF9C84787D70793734ECC38D4CC0A@qq.com> (message from lux on Sun, 8 Jan 2023 15:23:45 +0800)
> Date: Sun, 8 Jan 2023 15:23:45 +0800
> From: lux <lx@shellcodes.org>
> Cc: Eli Zaretskii <eliz@gnu.org>, 60562@debbugs.gnu.org, Robert Pluim
> <rpluim@gmail.com>, bug-gnu-emacs@gnu.org
>
> On Sat, 07 Jan 2023 17:00:02 -0600
> Ruijie Yu <ruijie@netyu.xyz> wrote:
>
> > Hi,
> >
> > >-(defcustom hfy-find-cmd
> > >- "find . -type f \\! -name \\*~ \\! -name \\*.flc \\! -path
> > >\\*/CVS/\\*"
> > >- "Find command used to harvest a list of files to attempt to
> > >fontify."
> > >- :tag "find-command"
> > >- :type '(string))
> > >+(defcustom hfy-exclude-file-rules
> > >+ '("\\.flc$"
> > >+ "/CVS/.*"
> > >+ ".*~"
> > >+ "\\.git/.*")
> > >+ "Define some regular expressions to exclude files"
> > >+ :tag "exclude-rules"
> > >+ :type '(list string))
> >
> > For the third entry, shouldn't it be ".*~$" instead, to indicate that
> > "~" is the last character?
> >
> > For the fourth entry, currently it would match against the file name
> > "ROOT/hello.git/foo". In addition, for git submodules, ".git" is a
> > regular file instead of a directory. Maybe something like this is
> > what you want:
> >
> > (rx "/.git" (opt "/" (0+ any)) line-end)
> >
> > or in raw regexp: "/\\.git\\(?:/.*\\)?$"
> >
> > Also, in this change, we are dropping the requirement that the found
> > file are actually files, whereas we used to say "-type f". Is this
> > change fine?
> >
> > > (defun hfy-list-files (directory)
> > > "Return a list of files under DIRECTORY.
> > > Strips any leading \"./\" from each filename."
> > >- ;;(message "hfy-list-files");;DBUG
> > >+ ;;(message "hfy-list-files");;DEBUG
> > > ;; FIXME: this changes the dir of the current buffer. Is that
> > > right?? (cd directory)
> > >- (mapcar (lambda (F) (if (string-match "^./\\(.*\\)" F)
> > >(match-string 1 F) F))
> > >- (split-string (shell-command-to-string hfy-find-cmd))) )
> > >+ (remove-if (lambda (f) (seq-some (lambda (r)
> > >+ (string-match r f))
> > >hfy-exclude-file-rules))
> > >+ (directory-files-recursively "." ".*")))
> >
> > We should change `remove-if' into `cl-remove-if' because both "cl.el"
> > and the alias `remove-if' are deprecated.
> >
>
> Thank you, I updated the patch file.
Thanks, installed on the emacs-29 branch, and closing the bug.
next prev parent reply other threads:[~2023-01-14 9:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-04 22:56 bug#60562: [PATCH] Fix split-string error if there is a space in the filename lux
2023-01-06 9:48 ` Robert Pluim
2023-01-07 9:29 ` Eli Zaretskii
2023-01-07 11:16 ` Robert Pluim
2023-01-07 11:37 ` Eli Zaretskii
2023-01-07 13:56 ` Eli Zaretskii
2023-01-07 14:52 ` lux
2023-01-07 23:00 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-08 7:23 ` lux
2023-01-09 14:28 ` Robert Pluim
2023-01-09 14:55 ` lux
2023-01-14 9:12 ` Eli Zaretskii [this message]
2023-01-07 9:42 ` lux
2023-01-07 10:48 ` Eli Zaretskii
2023-01-15 12:33 ` Andy Moreton
2023-01-15 14:07 ` Eli Zaretskii
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=838ri58opm.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=60562-done@debbugs.gnu.org \
--cc=lx@shellcodes.org \
--cc=rpluim@gmail.com \
--cc=ruijie@netyu.xyz \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.