From mboxrd@z Thu Jan 1 00:00:00 1970 From: Iannis Zannos Subject: Re: org-mode + icicles, avoid key binding redefinitions? Date: Wed, 29 Jan 2014 22:11:27 +0200 Message-ID: References: <87ob33nnwi.fsf@bzg.ath.cx> <87eh3yvgyg.fsf@bzg.ath.cx> <3bc3c5a1-1c3f-4975-9dd6-3428aabb69be@default> <87ppniu06o.fsf@bzg.ath.cx> <1c11f795-ca4a-45bf-9701-7645a0609ed1@default> <87lhy6l4k4.fsf@bzg.ath.cx> <87d2jh93jb.fsf@bzg.ath.cx> <87bnywtqx4.fsf@bzg.ath.cx> <86lhxz6uw8.fsf@somewhere.org> <87a9eefzmw.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b5d22bac5d15904f1218b67 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49451) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8bTv-0000jW-WA for emacs-orgmode@gnu.org; Wed, 29 Jan 2014 15:11:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8bTu-0000eY-1n for emacs-orgmode@gnu.org; Wed, 29 Jan 2014 15:11:31 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Thomas S. Dye" , ML Emacs-orgmode Cc: Bastien , public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org, Sebastien Vauban --047d7b5d22bac5d15904f1218b67 Content-Type: text/plain; charset=ISO-8859-1 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 wrote: > > > Aloha Bastien, > > Bastien 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 > > > --047d7b5d22bac5d15904f1218b67 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

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. =A0Interesting is the possibility to open a section = (subtree) in an independent buffer after finding it, with one command. =A0I= enclose the code here, plus the link to a gist containing the code. =A0

Gist name: org-ic= icles

Iannis Zannos


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

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

(eval-after-load 'org
<= div>=A0 '(define-key org-mode-map (kbd "C-c C-'") 'or= g-icicle-occur))
(eval-after-load 'org
=A0 '(de= fine-key org-mode-map (kbd "C-c i o") 'org-icicle-occur))
(defun org-icicle-imenu (separate-buffer)
=A0 "In org-m= ode, show entire buffer contents before running icicle-imenu.
Oth= erwise icicle-occur will not place cursor at found location,
if t= he 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 t= he point was before the command, in the
=A0 original buffer."= ;
=A0 (interactive "P")
=A0 (show-all)
=A0= (let ((mark (point)))
=A0 =A0 (icicle-imenu (point-min) (point-m= ax) t)
=A0 =A0 (cond (separate-buffer
=A0 =A0 =A0 =A0 = =A0 =A0(org-tree-to-indirect-buffer)
=A0 =A0 =A0 =A0 =A0 =A0(goto-char mark))
=A0 =A0 =A0 =A0 =A0= (t (recenter 4)))))

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

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

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

;;; ???? Adapt or= g-mode to icicle menus when refiling (C-c C-w)
;;; Still problems. Cannot use standard org refiling with icicles acti= vated!
(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)
=A0 "Alternative to org-refile using icicles.
= Refile or copy current section, to a location in the file selected with ici= cles.
Without prefix argument: Place the copied/cut section it *after* the s= elected section.
With prefix argument: Make the copied/cut sectio= n *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. =A0To get it back, one has to undo, or paste.
<= div>
Note 2: Reason for this function is that icicles seems t= o break org-modes headline
buffer display, so onehas to use icicl= es for all headline navigation if it is loaded."
=A0 (interactive "P")
=A0 (outline-back-to-heading= )
=A0 (if do-copy-p (org-copy-subtree) (org-cut-subtree))
=A0 (show-all)
=A0 (icicle-imenu (point-min) (point-max) t)
=A0 (outline-next-heading)
=A0 (unless (eq (current-column) 0) (i= nsert "\n"))
=A0 (org-paste-subtree)
=A0 (if = as-subtree (org-demote-subtree)))

(defun org-copy-= icy (as-subtree)
=A0 "Copy section to another location in file, selecting the loca= tion with icicles.
See org-refile-icy."
=A0 (inter= active "P")
=A0 (org-refile-icy as-subtree t))

(eval-after-load 'org
=A0 '(define-key org= -mode-map (kbd "C-c i r") 'org-refile-icy))
(eval-a= fter-load 'org
=A0 '(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) wri= tes:
>
>> Also, this is my first time trying to decode a syntax table, so ca= veat
>> emptor.
>
> Yes -- when doing C-u C-x on { in fundamental-mode I read
>
> Character code properties: customize what to show
> =A0 name: LEFT CURLY BRACKET
> =A0 old-name: OPENING CURLY BRACKET
> =A0 general-category: Ps (Punctuation, Open)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ^^^^^^^^^^^
>
> 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 an= other specific. To
my mind, the emacs guideline is ambiguous unless there is some
convention about which sense is meant in this case. =A0I guess it would be<= br> 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=



--047d7b5d22bac5d15904f1218b67--