From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: triple-backquote (was: Re: transient questions)
Date: Tue, 14 Mar 2023 02:15:46 +0100 [thread overview]
Message-ID: <87zg8gi14t.fsf@dataswamp.org> (raw)
In-Reply-To: 87pm9cp2te.fsf@fastmail.fm
Joost Kremers wrote:
> ```
> (transient-define-prefix jk-move-transient ()
> :transient-non-suffix #'transient--do-leave
> [:class transient-row
> ("SPC" "" scroll-up-command :transient t)
> ("C-v" "" scroll-up-command :transient t)
> ("<backspace>" "" scroll-down-command :transient t)
> ("M-v" "" scroll-down-command :transient t)
> ("<up>" "" scroll-up-line :transient t)
> ("<down>" "" scroll-down-line :transient t)
> ("<left>" "" scroll-right :transient t)
> ("<right>" "" scroll-left :transient t)
> ("b" "(Un)set bookmark" bm-toggle :transient t)
> ("g" "Top of buffer" beginning-of-buffer :transient t)
> ("G" "End of buffer" end-of-buffer :transient t)
> ("l" "Goto line" consult-goto-line)
> ("m" "Goto mark" consult-mark)
> ("n" "Next bookmark" bm-next)
> ("o" "Outline" consult-outline)
> ("t" "Previous bookmark" bm-previous)
> ("z" "Avy line" avy-goto-line)])
> ```
Alright, so what is this syntax/feature called, you put Elisp
between an opening/closing triplet backquote and you get font
lock with `gnus-article-mode'?
I like it, let's try it!
```
;;; -*- lexical-binding: t -*-
;;
;; this file:
;; https://dataswamp.org/~incal/emacs-init/abc.el
(require 'cl-lib)
(defun alphabet (&optional as-list)
(let ((abc "a b c d e f g h i j k l m n o p q r s t u v w x y z"))
(if as-list
(cl-remove ?\s (string-to-list abc))
abc) ))
;; (alphabet) ; a b c d e f g h i j k l m n o p q r s t u v w x y z
;; (alphabet t) ; (97 98 99 100 101 102 103 104 105 106 107 108 ...)
(defun echo-alphabet (&optional num)
(interactive "P")
(or num (setq num (length (alphabet t))))
(let*((part (cl-subseq (alphabet t) 0 num))
(str-list (cl-mapcar (lambda (c) (char-to-string c)) part))
(str-almost (format "%s" str-list))
(str (substring str-almost 1 (1- (length str-almost)))) )
(message str) ))
;; (echo-alphabet) ; a b c d e f g h i j k l m n o p q r s t u v w x y z
;; (echo-alphabet 10) ; a b c d e f g h i j
;; (echo-alphabet -10) ; a b c d e f g h i j k l m n o p
(defalias 'abc #'echo-alphabet)
(provide 'abc)
```
So did it work?
Maybe this will improve the level of the information
interchange, or what do you think?
Beautify the moment!
--
underground experts united
https://dataswamp.org/~incal
next prev parent reply other threads:[~2023-03-14 1:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 0:05 transient questions Joost Kremers
2023-03-14 1:15 ` Emanuel Berg [this message]
2023-03-15 9:25 ` triple-backquote (was: Re: transient questions) Ruijie Yu via Users list for the GNU Emacs text editor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zg8gi14t.fsf@dataswamp.org \
--to=incal@dataswamp.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).