[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: idea for capture anywhere in x
From: |
Russell Adams |
Subject: |
Re: idea for capture anywhere in x |
Date: |
Wed, 9 Sep 2020 10:40:02 +0200 |
On Mon, Sep 07, 2020 at 10:05:38PM -0700, Samuel Wales wrote:
> well for a non-emacs application, i want to select text and capture
> using wm menu.
I routinely capture programming and UNIX history. I select text (X11
clipboard), and then I have a skel/abbrev to insert it into Emacs. I
type "pexa<space>" and it creates an example source block and pastes
the clipboard into it with proper indentation. "pexa" stands for
"paste example".
This is *so* fast compared to creating a new source block (C-c C-, e),
then entering it (C-c C-'), pasting (C-y), and then exiting (C-c C-').
;; Org mode skeletons instead of yasnippet
(define-skeleton rla-paste-example
"Insert an Org-mode example source block and paste the clipboard into it." nil
"#+BEGIN_EXAMPLE\n"
;; indent to match the src block
(concat " " (replace-regexp-in-string "\n" "\n " (replace-regexp-in-string
"\n$" "" (current-kill 0)))) "\n"
"#+END_EXAMPLE\n"
"\n"
-)
(define-abbrev-table 'org-mode-abbrev-table '(("pexa" "" rla-paste-example 0)))
Mind you this is in the current buffer I'm typing in. If I wanted to
add from the CLI, I'd use a capture template with a predefined
location and make sure it includes the clipboard in expansion.
As some of the other replies have shown, triggering capture externally
isn't too hard. You'll just need to figure out the WM hook.
------------------------------------------------------------------
Russell Adams RLAdams@AdamsInfoServ.com
PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/
Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3
- Re: idea for capture anywhere in x, (continued)
- Re: idea for capture anywhere in x, Maxim Nikulin, 2020/09/08
- Re: idea for capture anywhere in x, Samuel Wales, 2020/09/08
- Re: idea for capture anywhere in x, Maxim Nikulin, 2020/09/09
- Re: idea for capture anywhere in x, Maxim Nikulin, 2020/09/10
- Re: idea for capture anywhere in x, Nick Econopouly, 2020/09/12
- Re: idea for capture anywhere in x,
Russell Adams <=
- Re: idea for capture anywhere in x, Samuel Wales, 2020/09/09
Re: idea for capture anywhere in x, Ihor Radchenko, 2020/09/08
Re: idea for capture anywhere in x, No Wayman, 2020/09/08