From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.help Subject: Re: enable-local-variables and emacs --batch Date: Sat, 3 Nov 2018 08:49:03 -0400 Message-ID: References: <83a7mqfrll.fsf@gnu.org> <8336sifnfx.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1541249334 17900 195.159.176.226 (3 Nov 2018 12:48:54 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 3 Nov 2018 12:48:54 +0000 (UTC) Cc: Help Gnu Emacs mailing list To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 03 13:48:50 2018 Return-path: Envelope-to: geh-help-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 1gIvM9-0004Uo-TN for geh-help-gnu-emacs@m.gmane.org; Sat, 03 Nov 2018 13:48:50 +0100 Original-Received: from localhost ([::1]:55520 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gIvOG-0007pZ-2p for geh-help-gnu-emacs@m.gmane.org; Sat, 03 Nov 2018 08:51:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gIvNR-0007pS-1A for help-gnu-emacs@gnu.org; Sat, 03 Nov 2018 08:50:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gIvNL-00064P-AU for help-gnu-emacs@gnu.org; Sat, 03 Nov 2018 08:50:06 -0400 Original-Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]:40160) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gIvN2-0005PL-UC; Sat, 03 Nov 2018 08:49:46 -0400 Original-Received: by mail-lj1-x22b.google.com with SMTP id t22-v6so4031543lji.7; Sat, 03 Nov 2018 05:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OZu+O5//th3RaGVWne7WLi2ggtgix9W5ycEltMGd8Yk=; b=Cg53sYGhVzT3TQ5TfFJktLR2/PJUqDKWkn7Dv9pDGJWkYy46vsZxuCx2AgSPCvy/cm 0SOs8F9SZzWzTNpRAbCVtCeH86t1kOkiX6xWmAqIFCeFbfCqmCzG5KqQbgntk9lgXSTY bk7PXrnQbTNS5gOOSCIgCUKjitm8DUEELQzMXnazkleYTTGauUnql0rlCr4ws5xHT59R I7kgGugWAfAqqddU8ZvbyDNRs6lMuDTrILMIpx+e1tI0abDgMhI36OC+597dgyiMKF9q oLAlAHCuI3OqcimAnhxvYIODKkztmsKEiZ6D0JChDd9Qy4iy4meZD4L0p2Duo7rCPeBH uIYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OZu+O5//th3RaGVWne7WLi2ggtgix9W5ycEltMGd8Yk=; b=Q8EFmqn00oPzpjsv3TRR68OYBw8TTx3tYepJ3WSzcOaqZYZzmkkzWpjqvoNLevKPMR FXnTCejAb19W/C83kgYCppHrDxEG+uH5DE3w/53PIpyipGKMtu1pQSiW+PhmKzTdXv1m 2Lvf4GbyBgAnTvZIRXFyHirWEks6egQ4lN5cueLy8i5EazHJwrnU6Dd4dS0WZ67QhxoK Wy09+f7Nk5N0zFOAR5ke9v58tdgt9+FMyxnW1AxVUyfyHbci4T5liL/ZdP1srea8uMLA VPiQkZuYmviAWsVQYPoedhMwurH+QYD4RgYKotQIEzemDHjIjT8k8z8wSx5KMbYi+HRp N5zA== X-Gm-Message-State: AGRZ1gKaud4B5tYRpZsDiBUlmQnxViZhtHFhiXJtk7JvgH2beb3y+wo6 iwr8q9Jo2jw+hNCgsJ30s7mqVLZsxU0MDmzD7QuOHT3i X-Google-Smtp-Source: AJdET5cGVMWcuR8/g5tIl/JfWNMYArmIyzB8B19wUZZqCarAjN59cUPzTrUdkulP80Q9IA/6TVKiHqgvPpPsf7zGLNI= X-Received: by 2002:a2e:5109:: with SMTP id f9-v6mr9871553ljb.52.1541249380544; Sat, 03 Nov 2018 05:49:40 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::22b X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:118580 Archived-At: On Sat, Nov 3, 2018 at 7:21 AM Kaushal Modi wrote: > Now the challenge is edebugging in --batch mode. I don't know how to edebug in --batch, but I tried to used messages, to get confused even more. I couldn't reproduce the issue in that minimal example, so just added debug messages to my actual code. Below is the debug output while the .org file is opened in emacs --batch. Debug code: ===== (message "file: %S" (buffer-file-name)) (message "enable-local-variables = %S" enable-local-variables) (message "org-hugo-section (safe-local-variable) = %S" (get 'org-hugo-section 'safe-local-variable)) (if-let* ((valid-dir-locals-found (dir-locals-find-file (buffer-file-name))) (dir (if (listp valid-dir-locals-found) (car valid-dir-locals-found) valid-dir-locals-found))) (message ".dir-locals.el file: %s" (car (dir-locals--all-files dir)))) (message "[ox-hugo section-path DBG] org-hugo-section: %S" org-hugo-section) ===== Output: ===== file: "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content-org/dir-locals/dir-locals-test.org" enable-local-variables = t org-hugo-section (safe-local-variable) = stringp .dir-locals.el file: /home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content-org/dir-locals/.dir-locals.el [ox-hugo section-path DBG] org-hugo-section: "posts" ===== Content in ..content-org/dir-locals/.dir-locals.el: ===== ((nil . ((indent-tabs-mode . nil) (fill-column . 70) (sentence-end-double-space . t))) (org-mode . ((mode . auto-fill) (org-hugo-section . "dir-locals-test") (org-hugo-front-matter-format . "yaml") (org-hugo-footer . "\n\nThis text is auto inserted at the end of the exported Markdown.") (org-hugo-preserve-filling . nil) (org-hugo-use-code-for-kbd . t) (org-hugo-export-with-toc . t) (org-hugo-export-with-section-numbers . t) (org-hugo-export-creator-string . "Dummy creator string") (org-hugo-date-format . "%Y-%m-%d") (org-hugo-auto-export-on-save . t)))) ===== So my confusion ..: 1. Checked that enable-local-variables is t ("enable-local-variables = t" in debug) 2. Checked that org-hugo-section is marked as safe if it's a string ("org-hugo-section (safe-local-variable) = stringp" in debug) 3. Checked that the correct .dir-locals.el file is applied (".dir-locals.el file: /home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content-org/dir-locals/.dir-locals.el" in debug) 4. See that .dir-locals.el file above and the value of org-hugo-section -> (org-hugo-section . "dir-locals-test") <- it is "dir-locals-test" .. and it is a string! But still the value read of `org-hugo-section' in that .org file buffer is "posts"!! (in debug -> [ox-hugo section-path DBG] org-hugo-section: "posts") So this happens only in emacs --batch, not when I open that file manually in a regular Emacs session. Help?