emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Hendy <jw.hendy@gmail.com>
To: Oleh <ohwoeowho@gmail.com>
Cc: org mode <emacs-orgmode@gnu.org>
Subject: Re: Navigating org-mode customization file
Date: Sun, 12 Jan 2014 16:48:20 -0600	[thread overview]
Message-ID: <CA+M2ft_-SBpOOgxmordPA4z6zMxkgDkkc21T3SUPTv1vBHZvgA@mail.gmail.com> (raw)
In-Reply-To: <CAA01p3phYJVeaKCeCYLe5XfUQkNAFKftz3vw0JExoz84PMJMfg@mail.gmail.com>

On Sun, Jan 12, 2014 at 11:42 AM, Oleh <ohwoeowho@gmail.com> wrote:
> Hi all,
>
> I'd like to share a small hack that might be useful for people that edit their
> org config a lot. Mine is more than 500 lines.
> A great way to jump about a source file is `helm-semantic'.
> But it only allows to jump to function and variable definition within
> current file.
> My org file is full of `setq' statements which it doesn't see.
>
> For instance, today I wanted to navigate to `org-capture-templates'.
> isearch with "cap" entered gives me 15 positions, 14 of them false.
> The new function that I wrote, `lispy-goto',
> gives 2 results: (setq org-capture-templates...) and (require 'org-capture).
> It uses semantic - a built-in package and helm - a popular completion package.
>
> Another example, `lispy-goto' with "loca" instead of 11 candidates of isearch
> gives (setq org-archive-location...) and (setq system-time-locale...).
>
> Anyway, maybe it's useful for at least one more person other than me.
> The code is at https://github.com/abo-abo/lispy, as well as "lispy" in MELPA.
> It's not necessary to enable `lispy-mode' to call `lispy-goto' with M-x.
> However, if it's enabled, the shortcut is "g" when point is positioned
> before "(" or after ")" in the code.
>

Thanks for sharing, and sounds quite interesting. Just wanted to
mention the concept of storing .emacs inside a .org file in case you
aren't aware of it (you very well may be). I had a tough time finding
an official org or Worg page documenting this, but here's an example
from Sacha Chua:
- Blog about it:
http://sachachua.com/blog/2012/06/literate-programming-emacs-configuration-file/

- An example of the actual file:
http://dl.dropboxusercontent.com/u/3968124/sacha-emacs.org

I've been doing this and love it. My actual .emacs only does the following:

#+begin_src .emacs

;; set load paths
;; set load dirs and global config options
(add-to-list 'load-path "~/.elisp/org.git/lisp/")
(add-to-list 'load-path "~/.elisp/org.git/contrib/lisp/")
;; other load paths

;; setup babel languages
(org-babel-do-load-languages
 'org-babel-load-languages
 '((latex . t)
   (emacs-lisp . t)
   (org . t)
   (R . t)
   (sh . t)
   (python . t )))


;; load org-based config
(org-babel-load-file "~/org/aux/emacs-config.org")

;; stuff created by using M-x customize is at the bottom:
custom-set-variables/faces.

#+end_src

Then, in ~/org/aux/emacs-config.org, I have headlines which break down
the customization into grouped chunks. For example, a block for
org-mode shotcut options:

#+begin_src emacs-config.org

* Window options

Sets size/position of emacs when it starts...

* Org-mode options
Org-specific keyboard shorcuts

#+begin_src emacs-lisp
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
#+end_src

* Keyboard shortcuts
* Fill options
* Sunrise commander
* Misc
* Encryption

#+end_src

Obviously there's a lot more than that, but there's an example of how
one can group/arrange options by headlines so that you don't have to
search around lines and lines of nebulous code blobs to find the line
you're looking for.

Anyway, just wanted to share this in case others on the list are
unaware and would find it useful. I imagine it could even be used in
conjunction with your development as well? Both literate config files
*and* a search method that recognizes config-specific text vs. finding
every single match?


Best regards,
John

> regards,
> Oleh
>

      reply	other threads:[~2014-01-12 22:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-12 17:42 Navigating org-mode customization file Oleh
2014-01-12 22:48 ` John Hendy [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=CA+M2ft_-SBpOOgxmordPA4z6zMxkgDkkc21T3SUPTv1vBHZvgA@mail.gmail.com \
    --to=jw.hendy@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=ohwoeowho@gmail.com \
    /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).