yo estaba tratando un poco de código de Elisp Cookbook, y al principio enseñado que este código:elisp crear buffer sin nombre del contenido del archivo
(defun process-file (file)
"Read the contents of a file into a temp buffer and then do
something there."
(when (file-readable-p file)
(with-temp-buffer
(insert-file-contents file)
(goto-char (point-min))
(while (not (eobp))
;; do something here with buffer content
(forward-line)))))
creará una nueva (sin nombre/guardar) el buffer en la ventana de mi emacs, teniendo el contenido de ese archivo (y tal vez abrirlo en primer plano). Sin embargo, esto no sucede. ¿Puedes guiarme hacia esto?
EDIT: experimentó un poco, y se puso a esto:
(defun myTest (file)
(interactive "f")
; check if file is readable
(when (file-readable-p file)
; create a new "untitled" buffer
(let ((myBuf (get-buffer-create "untitled")))
; make it the current displayed buffer
(switch-to-buffer myBuf)
(insert "Hello"))))
¿Es esta la manera de hacerlo?
Dado que este es un búfer llamado "sin título", solo puedo tener uno de estos en una sesión. ¿Hay algo que pueda usar para tener más de uno, sin recurrir a números aleatorios?