From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: lux Newsgroups: gmane.emacs.bugs Subject: bug#60562: [PATCH] Fix split-string error if there is a space in the filename. Date: Thu, 5 Jan 2023 06:56:05 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/DgBm0wPeHTKxUi1MdiNm/Sx" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17615"; mail-complaints-to="usenet@ciao.gmane.io" To: 60562@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 04 23:58:39 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pDCiU-0004I9-Sp for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Jan 2023 23:58:39 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDCiB-00015d-PG; Wed, 04 Jan 2023 17:58:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDChv-000120-8S for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2023 17:58:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDChv-0000VL-0K for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2023 17:58:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pDChu-0007V7-Eq for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2023 17:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: lux Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Jan 2023 22:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60562 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167287307228814 (code B ref -1); Wed, 04 Jan 2023 22:58:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Jan 2023 22:57:52 +0000 Original-Received: from localhost ([127.0.0.1]:49843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDChj-0007Ug-Kh for submit@debbugs.gnu.org; Wed, 04 Jan 2023 17:57:52 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:54304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDChi-0007UZ-Cr for submit@debbugs.gnu.org; Wed, 04 Jan 2023 17:57:50 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDChW-0000oU-Q9 for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2023 17:57:43 -0500 Original-Received: from out203-205-221-210.mail.qq.com ([203.205.221.210]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDChT-0006oR-Ph for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2023 17:57:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1672873047; bh=fXra3zKb1UAFRQYW1IiNc4qv0m8/W8ZRpwMD5dKuvPw=; h=Date:From:To:Subject; b=dLdM8EAqNp/Jo+oOSkKYe7eSYeMi53F/Anz6cstgtCwrlEl58ck6cFpTHMNXNejiz YEiz959ZOXC9kgtA2Nu+JmvKgUQElqgzxRK9O9/2OQkKJXIVjCMztIhzUzLaTZvHbd SvADEj9Ag+KNneWeRl8UtqNZcLnhWU7Mx0A25nK8= Original-Received: from lx-pc ([122.97.179.149]) by newxmesmtplogicsvrszc1-0.qq.com (NewEsmtp) with SMTP id E0891AC2; Thu, 05 Jan 2023 06:56:08 +0800 X-QQ-mid: xmsmtpt1672872968trye89fy0 X-QQ-XMAILINFO: N7h1OCCDntujsugnVjLjzn86SQOt1ptDAW8F+h4nryzrSc44edMG74hY8PwmDh LNJUbeiSax5yGkyS0aNH5uVeJoiDZa118P1C/desI6Deu5/gp01fm3wLl1a9OMofkk0/aOqnFpDa wLF7qDzf8dq9T1ReMYSEwCYBF8upO5Mv7mhbh0TLR8zvdKKiY0L97ZbG/T68rOfNx7B8ztnJvlGt vgCAcedi3GVgFWZ8zf5H0bXEv54zN1tWm15OcBN+XyG6CG3CtOYSrbkDoGbbfYsRcFfZz50ZQMsW kpoG1fXTxJDyhWU8jC+74rqT7MWWc1nRQYhMQM0OoLIbuqtpoKIFvjT1SMLE/xoC6BuHmoKQw9nc vAKsshW8kQiKr5jx/3iADE3jtDqyc7JnCYA/qdiOLoxpvjLuCgngR8Oik4Aw1qwwHxJ5htes0bYe YvaQSv61H0IZKdkIgYbfndCy7oxItS2GJqLufS54jXDo6jnuNTPpK0VXjrkOIRw+T7hTL+UQ5i6a 6FRv6SJoFhiMeMtpFVyN5v6fWF1kMBGPdwtJTm9Z03uTLm1BDUdjqBxCR631OaC/LBNj+5fa43XO ZiLI2hM/YjQf9bNXL6ZIAA2i2slG0CV1RuuXOmeotIqjpHNswUnn29MS1uvviQaOkjjOjrAJ1Fzd SsOsq2DbaVqFOqlnn8DlKPu4O9nkGKKlpaxa02nLXb8tETHXisBNj2DtDpVEqxAtNodiBL39c8ac t9gfDDcbWkTZNkqK7WUdEEuCekhjhgbFzy5FnZZMJdmVRFQMFvvs1bqorslrllK8uQuhr6ftQbY/ ROJ40Tu32daw7so/3tY/IM/abunVZkrz+wcxfN9Z X-OQ-MSGID: <20230105065605.360d0bdc@lx-pc> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.36; x86_64-redhat-linux-gnu) Received-SPF: none client-ip=203.205.221.210; envelope-from=lx@shellcodes.org; helo=out203-205-221-210.mail.qq.com X-Spam_score_int: 10 X-Spam_score: 1.0 X-Spam_bar: + X-Spam_report: (1.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HELO_DYNAMIC_IPADDR=1.951, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:252544 Archived-At: --MP_/DgBm0wPeHTKxUi1MdiNm/Sx Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline 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. --MP_/DgBm0wPeHTKxUi1MdiNm/Sx Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-Fix-split-string-error-if-there-is-a-space-in-the-fi.patch >From 15b9d238ddcca17004d9edce54b4b1fb80556764 Mon Sep 17 00:00:00 2001 From: Xi Lu 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 --MP_/DgBm0wPeHTKxUi1MdiNm/Sx--