emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Russell Adams <RLAdams@AdamsInfoServ.Com>
To: emacs-orgmode@gnu.org
Subject: Re: idea for capture anywhere in x
Date: Wed, 9 Sep 2020 10:40:02 +0200	[thread overview]
Message-ID: <20200909084002.GE1036@maokai> (raw)
In-Reply-To: <CAJcAo8sb3Wtqpo3+fhBKPZchsyeWZ9A3Ox9tOH_4CdxUg8za+Q@mail.gmail.com>

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
  ;; indent to match the src block
  (concat "  " (replace-regexp-in-string "\n" "\n  " (replace-regexp-in-string "\n$" "" (current-kill 0)))) "\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

  parent reply	other threads:[~2020-09-09  8:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08  4:22 Samuel Wales
2020-09-08  5:01 ` Tim Cross
2020-09-08  5:05   ` Samuel Wales
2020-09-08  5:21     ` Tim Cross
2020-09-08  7:18       ` Maxim Nikulin
2020-09-08  8:03         ` Diego Zamboni
2020-09-08 16:08           ` Maxim Nikulin
2020-09-08  5:39     ` Maxim Nikulin
2020-09-08 22:40       ` Samuel Wales
2020-09-09  4:52         ` Maxim Nikulin
2020-09-10 14:23           ` Maxim Nikulin
2020-09-12  8:48             ` Nick Econopouly
2020-09-09  8:40     ` Russell Adams [this message]
2020-09-09 21:11       ` Samuel Wales
2020-09-09  1:07 ` Ihor Radchenko
     [not found] <mailman.51.1599580808.12104.emacs-orgmode@gnu.org>
2020-09-08 23:15 ` No Wayman
2020-09-13 20:29   ` Bastien

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:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200909084002.GE1036@maokai \
    --to=rladams@adamsinfoserv.com \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: idea for capture anywhere in x' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:


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