Org-mode mailing list
 help / color / mirror / 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
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
  "#+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


  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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://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 \
    /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

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git