Re: Fwd: Help with my first elisp

2022-05-24 Thread Greg Minshall
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



Re: Fwd: Help with my first elisp

2022-05-24 Thread tomas
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


signature.asc
Description: PGP signature


Fwd: Help with my first elisp

2022-05-24 Thread Ypo



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)
))