all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* don't hard-code keys
@ 2021-05-01 22:35 Emanuel Berg via Users list for the GNU Emacs text editor
  2021-05-02  7:13 ` Tassilo Horn
  0 siblings, 1 reply; 6+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-05-01 22:35 UTC (permalink / raw)
  To: help-gnu-emacs

Here are two interesting functions for several reasons...

But the question: how can I avoid hard-coding the C-u key but
instead have the keybinding inserted thru a reference to the
function, i.e. `universal-argument'?

I don't plan to rebind C-u and/or use something else for
universal-argument, rather I'd like to just not have the C-u
hard-coded for personal/political reasons.

(defun open-irc (&optional connect)
  (interactive "P")
  (let ((irc-buffer (car (erc-buffer-list))))
    (if irc-buffer
        (progn
          (switch-to-buffer irc-buffer)
          (erc-scroll-to-bottom-no-blanks))
      (if connect
          (irc-connect-to-all)
        (message "did nothing, C-u to connect") )))) ; [1]

(defun new-message (&optional force)
  (interactive "P")
  (message (format "%s" force))
  (if (or (not (eq major-mode 'message-mode)) force)
      (progn
        (unless (gnus-alive-p) (gnus))
        (gnus-post-news 'post "") )
    (message "did nothing, C-u to force") )) ; [2]

[1] https://dataswamp.org/~incal/emacs-init/erc-incal.el
[2] https://dataswamp.org/~incal/emacs-init/gnus/gnus-incal.el

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-02 17:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-01 22:35 don't hard-code keys Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-02  7:13 ` Tassilo Horn
2021-05-02 14:44   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-02 17:28     ` Thibaut Verron
2021-05-02 17:33       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-02 17:38         ` Emanuel Berg via Users list for the GNU Emacs text editor

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.