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

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

initial-scratch-message vs. initial-major-mode comment syntax


From: Kevin Rodgers
Subject: initial-scratch-message vs. initial-major-mode comment syntax
Date: Tue, 22 Jun 2004 10:22:13 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

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





reply via email to

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