unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* abbrev-mode wizardry needed
@ 2006-04-18 22:45 dmd@3e.org
  2006-04-19  1:38 ` dmd@3e.org
  2006-04-21  2:38 ` dmd@3e.org
  0 siblings, 2 replies; 8+ messages in thread
From: dmd@3e.org @ 2006-04-18 22:45 UTC (permalink / raw)


I have a huge list of unique identifiers. A person needs to enter, for
each one of those identifiers, a list of tags, and I'd like to make it
easy for them to tab-complete those tags, based on the ones they've
already entered (NOT based on an external list! They will be defining
the tags as they go.)

For example:

CAT	 mammal, animal, has-whiskers, has-fur, enjoys-petting

I want to make it really easy for them to enter those properties. When
they start, no properties will have been defined yet. Each time they
enter a new one, a new property gets defined.

So, after hitting return after typing 'enjoys-petting', their cursor
will be after

DOG

I'd like them to be able to type 'm', and have some sort of way to see
the "mammal" completion on the screen somewhere, and hitting tab or
somesuch should accept the completion. If they typed 'h', they should
see both 'has-whiskers' and 'has-fur'; hitting tab should complete it
up to 'has-'; if they then type 'f', the completion list should dwindle
to 'has-fur', and ... you get the idea.

If they /delete/ a tag (so it no longer appears anywhere in the
document), it should no longer be autocompleted. (This is not a
requirement, but it would be nice.)

Can emacs/abbrev-mode do this? This is essentially equivalent to what
Excel does when you enter items in a single column, but I'd really
rather not do this in Excel for various reasons.

Thanks for any help people can provide...

Daniel Drucker

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

* Re: abbrev-mode wizardry needed
  2006-04-18 22:45 abbrev-mode wizardry needed dmd@3e.org
@ 2006-04-19  1:38 ` dmd@3e.org
  2006-04-19 16:08   ` Mathias Dahl
                     ` (2 more replies)
  2006-04-21  2:38 ` dmd@3e.org
  1 sibling, 3 replies; 8+ messages in thread
From: dmd@3e.org @ 2006-04-19  1:38 UTC (permalink / raw)


Answering my own question:

