help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Proposal: "C-z <letter>" reserved for users


From: Howard Melman
Subject: Re: Proposal: "C-z <letter>" reserved for users
Date: Thu, 11 Feb 2021 08:52:42 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin)

Christopher Miles <numbchild@gmail.com> writes:

> <#secure method=pgpmime mode=sign>
>
> Hi, Howard, your keybinding is great.
>
> I copied your code, found some command is not defined.
>
> Can you share your Emacs configuration? Thanks in
> advance. 😄

I had forgotten I'd defined some simple commands.  I'm not
inclined to share my whole config, but here are a few that
are used in this transient.

Howard

(defun move-frame-right ()
  "Move the current frame right 200 pixels"
  (interactive)
  (let* ((p (frame-position))
         (x (car p))
         (y (cdr p)))
    (set-frame-position (selected-frame) (+ x 200) y)))

(defun move-frame-left ()
  "Move the current frame left 200 pixels"
  (interactive)
  (let* ((p (frame-position))
         (x (car p))
         (y (cdr p)))
    (set-frame-position (selected-frame) (- x 200) y)))

(defun select-previous-frame (&optional arg)
  "Select the -ARG'th visible frame on current display, and raise it.

All frames are arranged in a cyclic order.
This command selects the frame ARG steps previously in that order.
It is the reverse of `other-frame'."
  (interactive "p")
  (other-frame (* -1 arg)))

(defun kill-buffer-and-frame ()
  "Kill the current buffer and the current frame."
  (interactive)
  ;; do this trick in case of dedicated window in special frame
  ;; in that case kill-buffer will delete-frame too
  ;; can't check after kill buffer since selected-frame will have changed
  (if (window-dedicated-p (selected-window))
      (kill-buffer (current-buffer))
    (kill-buffer (current-buffer))
    (delete-frame)))



>
> Howard Melman <hmelman@gmail.com> writes:
>
> S Boucher <help-gnu-emacs@gnu.org> writes:
>
> C-z is bound to a low frequency use function (suspend-frame)… and
> speaking for myself, I probably can count on one hand the number of
> times I've used it in the last 25years :-)
>
> I would suggest:1) move suspend-frame to "C-c C-z" (that is still a
> quick shortcut) 2) reserve C-z <letter> for users That still leaves a
> whole lot with C-z C-… C-z M-…
>
> FWIW I used to bind the ctl-x-5-map to C-z add was happier typing C-z
> f than C-x 5 f. I shifted to this frame oriented transient on C-z for
> a while now and have been happy. I'm sure it could be improved but as
> a first attempt it's been pretty good for me.
>
> ;;; frame commands from ctl-x-5-map
> (define-transient-command hrm-frame-transient ()
>   "Frame commands mirroring ctl-x-5-map"
>   ["Configure Frames"
>    ["Manage"
>     ("2" "New" make-frame-command)
>     ("0" "Delete" delete-frame)
>     ("k" "Kill Frame & Buffer" kill-buffer-and-frame)
>     ("1" "Delete others" delete-other-frames)
>     ]
>    ["Select"
>     ("o" "Other" other-frame)
>     ("n" "Next" other-frame)
>     ("p" "Previous" select-previous-frame)
>     ]
>    ["Display"
>     ("-" "Fixed Width" variable-pitch-mode)
>     ("l" "Lower" lower-frame)
>     ("=" "Maximize" toggle-frame-maximized)
>     ("i" "Iconify" iconify-frame)
>     ]
>    ["Move"
>     ("<" "Left" move-frame-left :transient t)
>     (">" "Right" move-frame-right :transient t)
>     ]
>    ]
>   ["Open in other Frame"
>    ["Files"
>     ("b" "Buffer" switch-to-buffer-other-frame)
>     ("C-o" "Buffer other frame" display-buffer-other-frame)
>     ("C-f" "File" find-file-other-frame)
>     ("f" "File" find-file-other-frame)
>     ("r" "File Read-Only" find-file-read-only-other-frame)
>     ]
>    ["Apps"
>     ("d" "Dired" dired-other-frame)
>     ("." "Xref" xref-find-definitions-other-frame)
>     ("m" "Compose Mail" compose-mail-other-frame)
>     ]
>    ["Help For"
>     ("V" "Variable" find-variable-other-frame)
>     ("F" "Function" find-function-other-frame)
>     ("K" "Key" find-function-on-key-other-frame)
>     ("L" "Library" find-library-other-frame)
>     ]
>    ]
>   )
> (global-set-key (kbd "C-z") 'hrm-frame-transient)

-- 

Howard




reply via email to

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