emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: buffer local variables handled wrong [9.0.5 (release_9.0.5-497-g5bc540 @ /home/hs/.emacs.d/lib/org-mode/lisp/)]
Date: Sun, 4 Jun 2017 08:57:33 +0200	[thread overview]
Message-ID: <20170604065733.GG7145@seven> (raw)
In-Reply-To: <87a85olrzq.fsf@nicolasgoaziou.fr>

Mail von Nicolas Goaziou, Sat, 03 Jun 2017 at 22:46:01 +0200:

Good morning,

> >
> > This error comes from org-clone-local-variables, because there the
> > prediction for local variables is always to be a list.
> 
> Fixed. Thank you for the report and the analysis.

Thanks.

Because for me pcase is magic, I tried to understand your corretion of the
code.

To understand it I expanded the pcase form with (macrostep-expand), e.g. in
org-agenda-mode:

,----
| (defun org-agenda-mode ()
| ...
| 	   (mapc #'make-local-variable org-agenda-local-vars)
| 	   (dolist (elem save)
| 	     (if
| 		 (consp elem)
| 		 (let*
| 		     ((x
| 		       (car elem))
| 		      (x
| 		       (cdr elem)))
| 		   (if
| 		       (consp x)
| 		       (let*
| 			   ((x
| 			     (car x))
| 			    (x
| 			     (cdr x)))
| 			 (if
| 			     (null x)
| 			     (let
| 				 ((val x)
| 				  (var x))
| 			       (when
| 				   (and val
| 					(memq var org-agenda-local-vars))
| 				 (set var val)))
| 			   nil))
| 		     nil))
| 	       nil)))
| 	 (setq-local org-agenda-this-buffer-is-sticky t))
| ...
`----

for me it looks not correct, because var and val get expanded to (cdr
(cdr elem)).

Also the second one

,----
| (defun org-clone-local-variables (from-buffer &optional regexp)
| ...
|   (dolist (pair (buffer-local-variables from-buffer))
|     (if
| 	(consp pair)
| 	(let*
| 	    ((x
| 	      (car pair))
| 	     (x
| 	      (cdr pair)))
| 	  (if
| 	      (consp x)
| 	      (let*
| 		  ((x
| 		    (cdr x)))
| 		(if
| 		    (null x)
| 		    (let
| 			((name x))
| 		      (when
| 			  (and
| 			   (not
| 			    (memq name org-unique-local-variables))
| 			   (or
| 			    (null regexp)
| 			    (string-match-p regexp
| 					    (symbol-name name))))
| 			(set
| 			 (make-local-variable name)
| 			 (cdr pair))))
| 		  nil))
| 	    nil))
|       nil)))
`----

here name get expanded to (cdr (cdr pair)).

For me both cases don't look correct or do I missinterpret something?

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.

  reply	other threads:[~2017-06-04  6:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-03 11:48 Bug: buffer local variables handled wrong [9.0.5 (release_9.0.5-497-g5bc540 @ /home/hs/.emacs.d/lib/org-mode/lisp/)] Stefan-W. Hahn
2017-06-03 20:46 ` Nicolas Goaziou
2017-06-04  6:57   ` Stefan-W. Hahn [this message]
2017-06-04  7:19     ` Nicolas Goaziou
2017-06-04  8:08       ` Stefan-W. Hahn
2017-06-04  8:24         ` Nicolas Goaziou
2017-06-04  9:18           ` Stefan-W. Hahn
2017-06-04  9:35             ` Nicolas Goaziou
2017-06-04  9:52               ` Stefan-W. Hahn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170604065733.GG7145@seven \
    --to=stefan.hahn@s-hahn.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).