emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Iannis Zannos <zannos@gmail.com>
To: "Thomas S. Dye" <tsd@tsdye.com>,
	ML Emacs-orgmode <emacs-orgmode@gnu.org>
Cc: Bastien <bzg@gnu.org>,
	public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org,
	Sebastien Vauban
	<public-sva-news-D0wtAvR13HarG/iDocfnWg@plane.gmane.org>
Subject: Re: org-mode + icicles, avoid key binding redefinitions?
Date: Wed, 29 Jan 2014 22:11:27 +0200	[thread overview]
Message-ID: <CAEC5JkLmm5DS=A4iBV6wK3Gj4a-_s2WrfmzNgfUDKyYe05Z8mg@mail.gmail.com> (raw)
In-Reply-To: <m1fvo61se3.fsf@tsdye.com>

[-- Attachment #1: Type: text/plain, Size: 4974 bytes --]

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 <tsd@tsdye.com> wrote:

>
>
> Aloha Bastien,
>
> Bastien <bzg@gnu.org> writes:
>
> > Hi Thomas,
> >
> > tsd@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
>
>
>

[-- Attachment #2: Type: text/html, Size: 7182 bytes --]

  reply	other threads:[~2014-01-29 20:11 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-23  4:45 org-mode + icicles, avoid key binding redefinitions? Drew Adams
2014-01-23  7:43 ` Bastien
2014-01-23 15:33   ` Drew Adams
2014-01-23 15:46     ` Bastien
2014-01-23 16:28       ` Drew Adams
2014-01-23 16:34         ` Bastien
2014-01-23 17:01           ` Drew Adams
2014-01-23 22:24             ` Bastien
2014-01-23 22:56               ` Drew Adams
2014-01-23 23:29               ` Thomas S. Dye
2014-01-24  8:39                 ` Bastien
2014-01-25  7:34                   ` Thomas S. Dye
2014-01-28  9:08                     ` Bastien
2014-01-29  8:43                       ` Sebastien Vauban
2014-01-29  9:39                         ` Bastien
2014-01-29 10:35                           ` Sebastien Vauban
2014-01-29 11:00                             ` Bastien
2014-01-29 11:32                               ` Sebastien Vauban
2014-01-29 17:34                         ` Thomas S. Dye
2014-01-29 17:48                           ` Bastien
2014-01-29 19:48                             ` Thomas S. Dye
2014-01-29 20:11                               ` Iannis Zannos [this message]
2014-01-30  0:39                               ` Bastien
2014-01-29 11:44                       ` Florian Beck
2014-01-29 13:16                         ` Nick Dokos
2014-01-29 13:52                           ` Bastien
2014-01-29 18:01                             ` Achim Gratz
2014-01-29 20:06                             ` Andreas Leha
2014-01-29 20:13                               ` Iannis Zannos
2014-01-29 14:43                           ` Florian Beck
2014-01-29 15:40                             ` Bastien
2014-01-29 16:20                               ` Nicolas Goaziou
2014-01-23 13:57 ` Alan Schmitt
2014-01-23 15:33   ` Drew Adams
  -- strict thread matches above, loose matches on Subject: below --
2014-01-18 19:49 John Kitchin
2014-01-18 21:40 ` Alan Schmitt
2014-01-19 15:53 ` Bastien
2014-01-19 17:31 ` Memnon Anon
2014-01-19 20:56   ` John Kitchin
2014-01-20  2:34     ` Memnon Anon
2014-01-20 23:12       ` Alan Schmitt

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='CAEC5JkLmm5DS=A4iBV6wK3Gj4a-_s2WrfmzNgfUDKyYe05Z8mg@mail.gmail.com' \
    --to=zannos@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org \
    --cc=public-sva-news-D0wtAvR13HarG/iDocfnWg@plane.gmane.org \
    --cc=tsd@tsdye.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).