Yep, I am also using org-mode with icicles. Made several mods to help with
that. I use icicles for searching headers or text content all the time.
 Interesting is the possibility to open a section (subtree) in an
independent buffer after finding it, with one command.  I enclose the code
here, plus the link to a gist containing the code.

Gist link: https://gist.github.com/iani/8695954
Gist name: org-icicles

Iannis Zannos


(add-hook 'org-mode-hook
          (lambda () (imenu-add-to-menubar "Imenu")))
(setq org-imenu-depth 3)

(defun org-icicle-occur ()
  "In org-mode, show entire buffer contents before running icicle-occur.
 Otherwise icicle-occur will not place cursor at found location,
 if the location is hidden."
  (interactive)
  (show-all)
  (icicle-occur (point-min) (point-max))
  (recenter 3))

(eval-after-load 'org
  '(define-key org-mode-map (kbd "C-c C-'") 'org-icicle-occur))
(eval-after-load 'org
  '(define-key org-mode-map (kbd "C-c i o") 'org-icicle-occur))
(defun org-icicle-imenu (separate-buffer)
  "In org-mode, show entire buffer contents before running icicle-imenu.
Otherwise icicle-occur will not place cursor at found location,
if the location is hidden.
If called with prefix argument (C-u), then:
- open the found section in an indirect buffer.
- go back to the position where the point was before the command, in the
  original buffer."
  (interactive "P")
  (show-all)
  (let ((mark (point)))
    (icicle-imenu (point-min) (point-max) t)
    (cond (separate-buffer
           (org-tree-to-indirect-buffer)
           (goto-char mark))
          (t (recenter 4)))))

(eval-after-load 'org
  '(define-key org-mode-map (kbd "C-c C-=") 'org-icicle-imenu))
(eval-after-load 'org
  '(define-key org-mode-map (kbd "C-c i m") 'org-icicle-imenu))

;; install alternative for org-mode C-c = org-table-eval-formula
;; which is stubbornly overwritten by icy-mode.
(eval-after-load 'org
  '(define-key org-mode-map (kbd "C-c C-x =") 'org-table-eval-formula))

;; this is a redundant second try for the above, to be removed after
testing:
(add-hook 'org-mode-hook
          (lambda ()
            (local-set-key (kbd "C-c M-=") 'org-table-eval-formula)))

;;; ???? Adapt org-mode to icicle menus when refiling (C-c C-w)
;;; Still problems. Cannot use standard org refiling with icicles activated!
(setq org-outline-path-complete-in-steps nil)

(add-hook 'org-mode-hook (lambda () (prelude-mode -1)))

(defun org-refile-icy (as-subtree &optional do-copy-p)
  "Alternative to org-refile using icicles.
Refile or copy current section, to a location in the file selected with
icicles.
Without prefix argument: Place the copied/cut section it *after* the
selected section.
With prefix argument: Make the copied/cut section *a subtree* of the
selected section.

Note 1: If quit with C-g, this function will have removed the section that
is to be refiled.  To get it back, one has to undo, or paste.

Note 2: Reason for this function is that icicles seems to break org-modes
headline
buffer display, so onehas to use icicles for all headline navigation if it
is loaded."
  (interactive "P")
  (outline-back-to-heading)
  (if do-copy-p (org-copy-subtree) (org-cut-subtree))
  (show-all)
  (icicle-imenu (point-min) (point-max) t)
  (outline-next-heading)
  (unless (eq (current-column) 0) (insert "\n"))
  (org-paste-subtree)
  (if as-subtree (org-demote-subtree)))

(defun org-copy-icy (as-subtree)
  "Copy section to another location in file, selecting the location with
icicles.
See org-refile-icy."
  (interactive "P")
  (org-refile-icy as-subtree t))

(eval-after-load 'org
  '(define-key org-mode-map (kbd "C-c i r") 'org-refile-icy))
(eval-after-load 'org
  '(define-key org-mode-map (kbd "C-c i c") 'org-copy-icy))





On Wed, Jan 29, 2014 at 9:48 PM, Thomas S. Dye <t...@tsdye.com> wrote:

>
>
> Aloha Bastien,
>
> Bastien <b...@gnu.org> writes:
>
> > Hi Thomas,
> >
> > t...@tsdye.com (Thomas S. Dye) writes:
> >
> >> Also, this is my first time trying to decode a syntax table, so caveat
> >> emptor.
> >
> > Yes -- when doing C-u C-x on { in fundamental-mode I read
> >
> > Character code properties: customize what to show
> >   name: LEFT CURLY BRACKET
> >   old-name: OPENING CURLY BRACKET
> >   general-category: Ps (Punctuation, Open)
> >                         ^^^^^^^^^^^
> >
> > and this is the same in org-mode, as org-mode does not modify the
> > syntax of this character.
> >
> > So I think `{' is generally a considered a "punctuation" character
> > (compare it to the `*' char, which also falls into two categories,
> > "punctuation" and "other".)
>
> Then "punctuation" has two senses, one generic and another specific. To
> my mind, the emacs guideline is ambiguous unless there is some
> convention about which sense is meant in this case.  I guess it would be
> possible to look at the code to figure this out, but I'm not well
> equipped to do that.
>
> All the best,
> Tom
>
> --
> Thomas S. Dye
> http://www.tsdye.com
>
>
>

Reply via email to