* initial-scratch-message vs. initial-major-mode comment syntax
@ 2004-06-22 16:22 Kevin Rodgers
0 siblings, 0 replies; only message in thread
From: Kevin Rodgers @ 2004-06-22 16:22 UTC (permalink / raw)
When initial-major-mode is not a Lisp programming language mode,
initial-scratch-message is not appropriate because each line has a
leading ";; " comment string. That in turn could have undesirable
results when syntax-driven fontification is on.
Since initial-scratch-message is inserted by command-line-1, which is
called by command-line after initial-major-mode has been funcall'ed, it
should be possible to use comment-region (which is sensitive to the
major mode's syntax) in command-line-1. It's hard to test, though,
since "startup" is dumped into the emacs executable; and perhaps calling
comment-region in startup.el would also require "newcomment" to be
dumped via loadup.el.
Here's a patch to illustrate the main idea:
*** emacs-21.3/lisp/startup.el~ Sun Mar 16 15:05:59 2003
--- emacs-21.3/lisp/startup.el Tue Jun 22 10:12:52 2004
***************
*** 1009,1017 ****
(if noninteractive (kill-emacs t)))
(defcustom initial-scratch-message (purecopy "\
! ;; This buffer is for notes you don't want to save, and for Lisp evaluation.
! ;; If you want to create a file, visit that file with C-x C-f,
! ;; then enter the text in that file's own buffer.
")
"Initial message displayed in *scratch* buffer at startup.
--- 1009,1017 ----
(if noninteractive (kill-emacs t)))
(defcustom initial-scratch-message (purecopy "\
! This buffer is for notes you don't want to save, and for Lisp evaluation.
! If you want to create a file, visit that file with C-x C-f,
! then enter the text in that file's own buffer.
")
"Initial message displayed in *scratch* buffer at startup.
***************
*** 1435,1441 ****
(with-current-buffer (get-buffer "*scratch*")
(erase-buffer)
(when initial-scratch-message
! (insert initial-scratch-message))
(set-buffer-modified-p nil)))))))
;; Delay 2 seconds after the init file error message
--- 1435,1443 ----
(with-current-buffer (get-buffer "*scratch*")
(erase-buffer)
(when initial-scratch-message
! (insert initial-scratch-message)
! (when comment-start
!
(comment-region (point-min) (point-max))))
(set-buffer-modified-p nil)))))))
;; Delay 2 seconds after the init file error message
--
Kevin Rodgers
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-06-22 16:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-22 16:22 initial-scratch-message vs. initial-major-mode comment syntax Kevin Rodgers
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).