GNU bug report logs - #8163
23.2; Feature request: dabbrev look at filenames or buffer names

Previous Next

Package: emacs;

Reported by: "Ed Avis" <eda <at> waniasset.com>

Date: Thu, 3 Mar 2011 16:05:02 UTC

Severity: wishlist

Found in version 23.2

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8163 in the body.
You can then email your comments to 8163 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8163; Package emacs. (Thu, 03 Mar 2011 16:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Ed Avis" <eda <at> waniasset.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 03 Mar 2011 16:05:02 GMT) Full text and rfc822 format available.

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

From: "Ed Avis" <eda <at> waniasset.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 23.2; Feature request: dabbrev look at filenames or buffer names
Date: Thu, 3 Mar 2011 14:19:22 -0000
Start emacs and start editing a file called abcdef:

C-x C-f abcdef RET

In that buffer type abcde and then press M-/ to run dabbrev-expand.

Desired result: dabbrev looks at the buffer name (or the name of the
file it is visiting) and uses that to complete the string to 'abcdef'.
It could use the names of all open buffers as part of its pool.

Current result: No dynamic expansion for 'abcde' found

This would be useful in many programming languages where the filename
usually matches the name of a class or function.  It is common to create
the file first and start typing the code.

In GNU Emacs 23.2.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.21.4)  of
2010-07-08 on x86-10.phx2.fedoraproject.org configured using `configure
'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu'
'--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr'
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin'
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/var/lib' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg'
'--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm'
'--with-x-toolkit=gtk' 'build_alias=x86_64-redhat-linux-gnu'
'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
-pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic
-fno-optimize-sibling-calls''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  value of $LC_CTYPE: en_GB.UTF-8
  value of $LC_MESSAGES: en_GB.UTF-8
  value of $LC_MONETARY: en_GB.UTF-8
  value of $LC_NUMERIC: en_GB.UTF-8
  value of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
s p TAB S a TAB D o TAB K TAB TAB . TAB TAB RET C-@ ESC > ESC w C-x 2
C-x o C-x b RET C-x C-f u s p _ S a m p l e r D o w n l o a d S t r a t
e g y W e i g h t DEL DEL DEL DEL DEL DEL S c a ; DEL l DEL DEL DEL DEL
W e i g h t A d j u s t m e n t . s q l RET C-y ESC O A ESC O A ESC O A
ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A
ESC O A ESC O A ESC O A ESC O A C-e DEL DEL DEL DEL S t ESC / r a t e g
y W e r i g DEL DEL DEL i g h t A d j u s t m e n t DEL ESC / ESC ! e m
a c s SPC - - - C-g ESC x a b o u t SPC e m SPC RET C-x C-f ~ / a a DEL
b c d e f RET a b c d e ESC ? ESC / C-a C-k C-x k RET y e s RET ESC x r
e p o r t SPC e SPC C-g C-h k ESC / ESC O B ESC O B ESC O B ESC O B ESC
O B ESC O B ESC O B ESC O A ESC x r e p o r t SPC e m SPC b u SPC RET

Recent messages:
dabbrev-expand: No dynamic expansion for `usp_SamplerDownloadSt' found
Scanning for dabbrevs...100%
dabbrev-expand: No dynamic expansion for
`usp_SamplerDownloadStrategyWeightAdjustmen' found Quit Auto-saving...
(New file)
Scanning for dabbrevs...100%
dabbrev-expand: No dynamic expansion for `abcde' found Quit Type C-x 4
C-o RET to restore the other window.

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message idna sendmail ecomplete rfc822 mml
mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse
rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util
netrc time-date mm-util mail-prsvr gmm-utils mailheader canlock sha1
hex-util hashcash mail-utils emacsbug help-fns edmacro css-mode rect
dired kmacro log-view sql dabbrev smerge-mode log-edit pcvs-util add-log
help-mode view multi-isearch cus-edit cus-start cus-load wid-edit
perl-mode diff-mode easy-mmode vc vc-dispatcher vc-svn nxml-uchnm
rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc rng-uri
rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns
nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok ffap
server compile ansi-color ess-toolbar ess-mouse mouseme thingatpt
browse-url ess-menu ess-swv ess-noweb noweb-font-lock-mode ess-bugs-l
essd-els ess-sas-d ess-sas-l ess-sas-a executable shell ess-arc-d
ess-vst-d ess-xls-d ess-lsp-l ess-sta-d ess-sta-l cc-vars cc-defs
make-regexp ess-sp6-d ess-sp5-d ess-sp3-d ess-r-d ess-r-args assoc
ess-s-l ess-inf ess-utils comint ring ess-mode noweb-mode ess ess-custom
regexp-opt easymenu ess-compat ess-site tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process dbusbind
system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)

