From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: I want an unsaveable buffer Date: Mon, 04 Aug 2014 23:28:24 -0600 Message-ID: References: <155DEC68569B714B86C2C7075F5EDA9892B0FA07@DAKIYA1.pegasus.local> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1407216576 26705 80.91.229.3 (5 Aug 2014 05:29:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Aug 2014 05:29:36 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 05 07:29:29 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XEXJL-0003Oc-Fx for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Aug 2014 07:29:23 +0200 Original-Received: from localhost ([::1]:56663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEXJK-0007j9-Vt for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Aug 2014 01:29:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEXJ1-0007ix-DH for help-gnu-emacs@gnu.org; Tue, 05 Aug 2014 01:29:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEXIr-0002DI-5U for help-gnu-emacs@gnu.org; Tue, 05 Aug 2014 01:29:03 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:35659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEXIq-0002DD-V2 for help-gnu-emacs@gnu.org; Tue, 05 Aug 2014 01:28:53 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XEXIp-0002ix-0r for help-gnu-emacs@gnu.org; Tue, 05 Aug 2014 07:28:51 +0200 Original-Received: from 75-166-203-90.hlrn.qwest.net ([75.166.203.90]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Aug 2014 07:28:51 +0200 Original-Received: from kevin.d.rodgers by 75-166-203-90.hlrn.qwest.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Aug 2014 07:28:51 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 18 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 75-166-203-90.hlrn.qwest.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <155DEC68569B714B86C2C7075F5EDA9892B0FA07@DAKIYA1.pegasus.local> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:99089 Archived-At: On 8/4/14 9:48 AM, Doug Lewan wrote: > I work in *scratch* a lot, /and/ I save (C-xC-s) very frequently just as a matter of habit. The consequence is that I find myself typing to the "File to save in:" prompt when I just want to continue working. > > Turning off or remapping C-xC-s in *scratch* is easy enough, but the obviously useful generalization is to turn saving off in any new buffer not associated with a regular file. (Writing buffer contents would remain, but you already have to think when you want that.) > > The natural route is to write a hook for buffer creation. The only hook I can find for that is buffer-list-update-hook which is also run on renaming, deletion, etc. I can imagine grabbing the output of (backtrace) to look at how the hook was called, but that no longer feels natural to me. > > Does anyone know of a natural approach to this? (defadvice save-buffer (around interactive-no-visited-file-name activate) "When called interactively, disable for buffers not visiting a file." (when (or (not (called-interactively-p 'any)) buffer-file-name) ad-do-it)) -- Kevin Rodgers Denver, Colorado, USA