GNU bug report logs - #60562
[PATCH] Fix split-string error if there is a space in the filename.

Previous Next

Package: emacs;

Reported by: lux <lx <at> shellcodes.org>

Date: Wed, 4 Jan 2023 22:58:02 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 60562 <at> debbugs.gnu.org (full text, mbox):

From: lux <lx <at> shellcodes.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 60562 <at> debbugs.gnu.org
Subject: Re: bug#60562: [PATCH] Fix split-string error if there is a space
 in the filename.
Date: Sat, 7 Jan 2023 17:42:35 +0800
On Fri, 06 Jan 2023 10:48:43 +0100
Robert Pluim <rpluim <at> gmail.com> wrote:

> >>>>> On Thu, 5 Jan 2023 06:56:05 +0800, lux <lx <at> shellcodes.org>
> >>>>> said:  
> 
>     lux> * lisp/htmlfontify.el (hfy-list-files): Specify separator
>     lux> (\n\r). ---
>     lux>  lisp/htmlfontify.el | 5 +++--
>     lux>  1 file changed, 3 insertions(+), 2 deletions(-)  
> 
>     lux> diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
>     lux> index c989a12d205..be020b6b1c5 100644
>     lux> --- a/lisp/htmlfontify.el
>     lux> +++ b/lisp/htmlfontify.el
>     lux> @@ -1826,8 +1826,9 @@ hfy-list-files
>     lux>    ;;(message "hfy-list-files");;DBUG
>     lux>    ;; FIXME: this changes the dir of the current buffer.  Is
>     lux> that right?? (cd directory)
>     lux> -  (mapcar (lambda (F) (if (string-match "^./\\(.*\\)" F)
>     lux> (match-string 1 F) F))
>     lux> -          (split-string (shell-command-to-string
>     lux> hfy-find-cmd))) )
>     lux> +  (remove-if #'string-empty-p
>     lux> +             (mapcar (lambda (F) (if (string-match
>     lux> "^./\\(.*\\)" F) (match-string 1 F) F))
>     lux> +                     (split-string (shell-command-to-string
>     lux> hfy-find-cmd) "[\n\r]+")) ))  
> 
> You can avoid the issue (and improve portability) by using
> `directory-files-recursively' instead of `find'

But `hfy-find-cmd' is a configurable variable:

(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))

I don't know if using `directory-files-recursively' has other effects.








This bug report was last modified 2 years and 187 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.