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

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

do use `this' syntax


From: Emanuel Berg
Subject: do use `this' syntax
Date: Sat, 24 Jun 2023 00:42:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Made a little improvement to `erc-cmd-SM' and wondered, is
there a canonical way to transform something into `something'?

And, does that syntax have a name?

It is used here and there in the Emacs world and at the very
least should get a pretty face, in ERC and some other places -
but notably not Gnus it would seem - it even turns into
a button which leads to documentation, if available.

So it is an Emacs-to-Emacs integration thing, and we should
care about those, since they are like bonus features
(easter eggs), a small reward to the brave people who use
Emacs for web browsing, mail, IRC, and all other such stuff,
because that's what makes Emacs exciting and fun, just as must
as the editing features makes it useful, the base.

Also see in this regard:

  https://dataswamp.org/~incal/emacs-init/erc/erc-man.el

But regardless of whatever, the main reason to do it is
obviously: it is actually cool and useful as well.

This command is tested and operational, but I thought I'd ask
about any existing convention before trying to push it to
replace the original `erc-cmd-SM' God willing ...

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/erc/erc-show-modes.el

(require 'erc)

(defun erc-modes-string ()
  (let ((modes '())
        (case-fold-search nil) )
    (dolist (var (apropos-internal "^erc-.*mode$"))
      (when (and (boundp var)
                 (symbol-value var) )
        (setq modes (cons (format "`%s'" (symbol-name var)) modes)) ))
    (mapconcat #'identity (sort modes #'string<) ", ") ))

(defun erc-cmd-SMO ()
  (erc-send-message (format "ERC modes: %s" (erc-modes-string)))
  t)

(provide 'erc-show-modes)

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




reply via email to

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