* Re: /srv/bzr/emacs/trunk r108127: New function set-temporary-overlay-map and macros (defvar|setq)-local.
[not found] <E1SQUYc-0000HU-Hb@vcs.savannah.gnu.org>
@ 2012-05-05 3:08 ` Leo
2012-05-05 3:37 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Leo @ 2012-05-05 3:08 UTC (permalink / raw)
To: emacs-devel
On 2012-05-05 09:47 +0800, Stefan Monnier wrote:
> ------------------------------------------------------------
> +** New macros `setq-local' and `defvar-local'.
I think setq-local is a bad name jarring with setq and setq-default.
How about implement it as a function like this?
(defun set-local (symbol newval)
"Set buffer-local value of SYMBOL to NEWVAL."
(set (make-local-variable symbol) newval))
setq-local can then be properly implemented to accept a list of
alternate [SYM VAL]s just like every setq*.
Leo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /srv/bzr/emacs/trunk r108127: New function set-temporary-overlay-map and macros (defvar|setq)-local.
2012-05-05 3:08 ` /srv/bzr/emacs/trunk r108127: New function set-temporary-overlay-map and macros (defvar|setq)-local Leo
@ 2012-05-05 3:37 ` Stefan Monnier
2012-05-05 13:05 ` Johan Bockgård
2012-05-05 14:58 ` Leo
0 siblings, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2012-05-05 3:37 UTC (permalink / raw)
To: Leo; +Cc: emacs-devel
>> ------------------------------------------------------------
>> +** New macros `setq-local' and `defvar-local'.
> I think setq-local is a bad name jarring with setq and setq-default.
Why "jarring"? I actually used setq-local, specifically because it is
similar to setq-default.
> How about implement it as a function like this?
> (defun set-local (symbol newval)
> "Set buffer-local value of SYMBOL to NEWVAL."
> (set (make-local-variable symbol) newval))
I've never seen this construction used with anything but a static
variable, so I don't think the difference matters much,
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /srv/bzr/emacs/trunk r108127: New function set-temporary-overlay-map and macros (defvar|setq)-local.
2012-05-05 3:37 ` Stefan Monnier
@ 2012-05-05 13:05 ` Johan Bockgård
2012-05-06 2:49 ` Leo
2012-05-05 14:58 ` Leo
1 sibling, 1 reply; 10+ messages in thread
From: Johan Bockgård @ 2012-05-05 13:05 UTC (permalink / raw)
To: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> ------------------------------------------------------------
>>> +** New macros `setq-local' and `defvar-local'.
>
>> I think setq-local is a bad name jarring with setq and setq-default.
>
> Why "jarring"? I actually used setq-local, specifically because it is
> similar to setq-default.
FWIW, I do find `set-temporary-overlay-map'--which has nothing to do
with overlays--jarring.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /srv/bzr/emacs/trunk r108127: New function set-temporary-overlay-map and macros (defvar|setq)-local.
2012-05-05 3:37 ` Stefan Monnier
2012-05-05 13:05 ` Johan Bockgård
@ 2012-05-05 14:58 ` Leo
2012-05-06 1:39 ` Stefan Monnier
1 sibling, 1 reply; 10+ messages in thread
From: Leo @ 2012-05-05 14:58 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
On 2012-05-05 11:37 +0800, Stefan Monnier wrote:
> Why "jarring"? I actually used setq-local, specifically because it is
> similar to setq-default.
The fact that (setq-local var1 val1 var2 val2 ...) doesn't work.
Leo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /srv/bzr/emacs/trunk r108127: New function set-temporary-overlay-map and macros (defvar|setq)-local.
2012-05-05 14:58 ` Leo
@ 2012-05-06 1:39 ` Stefan Monnier
2012-05-06 2:47 ` Leo
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2012-05-06 1:39 UTC (permalink / raw)
To: Leo; +Cc: emacs-devel
>> Why "jarring"? I actually used setq-local, specifically because it is
>> similar to setq-default.
> The fact that (setq-local var1 val1 var2 val2 ...) doesn't work.
Oh, yes, I always disliked this use, so obviously I didn't add it to
setq-local.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /srv/bzr/emacs/trunk r108127: New function set-temporary-overlay-map and macros (defvar|setq)-local.
2012-05-06 1:39 ` Stefan Monnier
@ 2012-05-06 2:47 ` Leo
2012-05-08 11:43 ` Nix
0 siblings, 1 reply; 10+ messages in thread
From: Leo @ 2012-05-06 2:47 UTC (permalink / raw)
To: emacs-devel
On 2012-05-06 09:39 +0800, Stefan Monnier wrote:
> Oh, yes, I always disliked this use, so obviously I didn't add it to
> setq-local.
I don't like that much either. but I am concerned about consistency
between these setq* special forms.
Leo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /srv/bzr/emacs/trunk r108127: New function set-temporary-overlay-map and macros (defvar|setq)-local.
2012-05-05 13:05 ` Johan Bockgård
@ 2012-05-06 2:49 ` Leo
2012-05-06 15:45 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Leo @ 2012-05-06 2:49 UTC (permalink / raw)
To: emacs-devel
On 2012-05-05 21:05 +0800, Johan Bockgård wrote:
> FWIW, I do find `set-temporary-overlay-map'--which has nothing to do
> with overlays--jarring.
Stefan, did you mean "overriding"?
Leo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /srv/bzr/emacs/trunk r108127: New function set-temporary-overlay-map and macros (defvar|setq)-local.
2012-05-06 2:49 ` Leo
@ 2012-05-06 15:45 ` Stefan Monnier
0 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2012-05-06 15:45 UTC (permalink / raw)
To: Leo; +Cc: emacs-devel
>> FWIW, I do find `set-temporary-overlay-map'--which has nothing to do
>> with overlays--jarring.
> Stefan, did you mean "overriding"?
Contrary to overriding-local-map and overriding-terminal-local-map,
set-temporary-overlay-map installs a map which does not disable
other maps (i.e. as soon as overriding-local-map is non-nil, most maps
(other than the global-map) become inactive, but not so with
set-temporary-overlay-map).
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: /srv/bzr/emacs/trunk r108127: New function set-temporary-overlay-map and macros (defvar|setq)-local.
2012-05-06 2:47 ` Leo
@ 2012-05-08 11:43 ` Nix
2012-05-08 14:12 ` /srv/bzr/emacs/trunk r108127: New functionset-temporary-overlay-map " Drew Adams
0 siblings, 1 reply; 10+ messages in thread
From: Nix @ 2012-05-08 11:43 UTC (permalink / raw)
To: Leo; +Cc: emacs-devel
On 6 May 2012, Leo told this:
> On 2012-05-06 09:39 +0800, Stefan Monnier wrote:
>> Oh, yes, I always disliked this use, so obviously I didn't add it to
>> setq-local.
>
> I don't like that much either. but I am concerned about consistency
> between these setq* special forms.
More generally, some people (e.g. me) *do* like it, and are unlikely to
use setq-local in our own code if it doesn't support something similar.
--
NULL && (void)
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: /srv/bzr/emacs/trunk r108127: New functionset-temporary-overlay-map and macros (defvar|setq)-local.
2012-05-08 11:43 ` Nix
@ 2012-05-08 14:12 ` Drew Adams
0 siblings, 0 replies; 10+ messages in thread
From: Drew Adams @ 2012-05-08 14:12 UTC (permalink / raw)
To: 'Nix', 'Leo'; +Cc: emacs-devel
> >> Oh, yes, I always disliked this use, so obviously I didn't
> >> add it to setq-local.
> >
> > I don't like that much either. but I am concerned about consistency
> > between these setq* special forms.
>
> More generally, some people (e.g. me) *do* like it, and are
> unlikely to use setq-local in our own code if it doesn't support
> something similar.
Not that I really care much about this... but FWIW -
For years I tended not to use `setq' for more than one assignment, feeling much
as what Stefan apparently feels. A few years back I started to change (I don't
recall why). And now I'm pretty much on the other side of the fence.
In general, I now find the multiple-assignment form more readable (less noise)
and lower maintenance. It is especially more readable to group assignments if
they are closely related. But even just in terms of general readability, I find
A better than B:
A:
(if whatever
(setq alpha (+ (beta) gamma)
delta epsilon
iota-omega (pool-fni dne-on))
(do-this)
(do-that)
(do-more)
(enough-already))
B:
(if whatever
(progn
(setq alpha (+ (beta) gamma))
(setq delta epsilon
(setq iota-omega (pool-fni dne-on)))
(do-this)
(do-that)
(do-more)
(enough-already))
Again, FWIW/YMMV. And if you argue that without clear layout it can be
confusing, I agree. Which is why I don't write it this way:
(setq alpha (+ (beta) gamma) delta
epsilon iota-omega (pool-fni dne-on))
So I think it's good for Emacs to support such syntax for `setq-local', other
things being equal (are they?). Nothing requires anyone to use it. And it is
consistent with setq, etc.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-05-08 14:12 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <E1SQUYc-0000HU-Hb@vcs.savannah.gnu.org>
2012-05-05 3:08 ` /srv/bzr/emacs/trunk r108127: New function set-temporary-overlay-map and macros (defvar|setq)-local Leo
2012-05-05 3:37 ` Stefan Monnier
2012-05-05 13:05 ` Johan Bockgård
2012-05-06 2:49 ` Leo
2012-05-06 15:45 ` Stefan Monnier
2012-05-05 14:58 ` Leo
2012-05-06 1:39 ` Stefan Monnier
2012-05-06 2:47 ` Leo
2012-05-08 11:43 ` Nix
2012-05-08 14:12 ` /srv/bzr/emacs/trunk r108127: New functionset-temporary-overlay-map " Drew Adams
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.