From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: 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. Date: Tue, 21 Sep 2021 19:54:45 +0200 Message-ID: <87o88lu84a.fsf@zoho.eu> References: Reply-To: Emanuel Berg Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30741"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:5Vn0m1QS0bhGoLDTvVIykikuA40= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 21 19:55:31 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mSjzO-0007i3-Ka for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 21 Sep 2021 19:55:30 +0200 Original-Received: from localhost ([::1]:60286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSjzN-0008Qb-99 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 21 Sep 2021 13:55:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSjyv-0008QF-SS for help-gnu-emacs@gnu.org; Tue, 21 Sep 2021 13:55:01 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:42376) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSjyr-0005HF-8g for help-gnu-emacs@gnu.org; Tue, 21 Sep 2021 13:55:01 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mSjyo-0006vD-Nd for help-gnu-emacs@gnu.org; Tue, 21 Sep 2021 19:54:54 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:133140 Archived-At: 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) ;;; 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 (; 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 " ;;; alias kate "Katherine Moss " ;;; 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