From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.bugs Subject: bug#14591: New keyword :local for defcustom Date: Tue, 11 Jun 2013 19:18:54 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1370971495 1622 80.91.229.3 (11 Jun 2013 17:24:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Jun 2013 17:24:55 +0000 (UTC) To: 14591@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 11 19:24:55 2013 Return-path: Envelope-to: geb-bug-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 1UmSJR-0007oB-JS for geb-bug-gnu-emacs@m.gmane.org; Tue, 11 Jun 2013 19:24:53 +0200 Original-Received: from localhost ([::1]:43403 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmSJR-0000lC-5V for geb-bug-gnu-emacs@m.gmane.org; Tue, 11 Jun 2013 13:24:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmSJM-0000gM-JP for bug-gnu-emacs@gnu.org; Tue, 11 Jun 2013 13:24:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UmSJL-0002xo-4U for bug-gnu-emacs@gnu.org; Tue, 11 Jun 2013 13:24:48 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmSJL-0002xe-06 for bug-gnu-emacs@gnu.org; Tue, 11 Jun 2013 13:24:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1UmSJa-00068o-Ec for bug-gnu-emacs@gnu.org; Tue, 11 Jun 2013 13:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juanma Barranquero Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 11 Jun 2013 17:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14591 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: Bug-Gnu-Emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.137097146523512 (code B ref -1); Tue, 11 Jun 2013 17:25:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Jun 2013 17:24:25 +0000 Original-Received: from localhost ([127.0.0.1]:56779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UmSIz-000679-27 for submit@debbugs.gnu.org; Tue, 11 Jun 2013 13:24:25 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42754) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UmSIx-00066m-07 for submit@debbugs.gnu.org; Tue, 11 Jun 2013 13:24:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UmSIa-0002oX-Pz for submit@debbugs.gnu.org; Tue, 11 Jun 2013 13:24:02 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:41030) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmSIa-0002oG-M1 for submit@debbugs.gnu.org; Tue, 11 Jun 2013 13:24:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmSIZ-00082U-Dw for bug-gnu-emacs@gnu.org; Tue, 11 Jun 2013 13:24:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UmSEJ-0001Mh-AO for bug-gnu-emacs@gnu.org; Tue, 11 Jun 2013 13:19:42 -0400 Original-Received: from mail-ea0-x22d.google.com ([2a00:1450:4013:c01::22d]:38437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmSEJ-0001MV-26 for bug-gnu-emacs@gnu.org; Tue, 11 Jun 2013 13:19:35 -0400 Original-Received: by mail-ea0-f173.google.com with SMTP id g15so6277517eak.4 for ; Tue, 11 Jun 2013 10:19:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=DAY2WtvMCpPJj1ZS1DkLjYE34i+ZWMub04kaeKGTWVY=; b=s2P52OtDJNEq7W+xM7oMQHTGusD8yhEP1aPdZ23KFYIQiyhxf8Cor314ULp0BqexVW c5aKilXAz8F9YbxDG+I7DpQf9uLsE2/Q2g1ucg5Fj3jz1Giqdig+EdUFN+b2lKPQ9iPA HPCcJIC0DulqDlTghKjM2QUUGSWAxeix6PbXQKLJ94uNcf1w3XjeMLIeHBoHxmabK/T0 Kfa6W4INCSADJA7ZE2Ez6r9H/rHitdMJeJ5nRg0ROEREFZYkaE/siSL+F/qUlSJIDL3T ZE8/UEBBMaoFywb1bkwgmRRHcTqzz9VKJrN6qPEAxUxPA8iHzVasgAxW2ZfSXl/xhGRT JoRg== X-Received: by 10.14.89.66 with SMTP id b42mr17600704eef.89.1370971174310; Tue, 11 Jun 2013 10:19:34 -0700 (PDT) Original-Received: by 10.14.142.4 with HTTP; Tue, 11 Jun 2013 10:18:54 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:74974 Archived-At: Package: emacs Version: 24.3.50 Severity: wishlist Tags: patch This patch adds a new keyword :local to defcustom, to simplify cases like (defcustom some-var some-val "A very long description filling many lines ... ... ..." ;; some keywords) (make-variable-buffer-local 'some-var) i.e., it tries to solve the same problem (non-locality) for customization variables that the new macro defvar-local solves for defvars. As designed, it accepts values 'local (which means make the symbol automatically buffer-local), 'permanent (which makes the symbol permanent-local), and t which does both. OK to the idea, the interface, comments...? Juanma 2013-06-11 Juanma Barranquero * custom.el (custom-declare-variable): Accept new keyword :local. (defcustom): Document it. === modified file 'etc/NEWS' --- etc/NEWS 2013-06-07 03:23:57 +0000 +++ etc/NEWS 2013-06-11 17:04:53 +0000 @@ -544,6 +544,9 @@ and functions should be separated by two hyphens if the symbol is not meant to be used by other packages. +** defcustom now has a new keyword :local to mark the variable as +automatically buffer-local and/or permanent-local. + * Changes in Emacs 24.4 on Non-Free Operating Systems === modified file 'lisp/custom.el' --- lisp/custom.el 2013-01-02 16:13:04 +0000 +++ lisp/custom.el 2013-06-11 16:44:11 +0000 @@ -173,6 +173,11 @@ (put symbol 'risky-local-variable value)) ((eq keyword :safe) (put symbol 'safe-local-variable value)) + ((eq keyword :local) + (when (memq value '(t local)) + (make-variable-buffer-local symbol)) + (when (memq value '(t permanent)) + (put symbol 'permanent-local t))) ((eq keyword :type) (put symbol 'custom-type (purecopy value))) ((eq keyword :options) @@ -246,6 +251,9 @@ :risky Set SYMBOL's `risky-local-variable' property to VALUE. :safe Set SYMBOL's `safe-local-variable' property to VALUE. See Info node `(elisp) File Local Variables'. +:local VALUE should be t, `local' or `permanent'. + If t or `local', mark SYMBOL as automatically buffer-local. + If t or `permanent', set SYMBOL's `permanent-local' property to t. The following common keywords are also meaningful.