unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Saving and recalling registers, using the same key sequence ?
@ 2019-03-20 17:44 jonetsu
  2019-03-20 19:23 ` Óscar Fuentes
  0 siblings, 1 reply; 3+ messages in thread
From: jonetsu @ 2019-03-20 17:44 UTC (permalink / raw)
  To: help-gnu-emacs

Is it possible to save a text register and use it in the exact same way
at a later time ?  

For instance, I define very simple useful things that I recall by doing:

C-x r i i  ;; inserts : #include <>
C-x r i u  ;; inserts : using std::;
C-x r i n  ;; inserts : << '\n';

I would like to have these always ready when editing C++ code.  They
could be globally defined, or bound to the editing of C++ files, I
wouldn't mind.

Thanks.





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

* Re: Saving and recalling registers, using the same key sequence ?
  2019-03-20 17:44 Saving and recalling registers, using the same key sequence ? jonetsu
@ 2019-03-20 19:23 ` Óscar Fuentes
  2019-03-21 14:20   ` jonetsu
  0 siblings, 1 reply; 3+ messages in thread
From: Óscar Fuentes @ 2019-03-20 19:23 UTC (permalink / raw)
  To: jonetsu; +Cc: help-gnu-emacs

jonetsu <jonetsu@teksavvy.com> writes:

> Is it possible to save a text register and use it in the exact same way
> at a later time ?  
>
> For instance, I define very simple useful things that I recall by doing:
>
> C-x r i i  ;; inserts : #include <>
> C-x r i u  ;; inserts : using std::;
> C-x r i n  ;; inserts : << '\n';
>
> I would like to have these always ready when editing C++ code.  They
> could be globally defined, or bound to the editing of C++ files, I
> wouldn't mind.

You can use `set-register' to set your registers programatically in your
.emacs file:

(set-register ?i "#include <>")

IMO abbrevs are a better choice for what you want. See `Abbrevs' in the
Emacs manual.

Depending on your specific needs and preferences, the Yasnippet package
can be even better.



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

* Re: Saving and recalling registers, using the same key sequence ?
  2019-03-20 19:23 ` Óscar Fuentes
@ 2019-03-21 14:20   ` jonetsu
  0 siblings, 0 replies; 3+ messages in thread
From: jonetsu @ 2019-03-21 14:20 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 20 Mar 2019 20:23:52 +0100
Óscar Fuentes <ofv@wanadoo.es> wrote:

> You can use `set-register' to set your registers programatically in
> your .emacs file:
> 
> (set-register ?i "#include <>")
> 
> IMO abbrevs are a better choice for what you want. See `Abbrevs' in
> the Emacs manual.
> 
> Depending on your specific needs and preferences, the Yasnippet
> package can be even better.

Thanks ! Much appreciated.

Cheers.



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

end of thread, other threads:[~2019-03-21 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-20 17:44 Saving and recalling registers, using the same key sequence ? jonetsu
2019-03-20 19:23 ` Óscar Fuentes
2019-03-21 14:20   ` jonetsu

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