From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: isolating history with buffer-local variables Date: Wed, 13 May 2015 17:39:24 -0400 Message-ID: References: <54AE8A33-FB8D-4F63-8BC1-F84DB290EF05@tenpoint.co.nz> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1431553202 11693 80.91.229.3 (13 May 2015 21:40:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 May 2015 21:40:02 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 13 23:39:54 2015 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 1YseNe-0006PQ-1C for geh-help-gnu-emacs@m.gmane.org; Wed, 13 May 2015 23:39:54 +0200 Original-Received: from localhost ([::1]:51584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YseNd-0001YE-IS for geh-help-gnu-emacs@m.gmane.org; Wed, 13 May 2015 17:39:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YseNR-0001Y6-B9 for help-gnu-emacs@gnu.org; Wed, 13 May 2015 17:39:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YseNN-0004fN-6q for help-gnu-emacs@gnu.org; Wed, 13 May 2015 17:39:41 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:53350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YseNM-0004f6-Vd for help-gnu-emacs@gnu.org; Wed, 13 May 2015 17:39:37 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YseNL-0006IJ-Kp for help-gnu-emacs@gnu.org; Wed, 13 May 2015 23:39:35 +0200 Original-Received: from 69-165-139-108.dsl.teksavvy.com ([69.165.139.108]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 May 2015 23:39:35 +0200 Original-Received: from monnier by 69-165-139-108.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 May 2015 23:39:35 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 54 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 69-165-139-108.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:BlX6brkPvlrrxthkAT+QgzFz8gA= 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:104446 Archived-At: Thanks. I think this functionality is important and should largely be activated automatically when visiting encrypted files (not sure which other files/buffers would warrant such behavior). So I'm happy to see you work on this, and I encourage you try and make it work well, and contribute your code so we can include it directly in Emacs. > (if (symbol-value private-mode) `private-mode' will normally have value either t or nil, and the symbol-value of nil is nil and the symbol-value of t is t, so the above is better written as "(if private-mode". > (setq private-variables '( ;; data to isolate > minibuffer-history ;; <-- not working > command-history ;; ok > extended-command-history ;; <-- not working > string-rectangle-history ;; <-- not working > query-replace-history ;; ok > search-ring ;; ok > regexp-search-ring ;; ok > kill-ring ;; ok > backup-inhibited ;; ok > auto-save-timeout)) ;; ok This should probably be moved out to a defvar. > (setq backup-inhibited t) ;; locally disable backups > (setq auto-save-timeout 0)) ;; locally idle auto-saves For encrypted files (accessed via EPA), the above should be correctly handled already (either by preventing autosave/backups or by keeping those files encrypted just like the main file). If you find they're not, please file it as a bug. > All the local auto-save/backup vars, local ring vars, and local > query-replace-history and command-history vars work as intended. But > minibuffer-history, extended-command-history and > string-rectangle-history do not. The buffer-local vars for these are > made as expected, but they are ignored and histories continue to > accumulate in the global variables. I think Pascal has the right explanation for that. > Any idea why? Anyone have suggestions for a different approach or > a way around the problem? You'll probably need to hack read-from-minibuffer (e.g. with an advice) so as to redirect the history variable to another variable, or to cleanup the variable after the fact. Stefan