emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] heading specific fast keys?


From: John Kitchin
Subject: Re: [O] heading specific fast keys?
Date: Wed, 21 Dec 2016 15:53:35 -0500
User-agent: mu4e 0.9.16; emacs 25.1.50.1

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-
>  > address@hidden On Behalf Of John Kitchin
>  > Sent: Wednesday, December 21, 2016 2:18 PM
>  > To: address@hidden
>  > 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 via email to

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