emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Org-mode <emacs-orgmode@gnu.org>
Subject: [ANN] org-link-edit.el --- Slurp and barf with Org links
Date: Wed, 18 Feb 2015 01:07:17 -0500	[thread overview]
Message-ID: <87lhjvkb1m.fsf@kmlap.domain.org> (raw)

Hello,

When working with links in Org documents, I noticed that I often kill
surrounding text to bring it into the description, or vice versa.  At
some point, this made me think that it'd be nice to be able to add and
remove description words like Paredit lets you do with S-expressions.
I've put these Paredit-inspired slurping and barfing commands for Org
link descriptions in org-link-edit.el [1], in case others find them
useful.  Below is an example for each command.

- org-link-edit-forward-slurp

  The [[http://orgmode.org/][Org mode]] site
                        |
                        v
  The [[http://orgmode.org/][Org mode site]]

- org-link-edit-backward-slurp

  The [[http://orgmode.org/][Org mode]] site
                        |
                        v
  [[http://orgmode.org/][The Org mode]] site

- org-link-edit-forward-barf

  The [[http://orgmode.org/][Org mode]] site
                        |
                        v
  The [[http://orgmode.org/][Org]] mode site

- org-link-edit-backward-barf

  The [[http://orgmode.org/][Org mode]] site
                        |
                        v
  The Org [[http://orgmode.org/][mode]] site

As I mention in the package commentary, I think this works well with
Oleh Krehel's excellent Hydra [2] because it allows you to repeat any of
these commands with a single key after the initial key sequence to
invoke the popup.

    (define-key org-mode-map YOUR-KEY
      (defhydra hydra-org-link-edit ()
        "Org Link Edit"
        ("j" org-link-edit-forward-slurp "forward slurp")
        ("k" org-link-edit-forward-barf "forward barf")
        ("u" org-link-edit-backward-slurp "backward slurp")
        ("i" org-link-edit-backward-barf "backward barf")
        ("q" nil "cancel")))


[1]: https://github.com/kyleam/org-link-edit/blob/master/org-link-edit.el
[2]: https://github.com/abo-abo/hydra

--
Kyle

             reply	other threads:[~2015-02-18  6:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-18  6:07 Kyle Meyer [this message]
2015-02-18 10:42 ` [ANN] org-link-edit.el --- Slurp and barf with Org links Rasmus
2015-02-19  5:24   ` Kyle Meyer
2015-02-19 14:26     ` Suvayu Ali
2015-08-05  0:00   ` Bastien Guerry
2015-08-05  6:24     ` Nicolas Goaziou
2015-08-05  7:14       ` Bastien Guerry
2015-08-05  7:45         ` Thomas S. Dye
2015-08-05 11:34           ` Bastien Guerry
2015-08-13  5:55         ` Kyle Meyer
2015-02-22  2:21 ` Thomas S. Dye

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://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87lhjvkb1m.fsf@kmlap.domain.org \
    --to=kyle@kyleam.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
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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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