unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Holger Sparr <sparr+usenet@mfk.tu-dresden.de>
Subject: Re: how to make dabbrev expand to 2nd/3rd/... last occurence?
Date: Fri, 13 Oct 2006 10:31:26 +0200	[thread overview]
Message-ID: <lniriok469.fsf@mfk.tu-dresden.de> (raw)
In-Reply-To: 1160657582.984062.53890@b28g2000cwb.googlegroups.com

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

  parent reply	other threads:[~2006-10-13  8:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-12 12:53 how to make dabbrev expand to 2nd/3rd/... last occurence? Florian Kaufmann
2006-10-12 15:36 ` Florian Kaufmann
2006-10-13  8:31 ` Holger Sparr [this message]
     [not found] ` <lnmz80ka8z.fsf@mfk.tu-dresden.de>
2006-10-13  9:46   ` Florian Kaufmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lniriok469.fsf@mfk.tu-dresden.de \
    --to=sparr+usenet@mfk.tu-dresden.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).