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

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

How users start programming in Emacs Lisp...


From: Christopher Dimech
Subject: How users start programming in Emacs Lisp...
Date: Sun, 30 May 2021 04:11:13 +0200

> Sent: Sunday, May 30, 2021 at 10:37 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: How users start programming in Emacs Lisp...
>
> * Christopher Dimech <dimech@gmx.com> [2021-05-30 01:08]:
> > Yes.  For emacs-lisp-mode, there are some default settings already.
> > I rather not force users to first learn elisp before being able to
> > easily work on their code.
> 
> When any user is setting any variable that is already Emacs Lisp. Is
> is a slight subterfuge, we call it "customization" but user starts
> already programming in Lisp. 
> 
> *scratch* buffer is famous for it.
> 
> I just need more of them but *scratch*, so I do it this way:
> 
> ;;;; ↝ RCD TEMPORARY BUFFERS
> 
> (defvar rcd-temp-buffer-mode-history nil)
> 
> (defun rcd-temp-buffer (&optional name mode)
>   (interactive "p")
>   (let* ((format "*RCD TEMPORARY BUFFER%s%s*")
>        (buffer (if name (format format ": " name) (format format "" ""))))
>     (switch-to-buffer (generate-new-buffer "*RCD TEMPORARY BUFFER*"))
>     (if current-prefix-arg
>       (let* ((modes '("adoc-mode" "emacs-lisp-mode" "lisp-mode" 
> "markdown-mode"
>                        "org-mode" "sql-mode" "fundamental-mode" "html-mode"))
>              (mode (completing-read "Mode: " modes nil t nil 
> 'rcd-temp-buffer-mode-history)))
>         (funcall (intern mode)))
>     (funcall (intern (or mode "fundamental-mode"))))))
> 
> (defun rcd-temp-buffer-destroy-em ()
>   (kill-matching-buffers "RCD TEMPORARY BUFFER"))

I wonder how you call the buffer optional parameters

C-u 8 C-u 5 M-x rcd-temp-buffer

Could you pass a buffer-name and mode as strings, or just the number as
position in the corresponding list?



reply via email to

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