emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [ANN] org-link-edit.el --- Slurp and barf with Org links


From: Kyle Meyer
Subject: [O] [ANN] org-link-edit.el --- Slurp and barf with Org links
Date: Wed, 18 Feb 2015 01:07:17 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]