* Re: [External] : About the key binding convention: C-x is reserved by emacs itself whereas the C-c prefix is used for user defined keybindings.
2021-09-21 16:08 ` [External] : " Drew Adams
@ 2021-09-21 17:54 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 0 replies; 3+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-21 17:54 UTC (permalink / raw)
To: help-gnu-emacs
Drew Adams wrote:
> You'll note that there is no convention regarding C-x.
> An unstated convention, or just good advice/practice is this
> one, however: If you replace some existing, standard Emacs
> binding (i.e., one that you get from Emacs as distributed,
> without loading any 3rd-party libraries) then that might
> confuse or annoy some users of your code.
I know but if the user installs it is with the intention of
changing the current state of Emacs ... and
If the user installs it he/she is unlikely to want to setup
the keys manually, especially in the early phase where he/she
just wants to get a grip on (not literally ha) what the
software is, if indeed it'd be left to him/her that would be
a poor choise of person doing it all the more ... and
If the software relies of interactive stuff that must be fast
(i.e. mere practically, invocation wise) to make sense to have
a poor shortcut for key functionality would be to have
a modern quality fully suspended 1x12 MTB, only the saddle is
way to high which makes it disgrace anyway for the presumed
rider ... and
If the user installs a second package which is of the same
nature, what will happen?
I have no solution, maybe one could have yet another package
that would interactively ask the user, what are the fastest,
closest, and most intuitive and ergonomic keystrokes? [user
hits] and the next one? [etc] then when done one would have
a stack for this and then every installed package would
annotate functionality with respect to these characteristics
and it would be mapped to the shortcuts one by one ...
(Theoretical example, not suggesting anyone do it.)
Or rely on the user.
Or do something else?
Actually I just posted, it is a great example of this exact
situation which I describe (from my incompleteness-POW), which is
- it was one of the first things I ever wrote BTW and I use it
ever time I use the computer, or more times than that often -
the "Created" refers to the package restyle - it ~twice that
old, I'd approximate. (Unbelievably such basic stuff has to be
written by Elisp novices all the same.)
Yes, those keys are arbitrarily assigned in terms of anyone
else using it who might use other stuff - just what I like -
not that I'm THAT different from everybody else - I'm mean
AARGH
But I have no idea what creative things other people might do
their `message-mode'. See what I mean? ("Moggle" is a FF7
reference BTW. And pun och "toggle". Cute!)
;;; moggle.el --- iterate headers and body in message-mode -*- lexical-binding: t
;;;
;;; Commentary:
;;;
;;; Author: Emanuel Berg (incal) <moasenwood@zoho.eu>
;;; Created: 2014-07-04
;;; Keywords: news, mail
;;; License: GPL3+
;;; URL: https://dataswamp.org/~incal/emacs-init/moggle.el
;;; Version: 2.0.0
;;;
;;; In the current message, hit one (1) key to go to the next
;;; field to type. The first fields in a message are the
;;; headers -- "To", "Subject", and so on -- and the last one
;;; is the body.
;;;
;;; And, there is another key to do the exact same thing, only
;;; in the opposite direction!
;;;
;;; By default, `next-header' is bound to TAB ("\t"), and
;;; `previous-header' to BACKTAB (<backtab>; i.e., right-shift
;;; and TAB).
;;;
;;; This also plays seamlessly with the abbrevs of the
;;; ~/.mailrc file. Try it: setup an alias, type it in the
;;; "To" header, and hit TAB.
;;;
;;; For example, for mail addresses, ~/.mailrc can look like
;;; this:
;;;
;;; alias john "John DiFool <difool@incal.com>"
;;; alias kate "Katherine Moss <mossy@km.com>"
;;; alias friends john kate
;;;
;;; (For Usenet/Gmane groups, ordinary abbrevs are setup: geh
;;; -> gnu.emacs.help (gmane.emacs.help) and so on.)
;;;
;;; All in all, this makes for rapid, mouse-free editing of
;;; mails and Usenet/Gmane posts.
;;;
;;; Code:
(require 'message)
(defun get-header-separator-pos ()
"Get the position of `mail-header-separator'."
(save-excursion
(rfc822-goto-eoh)
(point) ))
(defun at-end-of-line-p ()
"True iff point is at the end of the current line."
(looking-at "$"))
(defun next-line-header-or-body ()
"Go to the next header field.
If already at the last header field go to the message body."
(if (re-search-forward ": " (get-header-separator-pos) t)
(end-of-line)
(message-goto-body) ))
(defun end-of-line-or-next-line ()
"If not at the end of a line go there.
Else got to the next header field if it exists."
(if (at-end-of-line-p)
(next-line-header-or-body)
(end-of-line) ))
(defun next-header ()
"Go to the next header field.
If already at the last one go to the message body."
(interactive)
(if (< (point) (get-header-separator-pos))
(progn
(expand-abbrev)
(end-of-line-or-next-line) )
(goto-char (point-min))
(end-of-line-or-next-line) ))
(defun prev-header ()
"Go to the previous header field.
If already at the first one got to the message body."
(interactive)
(if (< (point) (get-header-separator-pos))
(progn
(expand-abbrev)
(if (= 1 (line-number-at-pos))
(message-goto-body)
(forward-line -1) )
(end-of-line) )
(goto-char (get-header-separator-pos))
(backward-char 1) ))
(define-key message-mode-map "\t" #'next-header)
(define-key message-mode-map [backtab] #'prev-header)
(provide 'moggle)
;;; moggle.el ends here
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 3+ messages in thread