GNU bug report logs - #78769
31.0.50; improve ffap-file-name-with-spaces

Previous Next

Package: emacs;

Reported by: Madhu <enometh <at> meer.net>

Date: Thu, 12 Jun 2025 01:11:02 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Full log


Message #25 received at 78769 <at> debbugs.gnu.org (full text, mbox):

From: Madhu <enometh <at> meer.net>
To: eliz <at> gnu.org
Cc: 78769 <at> debbugs.gnu.org
Subject: Re: bug#78769: 31.0.50; improve ffap-file-name-with-spaces
Date: Sat, 14 Jun 2025 21:07:38 +0530 (IST)
*  Eli Zaretskii <eliz <at> gnu.org> <86ldpwds3i.fsf <at> gnu.org>
Wrote on Fri, 13 Jun 2025 10:21:37 +0300
>> [Unfortunately it is also a limitation in the other implementation I
>> proposed, that of extending
>>  (assq 'file ffap-string-at-point-mode-alist)
>> so that doesn't buy anything.]

> I think this aspect is already in the doc string of the variable:

Yes of course.  I actually forgot to mention a different limitation of
the existing implementation. If the file name doesn't have an
extension you lose. with the spaces flag set

eg. ffap on  ~/.emacs or /etc/profile will only show the directories.

(This limitation isn't there in the alternative I proposed),

just a note. no changes to bug status.

to make ffap use a prefix argument to set ffap-file-name-with-spaces
is pretty hairy because ffap rebinds current-prefix-arg to nil.

With newadvice it can look like this

(defvar ffap-spaces-override nil)

(defun find-file-at-point-munge-cpa-around-advice (orig-fn &optional file-name)
  (let ((ffap-spaces-override current-prefix-arg))
    (funcall orig-fn file-name)))

(defun ffap-string-at-point-force-spaces-around-advice (orig-fn &optional mode)
  (let ((ffap-file-name-with-spaces (if ffap-spaces-override t nil)))
    (funcall orig-fn mode)))

(advice-add 'find-file-at-point :around
	    'find-file-at-point-munge-cpa-around-advice)

(advice-add 'ffap-string-at-point :around
	    'ffap-string-at-point-force-spaces-around-advice)

(when nil
  (advice-remove 'find-file-at-point :around
	       'find-file-at-point-munge-cpa-around-advice))
(when nil
  (advice-remove 'ffap-string-at-point
		 'ffap-string-at-point-force-spaces-around-advice))

;; which gives one a headache




This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.