From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add `notes' function to store random notes across Emacs restarts. Date: Mon, 17 Jun 2013 19:00:06 +0200 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1371488557 28178 80.91.229.3 (17 Jun 2013 17:02:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Jun 2013 17:02:37 +0000 (UTC) Cc: Ted Zlatanov , Stefan Monnier , Emacs developers To: Michal Nazarewicz Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 17 19:02:38 2013 Return-path: Envelope-to: ged-emacs-devel@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 1Uocp9-0001lU-K1 for ged-emacs-devel@m.gmane.org; Mon, 17 Jun 2013 19:02:35 +0200 Original-Received: from localhost ([::1]:44149 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uocp9-0000BV-5P for ged-emacs-devel@m.gmane.org; Mon, 17 Jun 2013 13:02:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uocod-00009p-3q for emacs-devel@gnu.org; Mon, 17 Jun 2013 13:02:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UocoD-00067Y-DP for emacs-devel@gnu.org; Mon, 17 Jun 2013 13:02:03 -0400 Original-Received: from mail-ee0-x22c.google.com ([2a00:1450:4013:c00::22c]:58392) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uocnd-00062A-Nn; Mon, 17 Jun 2013 13:01:01 -0400 Original-Received: by mail-ee0-f44.google.com with SMTP id c13so1988085eek.31 for ; Mon, 17 Jun 2013 10:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=snmSr+eTesXs/nyiqydE5CX7YMHs6xcO9tA31eSt8ZM=; b=VMjZX0NkoXi241zJlbvu060/Q6ZTObjkxzo/LOTQX9bxQ/oqHAnSXtXXooHfTlndy0 iNyKvYesld61/3RBEiFGyy4SPKz1CwYZNbZ2x/9w9rxS6WxowYpa2QXSvr0v7ioqf2LD +ucNEMIRH3q+a+dTpLHVyOVOB3lYVp49Mlw2bydUrsy4ARouVzFjPzTV2Xe3vWHHU+dH ynFajBnBguULzHse65xfWhqZSaM+wWA5QbLp/Ep42UdCqeY4xblbkLaFUdj6gpjfqRg5 p4TiiWlPUpvUCNk80m3XSMtJHSkA94pb2ujEORcM03qZDIAFnQQJ3SkuoyBgSBXHwxq9 h2DA== X-Received: by 10.15.102.68 with SMTP id bq44mr4730808eeb.89.1371488460750; Mon, 17 Jun 2013 10:01:00 -0700 (PDT) Original-Received: by 10.14.142.4 with HTTP; Mon, 17 Jun 2013 10:00:06 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::22c X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:160512 Archived-At: On Mon, Jun 17, 2013 at 6:13 PM, Michal Nazarewicz wrote: > +(defcustom notes-file (locate-user-emacs-file "notes" ".notes") This is a new feature, so no need to check for .notes. Use just (locate-user-emacs-file "notes") > + "File to save notes in. > +When set via customize `buffer-file-name' variable of the notes buffer > +\(if it exists) will be changed." The wording is a bit weird. What you do mean is that it will set the visited file of the buffer. > +Name of the created buffer is taken from `notes-buffer-name' variable > +and if buffer with that name already exist (but was not created by if /a/ buffer > +`notes' function), its content will be overwritten. > +only one C-c C-c binding which saves and buries the buffer. Use \\[notes-save-and-bury] instead of hard-coded C-c C-c > + ;; We don't want a "Buffer modified" prompt from kill-buffer so > + ;; we have to use advice rather than a hook. > + (advice-add 'kill-buffer :around 'notes--kill-buffer-advice) Why cannot that be done from kill-buffer-hook? > +(defun save-and-bury-buffer () > + "Saves and buries current buffer. > +If `buffer-modified-p' return non-nil current buffer will be > +saved via the `save-buffer' function. Regardless of modification Why it is important to note that it will be saved via `save-buffer'? > +state, it will also be buried with `burre-buffer'." /bury-buffer/ J