Xebar Saram <zelt...@gmail.com> 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