Subject: Re: bug#63818: 27.1; unbound local variables break python-util-clone-local-variables

From: Eli Zaretskii <[email-masked]>
Date: Sat, 03 Jun 2023 10:22:41 +0300

> Date: Thu, 01 Jun 2023 23:36:24 +0900
> From: kobarity <[email-masked]>
> Cc: Ernesto Alfonso <[email-masked]>,
> 	Stefan Monnier <[email-masked]>,
> 	[email-masked]
> 
> > Stefan and kobarity, any comments?
> 
> I'm not familiar with this area, but I looked at the Orgmode code.  It
> was changed to use pcase.
> 
> (defun org-clone-local-variables (from-buffer &optional regexp)
>   "Clone local variables from FROM-BUFFER.
> Optional argument REGEXP selects variables to clone."
>   (dolist (pair (buffer-local-variables from-buffer))
>     (pcase pair
>       (`(,name . ,value)		;ignore unbound variables
>        (when (and (not (memq name org-unique-local-variables))
> 		  (or (null regexp) (string-match-p regexp (symbol-name name))))
> 	 (ignore-errors (set (make-local-variable name) value)))))))
> 
> This change seems to be based on the following discussion.
> 
> https://lists.gnu.org/archive/html/emacs-orgmode/2017-06/msg00037.html
> 
> Maybe we can adopt the same approach?

Our code is much simpler, so I don't see any need to use pcase here.

Thanks.