unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35693: The prompt for find-file becomes a ~ instead of ~/
@ 2019-05-12  2:27 積丹尼 Dan Jacobson
  2019-05-14  5:56 ` Katsumi Yamaoka
  0 siblings, 1 reply; 4+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-05-12  2:27 UTC (permalink / raw)
  To: 35693

M-x gnus
C-x C-f
The prompt for find-file becomes a ~ instead of ~/
It turns out because since one uses ffap-bindings
and the cursor is now resting after a ":", the find-file prompt is
affected.
OK it is not a gnus bug, but most commonly seen when using gnus...

My conf files are in jidanni.org/comp/configuration/

Gnus v5.13
GNU Emacs 26.1 (build 2, i686-pc-linux-gnu, GTK+ Version 3.24.4)
 of 2019-02-04, modified by Debian





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

* bug#35693: The prompt for find-file becomes a ~ instead of ~/
  2019-05-12  2:27 bug#35693: The prompt for find-file becomes a ~ instead of ~/ 積丹尼 Dan Jacobson
@ 2019-05-14  5:56 ` Katsumi Yamaoka
  2019-05-14  9:42   ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 4+ messages in thread
From: Katsumi Yamaoka @ 2019-05-14  5:56 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 35693

On Sun, 12 May 2019 10:27:01 +0800, 積丹尼 wrote:
> M-x gnus
> C-x C-f
> The prompt for find-file becomes a ~ instead of ~/

`C-x C-f' invokes `find-file-at-point' because of `ffap-bindings'.

> It turns out because since one uses ffap-bindings
> and the cursor is now resting after a ":", the find-file prompt is
> affected.
> OK it is not a gnus bug, but most commonly seen when using gnus...

Yes, it's not a Gnus bug.  That happens when performing `C-x C-f'
just after the colon in the group line like this:

	123: nnfoo:bar

There ffap grabs a string "123:", recognizes it as a colon separated
paths list, and extracts a path where the cursor is, that is "".
That *path* string is used to create a prompt string by way of:

(abbreviate-file-name (expand-file-name ""))

It returns "~" because you are in the home directory.  That is why
you are prompted with "~" instead of "~/".

There would be many ways to solve it, though I'm not sure what is
the best.  Here are two of them (based on ffap.el in the trunk):

1. (ffap-file-at-point): Don't recognize "" as a path name.
--- ffap.el~	2019-05-12 21:20:25.967974700 +0000
+++ ffap.el	2019-05-14 05:51:47.038159300 +0000
@@ -1326,6 +1326,7 @@
 	 ;; If it contains a colon, get rid of it (and return if exists)
 	 ((and (string-match path-separator name)
 	       (setq name (ffap-string-at-point 'nocolon))
+	       (> (length name) 0)
 	       (ffap-file-exists-string name)))
 	 ;; File does not exist, try the alist:
 	 ((let ((alist ffap-alist) tem try case-fold-search)

2. (ffap-file-exists-string): Don't recognize "" as a file name.
--- ffap.el~	2019-05-12 21:20:25.967974700 +0000
+++ ffap.el	2019-05-14 05:51:47.038159300 +0000
@@ -513,7 +513,7 @@
 name may have a suffix added from `ffap-compression-suffixes'.
 The optional NOMODIFY argument suppresses the extra search."
   (cond
-   ((not file) nil)			; quietly reject nil
+   ((zerop (length file)) nil)		; quietly reject nil and ""
    ((file-exists-p file) file)		; try unmodified first
    ;; three reasons to suppress search:
    (nomodify nil)

Regards,





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

* bug#35693: The prompt for find-file becomes a ~ instead of ~/
  2019-05-14  5:56 ` Katsumi Yamaoka
@ 2019-05-14  9:42   ` 積丹尼 Dan Jacobson
  2019-05-17  1:35     ` Katsumi Yamaoka
  0 siblings, 1 reply; 4+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-05-14  9:42 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 35693

>>>>> "KY" == Katsumi Yamaoka <yamaoka@jpl.org> writes:
KY> It returns "~" because you are in the home directory.  That is why
KY> you are prompted with "~" instead of "~/".

How terrible. Glad you found the cause. Hope it will get fixed soon.





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

* bug#35693: The prompt for find-file becomes a ~ instead of ~/
  2019-05-14  9:42   ` 積丹尼 Dan Jacobson
@ 2019-05-17  1:35     ` Katsumi Yamaoka
  0 siblings, 0 replies; 4+ messages in thread
From: Katsumi Yamaoka @ 2019-05-17  1:35 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 35693-done

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

On Tue, 14 May 2019 17:42:15 +0800, 積丹尼 wrote:
>>>>>> "KY" == Katsumi Yamaoka <yamaoka@jpl.org> writes:
KY> It returns "~" because you are in the home directory.  That is why
KY> you are prompted with "~" instead of "~/".

> How terrible. Glad you found the cause. Hope it will get fixed soon.

BTW, I can't imagine the ffap bindings to be useful in the Gnus
group mode.  An exapmle to get rid of the ffap bindings in only
the Gnus group mode is below.

Anyway I've installed both of the following two changes in the
trunk, and am closing this bug.

> 1. (ffap-file-at-point): Don't recognize "" as a path name.
> 2. (ffap-file-exists-string): Don't recognize "" as a file name.

Regards,
\f

[-- Attachment #2: Type: application/emacs-lisp, Size: 1104 bytes --]

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

end of thread, other threads:[~2019-05-17  1:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-12  2:27 bug#35693: The prompt for find-file becomes a ~ instead of ~/ 積丹尼 Dan Jacobson
2019-05-14  5:56 ` Katsumi Yamaoka
2019-05-14  9:42   ` 積丹尼 Dan Jacobson
2019-05-17  1:35     ` Katsumi Yamaoka

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