From: cons <consspam@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: dabbrev problem...
Date: Fri, 14 Sep 2007 05:39:38 -0700 [thread overview]
Message-ID: <1189773578.932094.215980@g4g2000hsf.googlegroups.com> (raw)
In-Reply-To: <mailman.853.1189765115.18990.help-gnu-emacs@gnu.org>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 2419 bytes --]
On 14 Sep, 12:20, Andreas Röhler <andreas.roeh...@online.de> wrote:
> Am Donnerstag, 13. September 2007 21:51 schrieb cons:
>
> > (defun complete-further (arg)
> > "Insert space if necessary and then call dabbrev-expand."
> > (interactive "*P")
> > (if (not (eq (preceding-char) ?\s))
> > (insert ?\s))
> > (dabbrev-expand arg))
>
> What about this:
>
> (defun dabbrev-expand-before-point (arg)
> (interactive "*p")
> (skip-chars-backward " \t\r\n\f")
> (dabbrev-expand arg)
> (unless (eq (preceding-char) ?\ )
> (insert " ")))
>
> Andreas Röhler
Hmmm, that does not work. Let me explain. The manual describes it as
"After you have expanded a dynamic abbrev, you can copy additional
words that follow the expansion in its original context. Simply type
<SPC> M-/ for each additional word you want to copy. The spacing and
punctuation between words is copied along with the words." For
example, put the point at the end of the string
"demonstration,of,dabbrevs,extend-word,feature. dem". Now press M-/.
The word 'dem' is now expanded to the word 'demonstration'. Now press
SPC and then M-/ again. Dabbev-expand now deletes the space you just
wrote and replace it with the next word. The result is
"demonstration,of". Press SPC and M-/ again and you get
"demonstration,of,dabbrevs" and so on. The pattern here is to press
M-/ SPC M-/ SPC M-/ SPC M-/ etc for each word you want to expand.
Now, instead of for example pressing M-/ SPC M-/ SPC M-/ (5 key
presses), I would instead like to just press something like M-/ F1 F1
(3 key presses). This of course requires that I bind a new function to
F1 that simply first insert a SPC and then call dabbrev-expand:
(defun complete-further (arg)
"Insert space and then call dabbrev-expand."
(interactive "*P")
(insert " ")
(dabbrev-expand arg))
but that doesn't work for some strange reason. In the example above
M-/ results in the correct 'demonstration'. The first press of F1 also
works and result in "demonstration,of" as expected. But the second
press of F1 that should result in 'demonstration,of,dabbrevs' totally
freaks out and produce a random result.
The function you provided doesn't work either unfortunately. Does
somebody know what's going on? Why isn't it equivalent to press SPC
M-/ and let a function inserts a SPC and then call dabbrev-expand?
/Stefan
next prev parent reply other threads:[~2007-09-14 12:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-13 19:51 dabbrev problem cons
2007-09-14 10:20 ` Andreas Röhler
[not found] ` <mailman.853.1189765115.18990.help-gnu-emacs@gnu.org>
2007-09-14 12:39 ` cons [this message]
2007-09-14 14:24 ` Andreas Röhler
[not found] ` <mailman.871.1189779748.18990.help-gnu-emacs@gnu.org>
2007-09-14 20:12 ` cons
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=1189773578.932094.215980@g4g2000hsf.googlegroups.com \
--to=consspam@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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).