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

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