unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8163: 23.2; Feature request: dabbrev look at filenames or buffer names
@ 2011-03-03 14:19 Ed Avis
  2022-05-10  3:09 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Ed Avis @ 2011-03-03 14:19 UTC (permalink / raw)
  To: 8163

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@waniasset.com>


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





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

* bug#8163: 23.2; Feature request: dabbrev look at filenames or buffer names
  2011-03-03 14:19 bug#8163: 23.2; Feature request: dabbrev look at filenames or buffer names Ed Avis
@ 2022-05-10  3:09 ` Lars Ingebrigtsen
  2022-05-12 16:42   ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-10  3:09 UTC (permalink / raw)
  To: Ed Avis; +Cc: 8163

"Ed Avis" <eda@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





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

* bug#8163: 23.2; Feature request: dabbrev look at filenames or buffer names
  2022-05-10  3:09 ` Lars Ingebrigtsen
@ 2022-05-12 16:42   ` Juri Linkov
  2022-05-13 12:30     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2022-05-12 16:42 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 8163, Ed Avis

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





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

* bug#8163: 23.2; Feature request: dabbrev look at filenames or buffer names
  2022-05-12 16:42   ` Juri Linkov
@ 2022-05-13 12:30     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-13 12:30 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 8163, Ed Avis

Juri Linkov <juri@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





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

end of thread, other threads:[~2022-05-13 12:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-03 14:19 bug#8163: 23.2; Feature request: dabbrev look at filenames or buffer names Ed Avis
2022-05-10  3:09 ` Lars Ingebrigtsen
2022-05-12 16:42   ` Juri Linkov
2022-05-13 12:30     ` Lars Ingebrigtsen

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