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: Jean Louis
Subject: How users start programming in Emacs Lisp...
Date: Sun, 30 May 2021 01:37:12 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* 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"))



-- 
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]