(global-set-key (kbd "TAB") 'dabbrev-completion)


I can't seem to figure out how to get RET to go to the end of the next
line rather than to insert a new line, though.

I tried this:

(defun end-of-next-line ()
  (interactive)
  (next-line)
  (end-of-line))

But that doesn't seem to work.

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

* Re: abbrev-mode wizardry needed
  2006-04-19  1:38 ` dmd@3e.org
@ 2006-04-19 16:08   ` Mathias Dahl
  2006-04-19 20:16     ` dmd@3e.org
  2006-04-19 16:19   ` Kevin Rodgers
       [not found]   ` <mailman.584.1145463682.9609.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 8+ messages in thread
From: Mathias Dahl @ 2006-04-19 16:08 UTC (permalink / raw)


"dmd@3e.org" <ddruckerccn@gmail.com> writes:

> I can't seem to figure out how to get RET to go to the end of the next
> line rather than to insert a new line, though.
>
> I tried this:
>
> (defun end-of-next-line ()
>   (interactive)
>   (next-line)
>   (end-of-line))
>
> But that doesn't seem to work.

No? Did you bind a key to it? How? If I have this:

row1
row2

and have point after "1" and do M-x end-of-next-line RET, the point is
nicely placed after "2".

This binding worked for me:

(local-set-key [return] 'end-of-next-line)

/Mathias

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

* Re: abbrev-mode wizardry needed
  2006-04-19  1:38 ` dmd@3e.org
  2006-04-19 16:08   ` Mathias Dahl
@ 2006-04-19 16:19   ` Kevin Rodgers
       [not found]   ` <mailman.584.1145463682.9609.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Kevin Rodgers @ 2006-04-19 16:19 UTC (permalink / raw)


dmd@3e.org wrote:
> I can't seem to figure out how to get RET to go to the end of the next
> line rather than to insert a new line, though.
> 
> I tried this:
> 
> (defun end-of-next-line ()
>   (interactive)
>   (next-line)
>   (end-of-line))
> 
> But that doesn't seem to work.

next-line has a required argument, and should not be called from Lisp
(read its doc string).

Also, how did you bind that command to RET?

-- 
Kevin Rodgers

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

* Re: abbrev-mode wizardry needed
  2006-04-19 16:08   ` Mathias Dahl
@ 2006-04-19 20:16     ` dmd@3e.org
  0 siblings, 0 replies; 8+ messages in thread
From: dmd@3e.org @ 2006-04-19 20:16 UTC (permalink / raw)


That doesn't work for me at all.

If I have nothing at all in my .emacs file except this:

(defun end-of-next-line ()
  (interactive)
  (next-line)
  (end-of-line))

And then I open up a file containing this:

row1
row2

And I have point after '1' and do M-x end-of-next-line RET

The following appears in the minibuffer:

-
Wrong number of arguments: #[(arg) "^H\203&^@
ÃU\203&^@\212Ä^?\210m)\203^_^@Ä\
^ZÄ^?\210Åc\210)\2026^@Æ !\210\2026^@t\2032^@ÄÇÈ\217\210\2026^@Æ
!\210Ä\207" [n\
ext-line-add-newlines arg abbrev-mode 1 nil "
" line-move (line-move arg) (((beginning-of-buffer end-of-buffer)
(ding)))] 3 1\
343309 "p"], 0

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

* Re: abbrev-mode wizardry needed
       [not found]   ` <mailman.584.1145463682.9609.help-gnu-emacs@gnu.org>
@ 2006-04-19 20:20     ` dmd@3e.org
  0 siblings, 0 replies; 8+ messages in thread
From: dmd@3e.org @ 2006-04-19 20:20 UTC (permalink / raw)


A hah! Changing next-line to forward-line does the trick.

Thanks!

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

* Re: abbrev-mode wizardry needed
  2006-04-18 22:45 abbrev-mode wizardry needed dmd@3e.org
  2006-04-19  1:38 ` dmd@3e.org
@ 2006-04-21  2:38 ` dmd@3e.org
  2006-04-21 21:43   ` Kevin Rodgers
  1 sibling, 1 reply; 8+ messages in thread
From: dmd@3e.org @ 2006-04-21  2:38 UTC (permalink / raw)


One more thing... I'm trying to avoid having the existing text in the
file (e.g., CAT and DOG) interfere with the namespace of the new text
we're entering.  I'd like to separate the newly entered symbols by
prefixing them with some easily typed character like ';'. It's not
working - dabbrev-completion doesn't seem to recognize any sort of
punctuation as part of a symbol.

Our current workaround is to enter the to-be-dabbrev'd tags as z-TAG
instead of ;TAG, but that's slightly more ugly.

Is there a way to hack dabbrev-completion to recognize ';' as part of a
symbol?

Daniel Drucker

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

* Re: abbrev-mode wizardry needed
  2006-04-21  2:38 ` dmd@3e.org
@ 2006-04-21 21:43   ` Kevin Rodgers
  0 siblings, 0 replies; 8+ messages in thread
From: Kevin Rodgers @ 2006-04-21 21:43 UTC (permalink / raw)


dmd@3e.org wrote:
> One more thing... I'm trying to avoid having the existing text in the
> file (e.g., CAT and DOG) interfere with the namespace of the new text
> we're entering.  I'd like to separate the newly entered symbols by
> prefixing them with some easily typed character like ';'. It's not
> working - dabbrev-completion doesn't seem to recognize any sort of
> punctuation as part of a symbol.
> 
> Our current workaround is to enter the to-be-dabbrev'd tags as z-TAG
> instead of ;TAG, but that's slightly more ugly.
> 
> Is there a way to hack dabbrev-completion to recognize ';' as part of a
> symbol?

Try setting a buffer-local value of dabbrev-abbrev-char-regexp that
allows punctuation as the first character: `\s.'

-- 
Kevin Rodgers
Sr. Software Engineer, IHS

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

end of thread, other threads:[~2006-04-21 21:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-18 22:45 abbrev-mode wizardry needed dmd@3e.org
2006-04-19  1:38 ` dmd@3e.org
2006-04-19 16:08   ` Mathias Dahl
2006-04-19 20:16     ` dmd@3e.org
2006-04-19 16:19   ` Kevin Rodgers
     [not found]   ` <mailman.584.1145463682.9609.help-gnu-emacs@gnu.org>
2006-04-19 20:20     ` dmd@3e.org
2006-04-21  2:38 ` dmd@3e.org
2006-04-21 21:43   ` Kevin Rodgers

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