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

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

About abbrevs and spaces at end of line


From: Harry Putnam
Subject: About abbrevs and spaces at end of line
Date: Mon, 09 Dec 2013 16:46:53 -0500
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.0.92 (gnu/linux)

Is there some smooth way to avoid having a space at the end of line
when activating an abbrev as the last thing done before newline?

For example:  I have `tru' (in Cperl abbrev table) set like so
tru   "\"TRUE\";"

Which enters "TRUE";<spc> (If I invoked it with the space bar)

I can avoid it by using an <ENTER> using the RET bar and leaving a
newline.

But when editing perl code, I often am working between {} where a
stray newline will leave an unsightly empty line in a clump of code.

Using the space bar to invoke (when in cperl-mode and many other
modes) leaves my code with what appears to be underscores (_) showing
where the spc is.

I'm not real sure where they come from.  They are not really
underscores, but markers left by the editor(?) that do not appear if
you print it (I guess).  Any way, that is another matter for a
different thread.

The short and long is: Invoking with spc leaves unsightly marks like
an underscore if done at the end of a line and invoking with <RET> is
not always desirable if a new line is not needed.

Before I tangle myself up any further.... I'd like to know if there is
a smooth way to create an abbrev that somehow avoids leaving that spc
that was used to invoke it.  Somehow backing the cursor up 1 space
after invocation or the like.

I can do it by creating an elisp 'skeleton' that does the job by using
the proper code to control where the cursor lands, and then associating
that 'skeleton' to my 'tru' abbrev in the cperl-table.  Yes. that
works, but requires a fair bit of typing to create.

I'd need to edit .emacs to type out the 'skeleton' (or some other
sourced file) and then the abbrev table to type out the linked abbrev.

-------        ---------       ---=---       ---------      -------- 

I have visions of some tricky way of setting up an abbrev with hardly
any more effort than the normal

   M-x edit-abbrevs <RET>

   "tru"       0          "\"TRUE\";"

In the cperl-table, then pressing C-c

Where I only need to edit the cperl abbrev table.
 




reply via email to

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