From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#17205: 24.3.50; dired and directory variables Date: Sat, 23 Jan 2021 23:12:36 +0100 Message-ID: <87o8hfs3or.fsf@gnus.org> References: <877g72d3d4.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30014"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 17205@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 23 23:13:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l3R9Z-0007iO-Vt for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Jan 2021 23:13:09 +0100 Original-Received: from localhost ([::1]:59856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3R9Z-0002sQ-1j for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Jan 2021 17:13:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3R9S-0002rx-4z for bug-gnu-emacs@gnu.org; Sat, 23 Jan 2021 17:13:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52199) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3R9R-0001HD-U5 for bug-gnu-emacs@gnu.org; Sat, 23 Jan 2021 17:13:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l3R9R-00051B-Ob for bug-gnu-emacs@gnu.org; Sat, 23 Jan 2021 17:13:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Jan 2021 22:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17205 X-GNU-PR-Package: emacs Original-Received: via spool by 17205-submit@debbugs.gnu.org id=B17205.161143997919269 (code B ref 17205); Sat, 23 Jan 2021 22:13:01 +0000 Original-Received: (at 17205) by debbugs.gnu.org; 23 Jan 2021 22:12:59 +0000 Original-Received: from localhost ([127.0.0.1]:35509 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3R9O-00050j-Ld for submit@debbugs.gnu.org; Sat, 23 Jan 2021 17:12:58 -0500 Original-Received: from quimby.gnus.org ([95.216.78.240]:56506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3R9K-00050Q-5k for 17205@debbugs.gnu.org; Sat, 23 Jan 2021 17:12:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=eQFYlLW82qLNre+VX5P1BHdrYUmJNr8rI0jLimyZ0jU=; b=R54G50v0e/RmX6zbmacYZxPY3o IYOhHKC8KX6J8eqhlIMbS8fOXIoUF7g/L/vlcbbJotjoNeJuseTokeY1WecrNs+3tIcwpxrDsBF8j ZAUtnbOW3HL1HmqZc2O4e5fGkuaIISsJOR+RFGSWYfbQ6AcPmduSup/zBqP4+7uSwY6A=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l3R93-0005z7-LW; Sat, 23 Jan 2021 23:12:48 +0100 X-Now-Playing: Little Annie Anxiety & Hiro Kone's _Repossessed_: "Third Gear" In-Reply-To: <877g72d3d4.fsf@web.de> (Michael Heerdegen's message of "Sun, 06 Apr 2014 14:55:19 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:198474 Archived-At: Michael Heerdegen writes: > dired doesn't play well with directory local variables. The manual > (info "(emacs) Directory Variables") seems to say that they would work > with dired, but I found several problems with that (all this in emacs > -Q): > > 1. In dired, they (sometimes?) take effect only in subdirectories, but > not in the directory where they are specified. > > Example: In my ~, I create a .dir-locals.el with the content > > ((nil . ((a . "hallo")))) > > When I now open a dired buffer of ~, `a' is undefined. When I open any > file below ~, `a' is bound as expected. (I'm going through old bug reports that unfortunately got no response at the time.) I'm unable to reproduce this in Emacs 28 -- if I put that into ~/.dir-locals.el, then the `a' variable is set (after some prompting about the safety). > 2. Being able to use use `dired-listing-switches' as a directory > variable would obviously be very useful. But it has no effect, even not > in subdirectories. OTOH, using `dired-actual-switches' has an effect, > it leads to a sorting as expected, even (contrary to 1.) in the > directory that contains the dir locals file. This also seems to work for me in Emacs 28 with a file of ((nil . ((a . "hallo") (dired-listing-switches "-l")))) > 3. `dir-locals-collect-variables' "destroys" any (subdirs . nil) > specification: > > I change the .dir-locals.el in my ~ to the following content: > > ((nil . ((a . "hallo") > (subdirs . nil)))) > > and restart Emacs. > > Now I dired ~. After that, I visit any file somewhere under ~ (this can > be a regular file or a directory). `a' will be bound in that buffer. > > This doesn't happen if I don't dired ~ before. The cause seems to be > this line in `dir-locals-collect-variables': > > (setq alist (delq subdirs alist)) > > which modifies the cached alist sturcture destructively (permanently!). > The `delq' should be a `remq', I guess. I am able to reproduce this bit, though, and indeed, changing the delq to remq fixes this problem. Do all these cases work for you, too, in Emacs 28? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no