all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lin Sun via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 43547@debbugs.gnu.org, eliz@gnu.org
Subject: bug#43547: 27.1.50; [PATCH] Fix error msg for looking file in non-exist dir when enable
Date: Mon, 21 Sep 2020 22:08:01 +0800	[thread overview]
Message-ID: <CAKu6+JH0PRba89k7CJw7YjLpkFC8nN=kwt=7pTPJHxPckyVGiQ@mail.gmail.com> (raw)

[-- 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


             reply	other threads:[~2020-09-21 14:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21 14:08 Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2020-09-21 14:14 ` bug#43547: 27.1.50; [PATCH] Fix error msg for looking file in non-exist dir when enable 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKu6+JH0PRba89k7CJw7YjLpkFC8nN=kwt=7pTPJHxPckyVGiQ@mail.gmail.com' \
    --to=bug-gnu-emacs@gnu.org \
    --cc=43547@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=lin.sun@zoom.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.