* Re: Help with my first elisp
@ 2022-05-24 17:30 Kepa Diez
2022-05-24 17:32 ` Fwd: " Ypo
2022-05-25 6:35 ` Orm Finnendahl
0 siblings, 2 replies; 7+ messages in thread
From: Kepa Diez @ 2022-05-24 17:30 UTC (permalink / raw)
To: Org-mode
[-- Attachment #1: Type: text/plain, Size: 1452 bytes --]
> maybe use something like
>
> >/> (define-key mh-letter-mode-map/
> >/> (kbd "C-c s")/
> >/> 'ggm-mh-sentaddrs-completion)/
>
> but, using whatever the name of the logos-focus mode map, pointing at
> your functions?
Hi Greg
I think "logos" doesn't have a map, is it possible?
> On Mon, May 23, 2022 at 09:46:09AM -0700, Greg Minshall wrote:
> >/Ypo,/
> >//
> >/> (defun salto ()/
> >/> (interactive)/
> >/> (if posicion 1/
>
> You are comparing the value of posicion to 1?
>
> Then it should probably be "(if (= posicion 1) ...)" or
> "(if (equal posicion 1) ...)" or something like that.
>
> Cheers
> --
> t
Thanks, Tomas. It seems the "if" part works, now I use my elisp just
with the spacebar :-)
(add-hook 'logos-focus-mode-hook #'(lambda ()
(defvar posicion
"Position where is the cursor.")
(defun focusPointStart ()
(interactive)
(next-line 1)
(beginning-of-visual-line)
(forward-char 6)
(setq posicion 1)
)
(defun focusPointInter ()
(interactive)
(forward-char 23)
(setq posicion 2)
)
(defun focusPointEnd ()
(interactive)
(end-of-visual-line) ;;C-e
(backward-char 7)
(setq posicion 3)
)
(defun focusJump ()
(interactive)
(if (equal posicion 1)
(focusPointInter)
(if (equal posicion 2)
(focusPointEnd)
(if (equal posicion 3)
(focusPointStart)))))
(define-key global-map (kbd "SPC") #'focusJump)
))
[-- Attachment #2: Type: text/html, Size: 2422 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Fwd: Help with my first elisp
2022-05-24 17:30 Help with my first elisp Kepa Diez
@ 2022-05-24 17:32 ` Ypo
2022-05-24 18:16 ` tomas
2022-05-25 4:55 ` Greg Minshall
2022-05-25 6:35 ` Orm Finnendahl
1 sibling, 2 replies; 7+ messages in thread
From: Ypo @ 2022-05-24 17:32 UTC (permalink / raw)
To: Org-mode
[-- Attachment #1: Type: text/plain, Size: 1456 bytes --]
> maybe use something like
>
> >/> (define-key mh-letter-mode-map/
> >/> (kbd "C-c s")/
> >/> 'ggm-mh-sentaddrs-completion)/
>
> but, using whatever the name of the logos-focus mode map, pointing at
> your functions?
Hi Greg
I think "logos" doesn't have a map, is it possible?
> On Mon, May 23, 2022 at 09:46:09AM -0700, Greg Minshall wrote:
> >/Ypo,/
> >//
> >/> (defun salto ()/
> >/> (interactive)/
> >/> (if posicion 1/
>
> You are comparing the value of posicion to 1?
>
> Then it should probably be "(if (= posicion 1) ...)" or
> "(if (equal posicion 1) ...)" or something like that.
>
> Cheers
> --
> t
Thanks, Tomas. It seems the "if" part works, now I can use my elisp just
with the spacebar :-)
(add-hook 'logos-focus-mode-hook #'(lambda ()
(defvar posicion
"Position where is the cursor.")
(defun focusPointStart ()
(interactive)
(next-line 1)
(beginning-of-visual-line)
(forward-char 6)
(setq posicion 1)
)
(defun focusPointInter ()
(interactive)
(forward-char 23)
(setq posicion 2)
)
(defun focusPointEnd ()
(interactive)
(end-of-visual-line) ;;C-e
(backward-char 7)
(setq posicion 3)
)
(defun focusJump ()
(interactive)
(if (equal posicion 1)
(focusPointInter)
(if (equal posicion 2)
(focusPointEnd)
(if (equal posicion 3)
(focusPointStart)))))
(define-key global-map (kbd "SPC") #'focusJump)
))
[-- Attachment #2: Type: text/html, Size: 2510 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Fwd: Help with my first elisp
2022-05-24 17:32 ` Fwd: " Ypo
@ 2022-05-24 18:16 ` tomas
2022-05-25 4:55 ` Greg Minshall
1 sibling, 0 replies; 7+ messages in thread
From: tomas @ 2022-05-24 18:16 UTC (permalink / raw)
To: Ypo; +Cc: Org-mode
[-- Attachment #1: Type: text/plain, Size: 205 bytes --]
On Tue, May 24, 2022 at 07:32:31PM +0200, Ypo wrote:
[...]
> Thanks, Tomas. It seems the "if" part works, now I can use my elisp just
> with the spacebar :-)
Glad it worked :)
Cheers
--
t
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Fwd: Help with my first elisp
2022-05-24 17:32 ` Fwd: " Ypo
2022-05-24 18:16 ` tomas
@ 2022-05-25 4:55 ` Greg Minshall
1 sibling, 0 replies; 7+ messages in thread
From: Greg Minshall @ 2022-05-25 4:55 UTC (permalink / raw)
To: Ypo; +Cc: Org-mode
Ypo,
> > but, using whatever the name of the logos-focus mode map, pointing at
> > your functions?
...
> I think "logos" doesn't have a map, is it possible?
certainly possible (i don't use logos).
in fact,
----
https://gitlab.com/protesilaos/logos/-/blob/main/logos.el
----
has the lines
----
;; Logos does not define any key bindings. Try something like this:
;;
;; (let ((map global-map))
;; (define-key map [remap narrow-to-region] #'logos-narrow-dwim)
;; (define-key map [remap forward-page] #'logos-forward-page-dwim)
;; (define-key map [remap backward-page] #'logos-backward-page-dwim))
;;
;; By default those key bindings are: C-x n n, C-x ], C-x [.
----
which certainly implies no map. and, iiuc, *these* =define-key= lines
are global, i.e., remain true whether you are in, or out of, logos mode.
cheers, Greg
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help with my first elisp
2022-05-24 17:30 Help with my first elisp Kepa Diez
2022-05-24 17:32 ` Fwd: " Ypo
@ 2022-05-25 6:35 ` Orm Finnendahl
2022-05-25 8:24 ` tomas
1 sibling, 1 reply; 7+ messages in thread
From: Orm Finnendahl @ 2022-05-25 6:35 UTC (permalink / raw)
To: emacs-orgmode
Hi,
Am Dienstag, den 24. Mai 2022 um 19:30:40 Uhr (+0200) schrieb Kepa Diez:
> (defun focusJump ()
> (interactive)
> (if (equal posicion 1)
> (focusPointInter)
> (if (equal posicion 2)
> (focusPointEnd)
> (if (equal posicion 3)
> (focusPointStart)))))
maybe you want to cleanup a bit:
(defun focusJump (posicion)
(interactive "nPosicion: ")
(case posicion
(1 (focusPointInter))
(2 (focusPointEnd))
(3 (focusPointStart))))
BTW: As lisp doesn't distinguish case, it is common practice in lisp
to seperate words in symbols with dashes like 'focus-jump,
'focus-pont-inter, 'focus-point-start, etc.
--
Orm
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help with my first elisp
2022-05-25 6:35 ` Orm Finnendahl
@ 2022-05-25 8:24 ` tomas
2022-05-27 7:23 ` Orm Finnendahl
0 siblings, 1 reply; 7+ messages in thread
From: tomas @ 2022-05-25 8:24 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]
On Wed, May 25, 2022 at 08:35:19AM +0200, Orm Finnendahl wrote:
> Hi,
>
> Am Dienstag, den 24. Mai 2022 um 19:30:40 Uhr (+0200) schrieb Kepa Diez:
> > (defun focusJump ()
> > (interactive)
> > (if (equal posicion 1)
> > (focusPointInter)
> > (if (equal posicion 2)
> > (focusPointEnd)
> > (if (equal posicion 3)
> > (focusPointStart)))))
>
> maybe you want to cleanup a bit:
>
> (defun focusJump (posicion)
> (interactive "nPosicion: ")
> (case posicion
> (1 (focusPointInter))
> (2 (focusPointEnd))
> (3 (focusPointStart))))
>
> BTW: As lisp doesn't distinguish case, it is common practice in lisp
> to seperate words in symbols with dashes like 'focus-jump,
> 'focus-pont-inter, 'focus-point-start, etc.
Just to avoid confusion: Emacs Lisp does distinguish case. Traditional
Lisp doesn't. I know you know, but people could misunderstand the above.
The rest stands: in Emacs Lisp it's customary to write variable and
function names with dashes, in good ol' Lisp tradition.
Cheers
--
t
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help with my first elisp
2022-05-25 8:24 ` tomas
@ 2022-05-27 7:23 ` Orm Finnendahl
0 siblings, 0 replies; 7+ messages in thread
From: Orm Finnendahl @ 2022-05-27 7:23 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 583 bytes --]
Am Mittwoch, den 25. Mai 2022 um 10:24:01 Uhr (+0200) schrieb tomas@tuxteam.de:
>
> Just to avoid confusion: Emacs Lisp does distinguish case. Traditional
> Lisp doesn't. I know you know, but people could misunderstand the above.
Yes, that was a bit imprecise ;-)
Best,
Orm
----------------------------------------------------------------------
Prof. Orm Finnendahl
Komposition
Hochschule für Musik und Darstellende Kunst
Eschersheimer Landstr. 29-39
60322 Frankfurt am Main
https://www.youtube.com/watch?v=2rWha1HTfFE&list=PLiGfneJSWmNw6dTUvcTHbTkCYOOTiB_N6
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-05-27 7:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-24 17:30 Help with my first elisp Kepa Diez
2022-05-24 17:32 ` Fwd: " Ypo
2022-05-24 18:16 ` tomas
2022-05-25 4:55 ` Greg Minshall
2022-05-25 6:35 ` Orm Finnendahl
2022-05-25 8:24 ` tomas
2022-05-27 7:23 ` Orm Finnendahl
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).