From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#32817: 27.0.50; Dotted pair syntax for directory-local variables Date: Mon, 24 Sep 2018 02:14:41 +0300 Organization: LINKOV.NET Message-ID: <87bm8nolge.fsf@mail.linkov.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1537744506 18147 195.159.176.226 (23 Sep 2018 23:15:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Sep 2018 23:15:06 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) To: 32817@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 24 01:15:02 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4Daf-0004Ys-Mv for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Sep 2018 01:15:02 +0200 Original-Received: from localhost ([::1]:42829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4Dcl-0007v8-QM for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Sep 2018 19:17:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4Dcf-0007uq-6K for bug-gnu-emacs@gnu.org; Sun, 23 Sep 2018 19:17:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4Dcc-0000oG-2T for bug-gnu-emacs@gnu.org; Sun, 23 Sep 2018 19:17:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46947) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g4Dcb-0000oA-Uo for bug-gnu-emacs@gnu.org; Sun, 23 Sep 2018 19:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g4Dcb-0004nm-Pw for bug-gnu-emacs@gnu.org; Sun, 23 Sep 2018 19:17:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Sep 2018 23:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32817 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.153774459718419 (code B ref -1); Sun, 23 Sep 2018 23:17:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Sep 2018 23:16:37 +0000 Original-Received: from localhost ([127.0.0.1]:51205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4DcC-0004n1-TS for submit@debbugs.gnu.org; Sun, 23 Sep 2018 19:16:37 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59920) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4DcA-0004mm-6n for submit@debbugs.gnu.org; Sun, 23 Sep 2018 19:16:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4Dc1-0000at-32 for submit@debbugs.gnu.org; Sun, 23 Sep 2018 19:16:29 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:41588) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g4Dbw-0000a4-29 for submit@debbugs.gnu.org; Sun, 23 Sep 2018 19:16:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4Dbv-0007sU-3m for bug-gnu-emacs@gnu.org; Sun, 23 Sep 2018 19:16:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4Dbq-0000Z5-7a for bug-gnu-emacs@gnu.org; Sun, 23 Sep 2018 19:16:18 -0400 Original-Received: from pop.dreamhost.com ([64.90.62.162]:46418 helo=pdx1-sub0-mail-a31.g.dreamhost.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g4Dbn-0000YP-RW for bug-gnu-emacs@gnu.org; Sun, 23 Sep 2018 19:16:13 -0400 Original-Received: from pdx1-sub0-mail-a31.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a31.g.dreamhost.com (Postfix) with ESMTP id 583F67F6EA for ; Sun, 23 Sep 2018 16:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:date:message-id:mime-version:content-type; s= linkov.net; bh=JLu7uacdcHewFVWUwh8VwhkIfoE=; b=OLqQPxVhQsOshjy9/ mHD4tMsAM9l7nXPBSLWCJ/VPCpgoKTgsIzlcKtbmWM+14GC/Z0rf7nrCBWpShi32 8Zi408CCSVIu0imdDbGN66GKTekrIbhFxfgTfG9xsyNmHRPZwtKxweUn8m+4FM40 mWs4qrZeT3uSCOW8twGpW7j1EA= Original-Received: from localhost.linkov.net (m91-129-111-128.cust.tele2.ee [91.129.111.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a31.g.dreamhost.com (Postfix) with ESMTPSA id 16A777F37F for ; Sun, 23 Sep 2018 16:16:07 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a31 X-DH-BACKEND: pdx1-sub0-mail-a31 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:150581 Archived-At: As indicated in https://lists.gnu.org/archive/html/emacs-devel/2018-09/msg00817.html the current syntax is confusing. This patch fixes add-dir-local-variable to output syntax corresponding to examples in (info "(emacs) Directory Variables"): diff --git a/lisp/files-x.el b/lisp/files-x.el index 92532e85f4..8603b6299c 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el @@ -492,15 +492,31 @@ modify-dir-local-variable ;; Insert modified alist of directory-local variables. (insert ";;; Directory Local Variables\n") (insert ";;; For more information see (info \"(emacs) Directory Variables\")\n\n") - (pp (sort variables + (princ (add-dir-local-variables-to-string + (sort variables (lambda (a b) (cond ((null (car a)) t) ((null (car b)) nil) ((and (symbolp (car a)) (stringp (car b))) t) ((and (symbolp (car b)) (stringp (car a))) nil) - (t (string< (car a) (car b)))))) - (current-buffer))))) + (t (string< (car a) (car b))))))) + (current-buffer)) + (goto-char (point-min)) + (indent-sexp)))) + +(defun add-dir-local-variables-to-string (variables) + (format "(%s)" (mapconcat + (lambda (mode-variable) + (format "(%S . %s)" + (car mode-variable) + (format "(%s)" (mapconcat + (lambda (variable-value) + (format "(%s . %S)" + (car variable-value) + (cdr variable-value))) + (cdr mode-variable) "\n")))) + variables "\n"))) ;;;###autoload (defun add-dir-local-variable (mode variable value)