unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43547: 27.1.50; [PATCH] Fix error msg for looking file in non-exist dir when enable
@ 2020-09-21 14:08 Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-09-21 14:14 ` Lin Sun
  2020-09-21 15:33 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 6+ messages in thread
From: Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-09-21 14:08 UTC (permalink / raw)
  To: 43547, eliz

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

Hi Eli,

There is an error message for ede-mode try travel in non-exist directory.
Follow steps will reproduce the issue, and the solution is detecting
dir exists before traveling it.
$ mkdir /tmp/src
$ touch src/emacs.c
$ emacs -nw -q \
 --eval '(progn (global-ede-mode t)(setq debug-on-error
t)(find-file-noselect "/tmp/not-exist.c"))'

Please review the patch, thank you.

[-- Attachment #2: 0001-Fix-error-msg-for-looking-file-in-non-exist-dir-when.patch --]
[-- Type: application/octet-stream, Size: 1701 bytes --]

From 5d19c68459ca9ce01a1dc2d4a23cb41c432ebcad Mon Sep 17 00:00:00 2001
From: Lin Sun <lin.sun@zoom.us>
Date: Mon, 21 Sep 2020 21:50:35 +0800
Subject: [PATCH] Fix error msg for looking file in non-exist dir when enable
 ede-mode

* lisp/cedet/ede/emacs.el: fix the error msg from
ede-emacs-find-in-directories when looking file in non-exist
directory.
---
 lisp/cedet/ede/emacs.el | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/lisp/cedet/ede/emacs.el b/lisp/cedet/ede/emacs.el
index bfcbd40..83e0883 100644
--- a/lisp/cedet/ede/emacs.el
+++ b/lisp/cedet/ede/emacs.el
@@ -234,20 +234,20 @@ ede-emacs-find-in-directories
       (let* ((D (car dirs))
 	     (ed (expand-file-name D base))
 	     (ef (expand-file-name name ed)))
-	(if (file-exists-p ef)
-	    (setq ans ef)
-	  ;; Not in this dir?  How about subdirs?
-	  (let ((dirfile (directory-files ed t))
-		(moredirs nil)
-		)
-	    ;; Get all the subdirs.
-	    (dolist (DF dirfile)
-	      (when (and (file-directory-p DF)
-			 (not (string-match "\\.$" DF)))
-		(push DF moredirs)))
-	    ;; Try again.
-	    (setq ans (ede-emacs-find-in-directories name ed moredirs))
-	    ))
+	(when (file-exists-p ed)
+          (if (file-exists-p ef)
+	      (setq ans ef)
+	    ;; Not in this dir?  How about subdirs?
+	    (let ((dirfile (directory-files ed t))
+		  (moredirs nil)
+		  )
+	      ;; Get all the subdirs.
+	      (dolist (DF dirfile)
+	        (when (and (file-directory-p DF)
+			   (not (string-match "\\.$" DF)))
+		  (push DF moredirs)))
+	      ;; Try again.
+	      (setq ans (ede-emacs-find-in-directories name ed moredirs)))))
 	(setq dirs (cdr dirs))))
     ans))
 
-- 
2.2.0


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

* bug#43547: 27.1.50; [PATCH] Fix error msg for looking file in non-exist dir when enable
  2020-09-21 14:08 bug#43547: 27.1.50; [PATCH] Fix error msg for looking file in non-exist dir when enable Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-09-21 14:14 ` Lin Sun
  2020-09-21 15:33 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Lin Sun @ 2020-09-21 14:14 UTC (permalink / raw)
  To: 43547

Hi Eli,

I have to correct my typo, the step 2 is assume already in "/tmp", and
the cmd in absolute path is
...
$ touch /tmp/src/emacs.c
...

Regards
Lin Sun





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

* bug#43547: 27.1.50; [PATCH] Fix error msg for looking file in non-exist dir when enable
  2020-09-21 14:08 bug#43547: 27.1.50; [PATCH] Fix error msg for looking file in non-exist dir when enable Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-09-21 14:14 ` Lin Sun
@ 2020-09-21 15:33 ` Lars Ingebrigtsen
  2020-09-21 23:51   ` Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-21 15:33 UTC (permalink / raw)
  To: Lin Sun; +Cc: 43547

Lin Sun <lin.sun@zoom.us> writes:

> Hi Eli,
>
> There is an error message for ede-mode try travel in non-exist directory.
> Follow steps will reproduce the issue, and the solution is detecting
> dir exists before traveling it.
> $ mkdir /tmp/src
> $ touch src/emacs.c
> $ emacs -nw -q \
>  --eval '(progn (global-ede-mode t)(setq debug-on-error
> t)(find-file-noselect "/tmp/not-exist.c"))'
>
> Please review the patch, thank you.

I'm not Eli, but the patch looked fine to me, so I've applied it to
Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43547: 27.1.50; [PATCH] Fix error msg for looking file in non-exist dir when enable
  2020-09-21 15:33 ` Lars Ingebrigtsen
@ 2020-09-21 23:51   ` Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-09-22 15:00     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-09-21 23:51 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Eli Zaretskii; +Cc: 43547

Hi Lars,

Thank you for applying the patch, yes, it should be included into both
Emcas 27 and Emacs 28.

Best Regards
Lin Sun

On Mon, Sep 21, 2020 at 11:34 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:
>
> Lin Sun <lin.sun@zoom.us> writes:
>
> > Hi Eli,
> >
> > There is an error message for ede-mode try travel in non-exist directory.
> > Follow steps will reproduce the issue, and the solution is detecting
> > dir exists before traveling it.
> > $ mkdir /tmp/src
> > $ touch src/emacs.c
> > $ emacs -nw -q \
> >  --eval '(progn (global-ede-mode t)(setq debug-on-error
> > t)(find-file-noselect "/tmp/not-exist.c"))'
> >
> > Please review the patch, thank you.
>
> I'm not Eli, but the patch looked fine to me, so I've applied it to
> Emacs 28.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43547: 27.1.50; [PATCH] Fix error msg for looking file in non-exist dir when enable
  2020-09-21 23:51   ` Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-09-22 15:00     ` Lars Ingebrigtsen
  2020-09-23  0:40       ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-22 15:00 UTC (permalink / raw)
  To: Lin Sun; +Cc: 43547

Lin Sun <lin.sun@zoom.us> writes:

> Thank you for applying the patch, yes, it should be included into both
> Emcas 27 and Emacs 28.

I don't think it's a regression from Emacs 26 (i.e., it also had this
error?)  At this point we're only fixing (serious) regressions in Emacs
27, so the fix won't be backported to Emacs 27.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43547: 27.1.50; [PATCH] Fix error msg for looking file in non-exist dir when enable
  2020-09-22 15:00     ` Lars Ingebrigtsen
@ 2020-09-23  0:40       ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 6+ messages in thread
From: LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-09-23  0:40 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Zaretskii, 43547@debbugs.gnu.org

[-- Attachment #1: Type: text/html, Size: 2942 bytes --]

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

end of thread, other threads:[~2020-09-23  0:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 14:08 bug#43547: 27.1.50; [PATCH] Fix error msg for looking file in non-exist dir when enable Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-21 14:14 ` Lin Sun
2020-09-21 15:33 ` Lars Ingebrigtsen
2020-09-21 23:51   ` Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-22 15:00     ` Lars Ingebrigtsen
2020-09-23  0:40       ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors

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