From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chetan Newsgroups: gmane.emacs.help Subject: Re: How to get rid of *GNU Emacs* buffer on start-up? Date: Sat, 27 Sep 2008 05:42:23 -0700 Organization: Noname Inc. Message-ID: References: <87ljxoffs6.fsf@atthis.clsnet.nl> <71208e97-140c-445d-8eda-1705f11b14b3@r15g2000prd.googlegroups.com> <095ef0c0-c7f4-494d-8bf6-8a5ee43fd934@i20g2000prf.googlegroups.com> <3c61c357-0705-4ff4-b793-fa6827415fdd@n38g2000prl.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1222537793 10182 80.91.229.12 (27 Sep 2008 17:49:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 27 Sep 2008 17:49:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Sep 27 19:50:51 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KjdwQ-0006Zp-8C for geh-help-gnu-emacs@m.gmane.org; Sat, 27 Sep 2008 19:50:50 +0200 Original-Received: from localhost ([127.0.0.1]:37956 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KjdvN-0000xG-GG for geh-help-gnu-emacs@m.gmane.org; Sat, 27 Sep 2008 13:49:45 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!flpi089.ffdc.sbc.com!prodigy.net!flpi088.ffdc.sbc.com!prodigy.com!flpi107.ffdc.sbc.com!nlpi069.nbdc.sbc.com.POSTED!8e1d8614!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Emacs Gnus Cancel-Lock: sha1:fyy52moeXTQRdlTy4oVNBY4CSLw= Original-Lines: 98 Original-NNTP-Posting-Host: 75.36.179.225 Original-X-Complaints-To: abuse@prodigy.net Original-X-Trace: nlpi069.nbdc.sbc.com 1222519347 ST000 75.36.179.225 (Sat, 27 Sep 2008 08:42:27 EDT) Original-NNTP-Posting-Date: Sat, 27 Sep 2008 08:42:27 EDT X-UserInfo1: [[PAPDONEJVOBTLZOZKN^_TDFZ\@@FXLM@TDOCQDJ@_@FNXACNVOPCWZBL[\YUWHANGYZEFNHFZPNLOBUNSS^_LGEVWEY\PHO@YJSSWBBDT\PFD^ESBTXVCCMTD]JCJLE\_IJMFNRY]SWE[S[D_CNB__ZK^VGVCKHA[S@COB^[@ZQSDFQ\BPMS@DZVUKQTJL Original-Xref: news.stanford.edu gnu.emacs.help:162794 X-Mailman-Approved-At: Sat, 27 Sep 2008 13:49:25 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:58145 Archived-At: Here are my changes. ;;; Buffer created by this function is a temp buffer. It has no auto-save. It is saved by ;;; save-some-buffers only with prefix argument, will not be saved by M-x compile etc. (defun create-new-buffer(name &optional scratch) "Generate a new buffer with the specified name in default major mode. There is no auto save for this buffer until a file name is specified. The optional argument scratch specifies if the buffer is for scratch purposes and will not be deleted." (let ((buf (generate-new-buffer name))) (set-buffer-major-mode buf) (switch-to-buffer buf) (setq buffer-offer-save (not scratch)))) ;;; save-some-buffers C-x s will not save it ;;; save-buffer C-x C-s will ask for a file name if not specified ;;; no auto save since there is no recovery (defun new-buffer(&optional name mode) "Create a new buffer that can be saved later to a file." (interactive) (let ((default-major-mode (or mode 'text-mode))) (create-new-buffer (or (stringp name) "Untitled"))) (add-hook 'kill-buffer-query-functions 'buffer-kill-query nil t)) (defun new-scratch-buffer(&optional arg) "Create a new temporary buffer." (interactive) (create-new-buffer "*scratch*" t)) (defun choice (msg possibilities) (let ((cursor-in-echo-area t) nmsg answer) (while (not (memq answer possibilities)) (setq nmsg (format "%s [%s] " msg (mapconcat (function (lambda(x) (char-to-string (downcase x)))) possibilities "/"))) (cond (t (message "%s" (propertize nmsg 'face 'minibuffer-prompt)) (setq answer (capitalize (read-char-exclusive)))) (nil (setq answer (capitalize (string-to-char (read-from-minibuffer nmsg))))))) answer)) (defun buffer-kill-choice (msg) (let ((possibilities (list ?C ?K ?S)) answer ev) (setq answer (choice msg possibilities)) (cond ((eq answer ?C) (message "Buffer retained.") nil) ((eq answer ?K) t) ((eq answer ?S) (save-buffer) t)))) (defun buffer-kill-query () (cond ((and buffer-offer-save (buffer-modified-p)) (cond ((and (null buffer-file-name) (> (buffer-size) 0)) (buffer-kill-choice (format "Buffer %s has not been saved to a file. Cancel/Kill/Save?" (buffer-name)))) (t t))) (t t))) (when (featurep 'menu-bar) (setq menu-bar-buffers-menu-command-entries (append menu-bar-buffers-menu-command-entries (list (list 'new-buffer 'menu-item "Create New Buffer" 'new-buffer :help "Create a new buffer and select it in the current window"))))) ;;; end =============== Diff -U3 from 22.3 version of file --- simple.org.el +++ simple.el @@ -90,9 +90,8 @@ buffer visible-ok frame) (get-next-valid-buffer (nreverse (buffer-list frame)) buffer visible-ok frame) - (progn - (set-buffer-major-mode (get-buffer-create "*scratch*")) - (get-buffer "*scratch*")))) + (get-buffer "*scratch*") + (current-buffer))) (defun next-buffer () "Switch to the next buffer in cyclic order." =============== File buffer.c function Fother_buffer. if (NILP (buf)) { #if 0 buf = Fget_buffer_create (build_string ("*scratch*")); Fset_buffer_major_mode (buf); #else buf = buffer; #endif } return buf; }