From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Holger Sparr Newsgroups: gmane.emacs.help Subject: Re: how to make dabbrev expand to 2nd/3rd/... last occurence? Supersedes: Date: Fri, 13 Oct 2006 10:31:26 +0200 Message-ID: References: <1160657582.984062.53890@b28g2000cwb.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1160728927 9040 80.91.229.2 (13 Oct 2006 08:42:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 13 Oct 2006 08:42:07 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 13 10:42:06 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GYIbz-0005bT-Jt for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Oct 2006 10:41:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GYIby-0002WQ-LO for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Oct 2006 04:41:46 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 35 Original-X-Trace: news.dfncis.de xo4qLo64h9v0hG2GnPwaIwMa7oRtyjymedU7fkwdyap+g/ User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) Mail-Copies-To: never Cancel-Key: sha1:uYYf30POw0SWELDkhcZaIQIAmDU= Cancel-Lock: sha1:1eQJos3aWk2Smihg+XnCHveR0jo= Original-Xref: shelby.stanford.edu gnu.emacs.help:142386 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:38007 Archived-At: 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