[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs Lisp's future
From: |
Thorsten Jolitz |
Subject: |
Re: Emacs Lisp's future |
Date: |
Tue, 30 Sep 2014 21:18:47 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Thorsten Jolitz <address@hidden> writes:
> Nic Ferrier <address@hidden> writes:
>
>> Thorsten Jolitz <address@hidden> writes:
>>
>>> address@hidden (Phillip Lord) writes:
>>> May be an Org table would be a good input format:
>>>
>>> #+BEGIN_ORG
>>> | (key . fun) | | |
>>> |-------------+-------------+-------------|
>>> | | | |
>>> | (key . fun) | (key . fun) | (key . fun) |
>>> | (key . fun) | (key . fun) | |
>>> | | | |
>>> | (key . fun) | (key . fun) | |
>>> |-------------+-------------+-------------|
>>> | | (key . fun) | |
>>> #+END_ORG
>>
>>
>> You should totally do this. I'd love to play with it.
>
> 'discover-context-menus' look like this:
>
> #+BEGIN_SRC emacs-lisp
> (dired
> (description "DIRectory EDitor")
> (actions
> ("Navigation"
> ("DEL" "unmark backward" dired-unmark-backward)
> ("RET" "find file" dired-find-file)
> ("SPC" "next line" dired-next-line)
> ("<" "prev dirline" dired-prev-dirline)
> (">" "next dirline" dired-next-dirline)
> ("^" "up directory" dired-up-directory)
> ("j" "goto file" dired-goto-file)
> ("i" "maybe insert subdir" dired-maybe-insert-subdir)
> ("n" "next line" dired-next-line)
> ("p" "previous line" dired-previous-line)
> ("v" "view file" dired-view-file)
> ("w" "copy filename as kill" dired-copy-filename-as-kill)) ...))
> #+END_SRC
>
> and it could easily be derived form an org table:
>
>
> | Navigation | |
> | (DEL . dired-find-file) | (RET . dired-find-file)|
[Ups, sorry ... did C-c C-c in the table, but wasn't in Org-mode but in
message-mode, so sent the message accidentally]
Calling 'org-table-to-lisp on this table
| Navigation | |
| DEL dired-find-file | RET dired-find-file |
yields:
(("Navigation" "") ("DEL dired-find-file" "RET dired-find-file"))
Using that as arg for this (imperfect) mapping function
#+BEGIN_SRC emacs-lisp
(defun tj/org-tbl-to-context-menu (org-tbl-as-lisp)
(mapcar
(lambda (--row)
(mapcar
(lambda (--cell)
(let ((cell-split (split-string --cell " " t)))
(if (eq (length cell-split) 2)
(list (car cell-split)
(mapconcat
'identity
(split-string
(cadr cell-split) "\\(?:dired\\)?-" t)
" ")
(intern (cadr cell-split)))
cell-split)))
--row))
org-tbl-as-lisp))
#+END_SRC
yields something (at least somehow) similar to 'discover-context-menus':
#+BEGIN_SRC emacs-lisp
((("Navigation") nil) (("DEL" "find file" dired-find-file) ("RET" "find
file" dired-find-file)))
#+END_SRC
but to make it useful, makey.el would need to consider empty tbl-cells
as well as empty tbl-rows as well as hlines when drawing the UI grid.
--
cheers,
Thorsten
- Re: Emacs Lisp's future, (continued)
- Re: Emacs Lisp's future, Emilio Lopes, 2014/09/23
- Re: Emacs Lisp's future, Jonas Bernoulli, 2014/09/26
- Re: Emacs Lisp's future, Christopher Allan Webber, 2014/09/26
- Re: Emacs Lisp's future, Phillip Lord, 2014/09/29
- Re: Emacs Lisp's future, Stefan Monnier, 2014/09/29
- Re: Emacs Lisp's future, Phillip Lord, 2014/09/29
- Re: Emacs Lisp's future, Thorsten Jolitz, 2014/09/30
- Re: Emacs Lisp's future, Phillip Lord, 2014/09/30
- Re: Emacs Lisp's future, Nic Ferrier, 2014/09/30
- Re: Emacs Lisp's future, Thorsten Jolitz, 2014/09/30
- Re: Emacs Lisp's future,
Thorsten Jolitz <=
- Re: Emacs Lisp's future, Nicolas Richard, 2014/09/30
- Re: Emacs Lisp's future, Thorsten Jolitz, 2014/09/30
- RE: Emacs Lisp's future, Drew Adams, 2014/09/30
- Re: Emacs Lisp's future, Stefan Monnier, 2014/09/26
- Re: Emacs Lisp's future, Richard Stallman, 2014/09/18
- Re: Emacs Lisp's future, Rasmus, 2014/09/18
- Re: Emacs Lisp's future, Stefan Monnier, 2014/09/18
- Adding packages to ELPA (was: Emacs Lisp's future), Eli Zaretskii, 2014/09/19
- Re: Adding packages to ELPA, Rasmus, 2014/09/19
- Re: Adding packages to ELPA, Stefan Monnier, 2014/09/19