-- 
Ed Avis <eda <at> waniasset.com>


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#8163; Package emacs. (Tue, 10 May 2022 03:10:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Ed Avis" <eda <at> waniasset.com>
Cc: 8163 <at> debbugs.gnu.org
Subject: Re: bug#8163: 23.2; Feature request: dabbrev look at filenames or
 buffer names
Date: Tue, 10 May 2022 05:09:32 +0200
"Ed Avis" <eda <at> waniasset.com> writes:

> Start emacs and start editing a file called abcdef:
>
> C-x C-f abcdef RET
>
> In that buffer type abcde and then press M-/ to run dabbrev-expand.
>
> Desired result: dabbrev looks at the buffer name (or the name of the
> file it is visiting) and uses that to complete the string to 'abcdef'.
> It could use the names of all open buffers as part of its pool.
>
> Current result: No dynamic expansion for 'abcde' found
>
> This would be useful in many programming languages where the filename
> usually matches the name of a class or function.  It is common to create
> the file first and start typing the code.

Makes sense to me.  I've now added this to Emacs 29.

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




bug marked as fixed in version 29.1, send any further explanations to 8163 <at> debbugs.gnu.org and "Ed Avis" <eda <at> waniasset.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 10 May 2022 03:10:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#8163; Package emacs. (Thu, 12 May 2022 17:09:04 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 8163 <at> debbugs.gnu.org, Ed Avis <eda <at> waniasset.com>
Subject: Re: bug#8163: 23.2; Feature request: dabbrev look at filenames or
 buffer names
Date: Thu, 12 May 2022 19:42:09 +0300
>> Start emacs and start editing a file called abcdef:
>>
>> C-x C-f abcdef RET
>>
>> In that buffer type abcde and then press M-/ to run dabbrev-expand.
>>
>> Desired result: dabbrev looks at the buffer name (or the name of the
>> file it is visiting) and uses that to complete the string to 'abcdef'.
>> It could use the names of all open buffers as part of its pool.
>
> Makes sense to me.  I've now added this to Emacs 29.

Now dabbrev fails with:

Debugger entered--Lisp error: (error "Selecting deleted buffer")
  dabbrev--find-expansion("dabbr" -1 t)
  dabbrev-expand(nil)
  funcall-interactively(dabbrev-expand nil)
  command-execute(dabbrev-expand)

because dabbrev--last-buffer is a killed buffer in dabbrev--find-expansion:

	           (setq dabbrev--last-buffer
                         (pop dabbrev--friend-buffer-list))
	           (set-buffer dabbrev--last-buffer)

I don't see how can it not fail when the temporary buffer
"*abbrev-file*" gets added to dabbrev--friend-buffer-list:

                 (setq dabbrev--friend-buffer-list
                       (append dabbrev--friend-buffer-list
                               (list file-name-buffer))))

and then gets deleted afterwards:

           (when (buffer-live-p file-name-buffer)
             (kill-buffer file-name-buffer))))))))

So dabbrev--friend-buffer-list always contains '(... #<killed buffer>)
at the end, and at the next call to dabbrev--last-buffer causes the error.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#8163; Package emacs. (Fri, 13 May 2022 12:31:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 8163 <at> debbugs.gnu.org, Ed Avis <eda <at> waniasset.com>
Subject: Re: bug#8163: 23.2; Feature request: dabbrev look at filenames or
 buffer names
Date: Fri, 13 May 2022 14:30:19 +0200
Juri Linkov <juri <at> linkov.net> writes:

> So dabbrev--friend-buffer-list always contains '(... #<killed buffer>)
> at the end, and at the next call to dabbrev--last-buffer causes the error.

Yup.  This should now be fixed on the trunk.

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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 11 Jun 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 319 days ago.

Previous Next


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