emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "modern" colors Re: Changes for emacs 28


From: Göktuğ Kayaalp
Subject: Re: "modern" colors Re: Changes for emacs 28
Date: Sun, 13 Sep 2020 11:53:46 +0300
User-agent: mu4e 1.2.0; emacs 28.0.50

On 2020-09-13 07:06 +03, Richard Stallman <rms@gnu.org> wrote:
> I think the hardest part will be to modify the various mode-specific
> C-Mouse-3 (Mouse-3 in this mode) menus to conditionally include basic
> editing commands.

IMHO this is not really necessary.  A simpler approach would be to
simply have a mode which has the plain right click (mouse-3) show a
simple menu.  This is what VS Code has, which looks fit for us too:

Go to definition => xref-find-definitions
----
Cut
Copy
Paste
----
Command palette => execute-extended-command

We could extend this with undo/redo + maybe ‘insert-char’, which are
present in some other applications.  The following is a demonstrative
example that’s IMHO fairly ‘Emacsy’ but I couldn’t get the attached
commands to run (FWIW the relevant docs are pretty sparse for this):

(global-set-key
 (kbd "<mouse-3>")
 (lambda (event)
   (interactive "e")
   (x-popup-menu
    event
    (let ((map (make-sparse-keymap)))
      (define-key map [xref] '("Go to definition" . #'xref-find-definitions))
      (define-key-after
        map [sep1] '("--" . nil) 'xref)
      (define-key-after
        map [cut] '("Cut" . #'kill-region) 'sep1)
      (define-key-after
        map [copy] '("Copy" . #'kill-ring-save) 'cut)
      (define-key-after
        map [paste] '("Paste" . #'yank) 'copy)
      (define-key-after
        map [sep2] '("--" . nil) 'paste)
      (define-key-after
        map [undo] '("Undo" . #'undo) 'sep2)
      (define-key-after
        map [redo] '("Paste" . #'undo-redo) 'undo)
      (define-key-after
        map [sep3] '("--" . nil) 'redo)
      (define-key-after
        map [special] '("Insert special character" . #'insert-char) 'sep3)
      (define-key-after
        map [command] '("Execute command" . #'execute-extended-command) 
'special)
      (define-key-after
        map [sexp] '("Execute lisp expression" . #'eval-expression) 'command)
      map))))

--
İ. Göktuğ Kayaalp / @cadadr / <https://www.gkayaalp.com/>
pgp:   024C 30DD 597D 142B 49AC 40EB 465C D949 B101 2427



reply via email to

[Prev in Thread] Current Thread [Next in Thread]