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 19:22:20 +0200


---------------------
Christopher Dimech
General Administrator - Naiad Informatics - GNU Project (Geocomputation)
- Geophysical Simulation
- Geological Subsurface Mapping
- Disaster Preparedness and Mitigation
- Natural Resource Exploration and Production
- Free Software Advocacy


> Sent: Monday, May 31, 2021 at 3:54 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: How users start programming in Emacs Lisp...
>
> * Christopher Dimech <dimech@gmx.com> [2021-05-30 16:55]:
> > > How exactly do you wish to play with the name? Which name? Is it
> > > buffer name?
> > 
> > The first optional parameter "name", which looks like it is the
> > buffer name.
> 
> Sorry, I was using that long time without observing.
> 
> > When I use "C-u F5" you can only set the mode, but if name is
> > already set, the code suggests that it will use it.  But does not,
> > because the let variable "buffer" is not set.
> 
> There is main name and sub-name.
> 
> Here now you can customize it:
> 
> ;;;; ↝ RCD TEMPORARY BUFFERS
> 
> (defvar rcd-temp-buffer-mode-history nil)
> 
> ;; You may customize the main name here:
> (defvar rcd-temp-buffer-name "RCD TEMPORARY BUFFER")
> 
> ;; You may customize the modes you wish to get asked with prefix C-u:
> (defvar rcd-temp-buffer-modes '("adoc-mode" "emacs-lisp-mode" "lisp-mode" 
> "markdown-mode"
>                               "org-mode" "sql-mode" "fundamental-mode" 
> "html-mode"))
> 
> (defun rcd-temp-buffer (&optional name mode)
>   (interactive "p")
>   (let* ((format (concat "*" rcd-temp-buffer-name "%s%s*"))
>        (buffer (if name (format format ": " name) (format format "" ""))))
>     (switch-to-buffer (generate-new-buffer buffer))
>     (if current-prefix-arg
>       (let* ((mode (completing-read
>                     "Mode: "
>                     rcd-temp-buffer-modes nil t nil 
> 'rcd-temp-buffer-mode-history)))
>         (funcall (intern mode)))
>       (funcall (intern (or mode "fundamental-mode"))))))
> 
> (defun rcd-temp-buffer-destroy-em ()
>   (interactive)
>   (kill-matching-buffers "RCD TEMPORARY BUFFER"))
> 

I am having some problem figuring out what the following does, having format 
repeated twice.

(format format ": " name) 

 
> -- 
> Jean
> 
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
> 
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> 
>



reply via email to

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