help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to make dabbrev expand to 2nd/3rd/... last occurence?


From: Holger Sparr
Subject: Re: how to make dabbrev expand to 2nd/3rd/... last occurence?
Date: Fri, 13 Oct 2006 10:31:26 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

On 12 Oct 2006, Florian Kaufmann wrote:

> Is there an extension to the dabbrev mode so that I can also have
> ´printed´ the 2nd/3rd... last occurence of a word? For example
> something like this. Say I have dabbrev-expand bound to C-; .Pressing
> C-; would behave normaly, another ; would replace the just found
> occurence with the 2nd last occurence, another ; would replace it with
> the 3rd last occurence and so on. 

I'd use C-; again, since you have C- already pressed.

Otherwise you have to modify the behavior of ";"


Something like 

(defun my-semi-or-complete (&optional arg)
  (interactive "p")        
  (let ((n (if arg         
               arg         
             1)))          
     (if (or (eq last-command 'my-semi-or-complete) (eq last-command 
'dabbrev-expand))   
         (call-interactively 'dabbrev-expand)
      (insert-char ?\; n))))


which can be bound to ";"

(global-set-key (kbd ";") 'my-semi-or-complete)


(Probably not the best solution.)


Holger


reply via email to

[Prev in Thread] Current Thread [Next in Thread]