From: Masatake YAMATO <yamato@redhat.com>
To: larsi@gnus.org
Cc: emacs-devel@gnu.org
Subject: Re: "Snippet" database
Date: Sat, 07 Jan 2012 06:49:34 +0900 (JST) [thread overview]
Message-ID: <20120107.064934.590252325830536875.yamato@redhat.com> (raw)
In-Reply-To: <20120107.041328.2292730043452883798.yamato@redhat.com>
I wrote:
>> In my various guises I find myself sending out the same rote email
>> answer to many people. "Thanks for the patch; applied" and stuff. It
>> would be nice if one could just mark the region, ask Emacs to pull it
>> into a database of snippets, and then have a command that would insert
>> them again.
>>
>> Surely something like this already exists in Emacs, but I just can't
>> seem to find it. Probably looking for the wrong thing...
>>
>> --
>> (domestic pets only, the antidote for overdose, milk.)
>> bloggy blog http://lars.ingebrigtsen.no/
>>
>>
>
> It may be nice if the "Snippet" database feature is integrated
> to abbrev, register, and bookmark machinery.
>
> Masatake
>
Here is the prototype of bookmark based snippet manager.
Usage:
1. Set the region which you want to record as snippet
2. Do M-x snippet:region->bookmark
3. Do \C-x r l
4. Do [return] on the line where the snippet
5. Switch the buffer
6. \C-y
(require 'bookmark)
(defun snippet:region->bookmark ()
(interactive)
(lexical-let ((snippet (buffer-substring (region-beginning) (region-end))))
(let ((bookmark-make-record-function (lambda ()
`((page . ,snippet)
(handler . snippet:bookmark->kill-ring)))))
(bookmark-set (car (split-string snippet "[\n]"))))))
(defun snippet:bookmark->kill-ring (record)
(kill-new (cdr (assoc 'page record))))
Masatake
next prev parent reply other threads:[~2012-01-06 21:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-06 18:47 "Snippet" database Lars Magne Ingebrigtsen
2012-01-06 19:08 ` Drew Adams
2012-01-06 19:13 ` Masatake YAMATO
2012-01-06 21:49 ` Masatake YAMATO [this message]
2012-01-06 22:04 ` Lars Magne Ingebrigtsen
2012-01-06 22:17 ` Lennart Borgman
2012-01-06 22:33 ` Tassilo Horn
2012-01-06 19:56 ` Richard Riley
2012-01-06 20:16 ` Ted Zlatanov
2012-01-06 20:45 ` Eli Zaretskii
2012-01-06 21:07 ` Ted Zlatanov
2012-01-06 21:10 ` Lars Magne Ingebrigtsen
2012-01-09 6:02 ` Drew Adams
2012-01-07 3:06 ` John Wiegley
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120107.064934.590252325830536875.yamato@redhat.com \
--to=yamato@redhat.com \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.