emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] A simple way to search only headlines


From: Richard Lawrence
Subject: Re: [O] A simple way to search only headlines
Date: Fri, 07 Jun 2013 14:50:48 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

Xebar Saram <address@hidden> writes:

> Thank you both Thorsten and Seb, i really appreciate the help!
>
> Seb, you wrote: The programming equivalent to C-c a s is:
>
>     (org-agenda nil "s")
>
> That's what you'd have to bind to a key (using a "lambda" function).
>
> im a complete neewb and dont really have any idea on how to do the above,
> can you show me an example?

I think you're looking for something like:

(define-key org-mode-map (kbd "C-M-h") (lambda () (org-agenda nil "s" "<")))

You could put a line like that in your .emacs.  Here's what it does:
#+BEGIN_SRC emacs-lisp
(define-key    ;; insert a new keybinding
  org-mode-map ;; into the Org mode map (so this won't affect bindings in 
non-Org buffers)

  ;; This is the key we're binding: C-M-h, for "headline" search
  ;; You can use whatever key you like, but you might want to check first that 
it isn't
  ;; already bound to something else (e.g., via C-h k from an Org buffer).
  ;; The kbd macro converts a string representation to the appropriate key code.
  (kbd "C-M-h")
  
  ;; This is the function to run when the key is pressed.  The lambda
  ;; form creates an anonymous function which calls org-agenda with
  ;; the "s" argument and a restriction to current buffer.
  (lambda () (org-agenda nil "s" "<")))
#+END_SRC

Best,
Richard




reply via email to

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