all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#60562: [PATCH] Fix split-string error if there is a space in the filename.
@ 2023-01-04 22:56 lux
  2023-01-06  9:48 ` Robert Pluim
  0 siblings, 1 reply; 16+ messages in thread
From: lux @ 2023-01-04 22:56 UTC (permalink / raw)
  To: 60562

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

If a space in filename, hfy-list-files function error. For example:

$ mkdir /tmp/test 
$ cd /tmp/test
$ touch 'hello world.py'
$ touch hi.py
$ ls
hello world.py  hi.py

In Emacs:

(hfy-list-files "/tmp/test")
("hi.py" "hello" "world.py")

As shown above, "hello world.py" is split into two files.

[-- Attachment #2: 0001-Fix-split-string-error-if-there-is-a-space-in-the-fi.patch --]
[-- Type: text/x-patch, Size: 1172 bytes --]

From 15b9d238ddcca17004d9edce54b4b1fb80556764 Mon Sep 17 00:00:00 2001
From: Xi Lu <lx@shellcodes.org>
Date: Thu, 5 Jan 2023 06:36:19 +0800
Subject: [PATCH] Fix split-string error if there is a space in the filename.

* lisp/htmlfontify.el (hfy-list-files): Specify separator (\n\r).
---
 lisp/htmlfontify.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index c989a12d205..be020b6b1c5 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -1826,8 +1826,9 @@ hfy-list-files
   ;;(message "hfy-list-files");;DBUG
   ;; 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 #'string-empty-p
+             (mapcar (lambda (F) (if (string-match "^./\\(.*\\)" F) (match-string 1 F) F))
+                     (split-string (shell-command-to-string hfy-find-cmd) "[\n\r]+")) ))
 
 ;; strip the filename off, return a directory name
 ;; not a particularly thorough implementation, but it will be
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-01-15 14:07 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.