emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ypo <ypuntot@gmail.com>
To: Greg Minshall <minshall@umich.edu>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Help with my first elisp
Date: Sun, 22 May 2022 16:18:16 +0200	[thread overview]
Message-ID: <40815376-d7db-4199-a6d8-6b362af44209@gmail.com> (raw)
In-Reply-To: <2346292.1653226030@apollo2.minshall.org>

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

Thanks, Greg

  * Now I am able to run my script every time I am in logos-focus mode :D
  * But my keys don't get to be "normal" after I get out of logos-focus
    mode.

This is how my code is evolving (the "conditional part" is not working yet):

(add-hook 'logos-focus-mode-hook #'(lambda ()

(defvar posicion
   "Position where is the cursor.")

(defun posicion3 ()
   (interactive)
   (end-of-visual-line) ;;C-e
   (backward-char 7)
   (setq posicion 3)
)

(defun posicion2 ()
   (interactive)
   (forward-char 23)
   (setq posicion 2)
)

(defun posicion1 ()
   (interactive)
   (next-line 1)
   (beginning-of-visual-line)
   (forward-char 6)
   (setq posicion 1)
)

(defun salto ()
   (interactive)
   (if posicion 1
     (posicion2)
       (if posicion 2
       (posicion3)
         (if posicion 3
         (posicion1)))))

;; (define-key global-map (kbd "SPC") #'salto)
(local-set-key "j" 'posicion1)
(local-set-key "k" 'posicion2)
(local-set-key "l" 'posicion3)
))


El 22/05/2022 a las 15:27, Greg Minshall escribió:
> Ypo,
>
>> Additional problem: I don't know how to recover keys 1, 2 and 3 to
>> their normal functioning, right now I can't type 1, 2 or 3 on my
>> Emacs. xD
> you have, e.g.,
>
>> (define-key global-map (kbd "1") #'posicion1)
>> (define-key global-map (kbd "2") #'posicion2)
>> (define-key global-map (kbd "3") #'posicion3)
> but, that is in the global map.  for a given mode, i sometimes do
> something like that:
>
>> (add-hook 'mh-show-mode-hook #'(lambda ()
>>           (local-set-key "q" 'mh-show-execute-commands)))
> or, closer to what you have, sometimes like
>
>>              (define-key mh-letter-mode-map
>>               (kbd "C-c s")
>>               'ggm-mh-sentaddrs-completion)
> i am no elisp expert, and so those are just random things i've found
> that work.  but, hopefully this may give you a hint of a direction to
> follow.
>
> cheers, Greg

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

  reply	other threads:[~2022-05-22 14:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-22 11:37 Help with my first elisp Ypo
2022-05-22 13:27 ` Greg Minshall
2022-05-22 14:18   ` Ypo [this message]
2022-05-23 16:46     ` Greg Minshall
2022-05-23 19:38       ` tomas
  -- strict thread matches above, loose matches on Subject: below --
2022-05-24 17:30 Kepa Diez
2022-05-25  6:35 ` Orm Finnendahl
2022-05-25  8:24   ` tomas
2022-05-27  7:23     ` Orm Finnendahl

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=40815376-d7db-4199-a6d8-6b362af44209@gmail.com \
    --to=ypuntot@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=minshall@umich.edu \
    /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).