From: Kaushal Modi <kaushal.modi@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: org-table-mark-field
Date: Sat, 14 May 2016 07:10:20 +0000 [thread overview]
Message-ID: <CAFyQvY2q+ww8J=ed9LJMT_kNCRir67vsy31gAWnz8LLPcj0LoQ@mail.gmail.com> (raw)
In-Reply-To: <CAFyQvY1EdsG9Wk0bNo2FFvamEGGiaiAGwugoKK9KHK9uObo0kA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1219 bytes --]
The solution was unnecessarily over-complicated.
Below one seems simpler and more intuitive. It requires the hydra package.
(defun org-table-mark-field ()
"Mark the current table field."
(interactive)
;; Do not try to jump to the beginning of field if the point is already
there
(when (not (looking-back "|\\s-?"))
(org-table-beginning-of-field 1))
(set-mark-command nil)
(org-table-end-of-field 1))
(defhydra hydra-org-table-mark-field
(:body-pre (org-table-mark-field)
:color pink
:hint nil)
"
^^ _p_ ^^
_b_ selection _f_ | org table mark ▯field▮ |
^^ _n_ ^^
"
("x" exchange-point-and-mark "exchange point/mark")
("f" (lambda (arg)
(interactive "p")
(when (eq 1 arg)
(setq arg 2))
(org-table-end-of-field arg)))
("b" (lambda (arg)
(interactive "p")
(when (eq 1 arg)
(setq arg 2))
(org-table-beginning-of-field arg)))
("n" next-line)
("p" previous-line)
("q" nil "cancel" :color blue))
(bind-keys
:map org-mode-map
:filter (org-at-table-p)
("S-SPC" . hydra-org-table-mark-field/body))
--
--
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 1988 bytes --]
prev parent reply other threads:[~2016-05-14 7:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-13 23:15 org-table-mark-field Kaushal Modi
2016-05-13 23:38 ` org-table-mark-field Kaushal Modi
2016-05-14 7:10 ` Kaushal Modi [this message]
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='CAFyQvY2q+ww8J=ed9LJMT_kNCRir67vsy31gAWnz8LLPcj0LoQ@mail.gmail.com' \
--to=kaushal.modi@gmail.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).