emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: "Cook, Malcolm" <MEC@stowers.org>
Cc: "'emacs-orgmode@gnu.org'" <emacs-orgmode@gnu.org>,
	'John Kitchin' <jkitchin@andrew.cmu.edu>
Subject: Re: heading specific fast keys?
Date: Wed, 21 Dec 2016 15:53:35 -0500	[thread overview]
Message-ID: <m2oa05ngvk.fsf@Johns-MacBook-Air.local> (raw)
In-Reply-To: <c033f744fcae4c3aafb9f4629a7f7c9a@exchsrv2.sgc.loc>

Thanks for the idea. It got me to read how org does it in the first
place ;)

Here is my solution at the moment. I just add a hook to
org-speed-command-hook, define special elfeed fast keys, and then when
on an ELFEED entry, get those first.

This is proof of concept code that works, and defaults to user then
default keys. What a great ecosystem org is!

Happy holidays everyone!

#+BEGIN_SRC emacs-lisp
(defun org-speed-elfeed (keys)
  (when (or (and (bolp) (looking-at org-outline-regexp)
		 (not (null (org-entry-get (point) "ELFEED")))) 
	    (and (functionp org-use-speed-commands)
		 (funcall org-use-speed-commands)))
    (cdr (assoc keys(append
		     org-speed-commands-elfeed
		     org-speed-commands-user
		     org-speed-commands-default)))))

(setq org-speed-commands-elfeed
      '(("b" . (lambda (&optional arg)
		 (save-excursion
		   (re-search-forward "Link: *")
		   (org-open-at-point-global))))))
      

(add-hook 'org-speed-command-hook 'org-speed-elfeed)
#+END_SRC

Cook, Malcolm writes:

>  > -----Original Message-----
>  > From: Emacs-orgmode [mailto:emacs-orgmode-
>  > bounces+mec=stowers.org@gnu.org] On Behalf Of John Kitchin
>  > Sent: Wednesday, December 21, 2016 2:18 PM
>  > To: emacs-orgmode@gnu.org
>  > Subject: [O] heading specific fast keys?
>  > 
>  > I wondered if anyone know a straight forward way to make
>  > heading-specific fast keys in org-mode.
>  > 
>  > The idea is if I am on a heading that is a "contact" (which means it has
>  > an EMAIL property), then there would be special hot keys for it, e.g.
>  > "e" would compose a message, "u" might open a URL if it had one, etc...
>  > 
>  > Or, on entries captured from elfeed, I could just press "b" to open the
>  > entry in a browser, etc...
>  > 
>  > I guess there would need to be some kind of hook that looks up a keymap
>  > or something on these special positions. And maybe a default map for
>  > non-special headings.
>  > 
>  > Thoughts?
>
> Possible synergy from one of the approaches to [MultipleModes](https://www.emacswiki.org/emacs?search=%22MultipleModes%22)
>
> I use polymode in org-mode to good effect within which switches mode with code blocks to be language specific.
>
> It might suggest an architecture....
>
>
>> 
>  > --
>  > Professor John Kitchin
>  > Doherty Hall A207F
>  > Department of Chemical Engineering
>  > Carnegie Mellon University
>  > Pittsburgh, PA 15213
>  > 412-268-7803
>  > @johnkitchin
>  > http://kitchingroup.cheme.cmu.edu


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

      reply	other threads:[~2016-12-21 20:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21 20:18 heading specific fast keys? John Kitchin
2016-12-21 20:27 ` Cook, Malcolm
2016-12-21 20:53   ` John Kitchin [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=m2oa05ngvk.fsf@Johns-MacBook-Air.local \
    --to=jkitchin@andrew.cmu.edu \
    --cc=MEC@stowers.org \
    --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).