unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Revisiting `setq-local`s signature
@ 2017-01-30 18:37 Jordon Biondo
  2017-01-31  3:47 ` Tino Calancha
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Jordon Biondo @ 2017-01-30 18:37 UTC (permalink / raw)
  To: Emacs development discussions

[-- Attachment #1: Type: text/plain, Size: 848 bytes --]

A while ago I brought up the inconstant signatures of `setq`,
`setq-default` and `setq-local`. In short, I want `setq-local` to have the
same signature as `setq` and `setq-local`. (setq* VAR VAL VAR VAL...)

See thread:
http://lists.gnu.org/archive/html/emacs-devel/2015-03/msg00448.html

I appreciate Stefan's input back then, but I'd like to revisit the issue,
get further input, and see if I can change some minds about the issue.

If you believe the variadic signature of `setq` and `setq-default` is not
ideal, consider that backwards compatibility erases any chance that those
two functions will lose that feature, and consider the benefits of being
consistently wrong over being inconsistently right.

Are maintainers and users still opposed to this change? If not I'd be happy
to update the patch from the previous thread.

Regards
-Jordon

[-- Attachment #2: Type: text/html, Size: 1095 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Revisiting `setq-local`s signature
  2017-01-30 18:37 Revisiting `setq-local`s signature Jordon Biondo
@ 2017-01-31  3:47 ` Tino Calancha
  2017-01-31 18:13 ` Philipp Stephani
  2017-02-02  3:01 ` John Wiegley
  2 siblings, 0 replies; 15+ messages in thread
From: Tino Calancha @ 2017-01-31  3:47 UTC (permalink / raw)
  To: Jordon Biondo; +Cc: Emacs development discussions, Tino Calancha

[-- Attachment #1: Type: text/plain, Size: 1081 bytes --]



On Mon, 30 Jan 2017, Jordon Biondo wrote:

> A while ago I brought up the inconstant signatures of `setq`, `setq-default` and `setq-local`. In short, I want `setq-local` to
> have the same signature as `setq` and `setq-local`. (setq* VAR VAL VAR VAL...)
> See thread: http://lists.gnu.org/archive/html/emacs-devel/2015-03/msg00448.html
> 
> I appreciate Stefan's input back then, but I'd like to revisit the issue, get further input, and see if I can change some minds
> about the issue.
> 
> If you believe the variadic signature of `setq` and `setq-default` is not ideal, consider that backwards compatibility erases any
> chance that those two functions will lose that feature, and consider the benefits of being consistently wrong over being
> inconsistently right.
> 
> Are maintainers and users still opposed to this change? If not I'd be happy to update the patch from the previous thread.

Richard Stallman <rms@gnu.org> writes:
> It is most natural for setq-local to have the same calling convention
> as setq.
+1
FWIW, i am in favour of naturalness too.

Regards,
Tino

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Revisiting `setq-local`s signature
  2017-01-30 18:37 Revisiting `setq-local`s signature Jordon Biondo
  2017-01-31  3:47 ` Tino Calancha
@ 2017-01-31 18:13 ` Philipp Stephani
  2017-01-31 18:48   ` Tom Tromey
                     ` (2 more replies)
  2017-02-02  3:01 ` John Wiegley
  2 siblings, 3 replies; 15+ messages in thread
From: Philipp Stephani @ 2017-01-31 18:13 UTC (permalink / raw)
  To: Jordon Biondo, Emacs development discussions

[-- Attachment #1: Type: text/plain, Size: 1328 bytes --]

Jordon Biondo <jordonbiondo@gmail.com> schrieb am Mo., 30. Jan. 2017 um
19:39 Uhr:

> A while ago I brought up the inconstant signatures of `setq`,
> `setq-default` and `setq-local`. In short, I want `setq-local` to have the
> same signature as `setq` and `setq-local`. (setq* VAR VAL VAR VAL...)
>
> See thread:
> http://lists.gnu.org/archive/html/emacs-devel/2015-03/msg00448.html
>
> I appreciate Stefan's input back then, but I'd like to revisit the issue,
> get further input, and see if I can change some minds about the issue.
>
> If you believe the variadic signature of `setq` and `setq-default` is not
> ideal, consider that backwards compatibility erases any chance that those
> two functions will lose that feature, and consider the benefits of being
> consistently wrong over being inconsistently right.
>
> Are maintainers and users still opposed to this change? If not I'd be
> happy to update the patch from the previous thread.
>

As a user, I'm still opposed to this change. I don't think consistency is
important enough in this case to justify the "worse" signature. Consistency
is not a goal in itself, but should serve the goal to increase readability
and lower the barriers for new contributors. I don't think that the simpler
signature of setq-local is in any way confusing because of this
inconsistency.

[-- Attachment #2: Type: text/html, Size: 2072 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Revisiting `setq-local`s signature
  2017-01-31 18:13 ` Philipp Stephani
@ 2017-01-31 18:48   ` Tom Tromey
  2017-01-31 18:57   ` Drew Adams
  2017-02-01  5:55   ` Tino Calancha
  2 siblings, 0 replies; 15+ messages in thread
From: Tom Tromey @ 2017-01-31 18:48 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: Jordon Biondo, Emacs development discussions

>>>>> "Philipp" == Philipp Stephani <p.stephani2@gmail.com> writes:

Philipp> As a user, I'm still opposed to this change. I don't think
Philipp> consistency is important enough in this case to justify the
Philipp> "worse" signature.

Whether it's worse is a matter of opinion.

FWIW I got bit by this recently - I copied a setq into a major mode
definition, changing it to use setq-local ... oops.  Not the worst
thing, but an annoyance.

Tom



^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: Revisiting `setq-local`s signature
  2017-01-31 18:13 ` Philipp Stephani
  2017-01-31 18:48   ` Tom Tromey
@ 2017-01-31 18:57   ` Drew Adams
  2017-01-31 19:13     ` Jordon Biondo
  2017-02-01  5:55   ` Tino Calancha
  2 siblings, 1 reply; 15+ messages in thread
From: Drew Adams @ 2017-01-31 18:57 UTC (permalink / raw)
  To: Philipp Stephani, Jordon Biondo, Emacs development discussions

> As a user, I'm still opposed to this change. I don't think
> consistency is important enough in this case to justify the
> "worse" signature.

You don't say what is "worse" about it.

> Consistency is not a goal in itself, but should serve the
> goal to increase readability and lower the barriers for new
> contributors.

Yes, consistency is not a goal in itself.  But you do not say
how the suggested inconsistency here increases readability or
lowers the barriers for new contributors.

> I don't think that the simpler signature of setq-local is in
> any way confusing because of this inconsistency.

How is it simpler?  What _prevents_ a user from setting only
a single variable value each time s?he uses `setq-local'?

Additional assignments would be optional.  In fact, even the
first assignment would be optional, if we follow the `setq'
model.

Is your statement about readability based on your feeling
that the first of these two sexps is more readable than the 
second?  If so, there are at least some people who don't feel 
that way.

(progn
 (setq-local foo 1)
 (setq-local bar 2)
 (setq-local fot 8)
 (setq-local tof 3)
 (setq-local baz 2)
 (setq-local zab 4)
 (setq-local flt 6))

(setq-local foo 1
            bar 2
            fot 8
            tof 3
            baz 2
            zab 4
            flt 6)

I don't see an argument that points to a downside to _allowing_
a variable number of assignments.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Revisiting `setq-local`s signature
  2017-01-31 18:57   ` Drew Adams
@ 2017-01-31 19:13     ` Jordon Biondo
  0 siblings, 0 replies; 15+ messages in thread
From: Jordon Biondo @ 2017-01-31 19:13 UTC (permalink / raw)
  To: Drew Adams; +Cc: Philipp Stephani, Emacs development discussions

[-- Attachment #1: Type: text/plain, Size: 2334 bytes --]

>
> As a user, I'm still opposed to this change. I don't think consistency is
> important enough in this case to justify the "worse" signature. Consistency
> is not a goal in itself, but should serve the goal to increase readability
> and lower the barriers for new contributors. I don't think that the simpler
> signature of setq-local is in any way confusing because of this
> inconsistency.


FWIW the reason I am bringing this up again is that I watched as a
coworker, and new emacser, struggled with the inconstantly while I helped
them setup their config with a new major mode. I explained the issue and
that I'd try to fix it before which is when they brought up the "better to
be consistently wrong" idea which I thought made a good case.

On Tue, Jan 31, 2017 at 1:57 PM, Drew Adams <drew.adams@oracle.com> wrote:

> > As a user, I'm still opposed to this change. I don't think
> > consistency is important enough in this case to justify the
> > "worse" signature.
>
> You don't say what is "worse" about it.
>
> > Consistency is not a goal in itself, but should serve the
> > goal to increase readability and lower the barriers for new
> > contributors.
>
> Yes, consistency is not a goal in itself.  But you do not say
> how the suggested inconsistency here increases readability or
> lowers the barriers for new contributors.
>
> > I don't think that the simpler signature of setq-local is in
> > any way confusing because of this inconsistency.
>
> How is it simpler?  What _prevents_ a user from setting only
> a single variable value each time s?he uses `setq-local'?
>
> Additional assignments would be optional.  In fact, even the
> first assignment would be optional, if we follow the `setq'
> model.
>
> Is your statement about readability based on your feeling
> that the first of these two sexps is more readable than the
> second?  If so, there are at least some people who don't feel
> that way.
>
> (progn
>  (setq-local foo 1)
>  (setq-local bar 2)
>  (setq-local fot 8)
>  (setq-local tof 3)
>  (setq-local baz 2)
>  (setq-local zab 4)
>  (setq-local flt 6))
>
> (setq-local foo 1
>             bar 2
>             fot 8
>             tof 3
>             baz 2
>             zab 4
>             flt 6)
>
> I don't see an argument that points to a downside to _allowing_
> a variable number of assignments.
>

[-- Attachment #2: Type: text/html, Size: 3190 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Revisiting `setq-local`s signature
  2017-01-31 18:13 ` Philipp Stephani
  2017-01-31 18:48   ` Tom Tromey
  2017-01-31 18:57   ` Drew Adams
@ 2017-02-01  5:55   ` Tino Calancha
  2 siblings, 0 replies; 15+ messages in thread
From: Tino Calancha @ 2017-02-01  5:55 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: Jordon Biondo, Emacs development discussions

[-- Attachment #1: Type: text/plain, Size: 581 bytes --]



On Tue, 31 Jan 2017, Philipp Stephani wrote:

> Jordon Biondo <jordonbiondo@gmail.com> schrieb am Mo., 30. Jan. 2017 um 19:39 Uhr:
> Are maintainers and users still opposed to this change? If not I'd be happy to update the patch from the previous thread.
> 
> 
> As a user, I'm still opposed to this change. I don't think consistency is important enough in this case to justify the "worse"
> signature.
Why not to let people decide by themselves what is a better/worse
signature?  Considering the opinions on this thread it's clear that 
better/worse are relative concepts here.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Revisiting `setq-local`s signature
  2017-01-30 18:37 Revisiting `setq-local`s signature Jordon Biondo
  2017-01-31  3:47 ` Tino Calancha
  2017-01-31 18:13 ` Philipp Stephani
@ 2017-02-02  3:01 ` John Wiegley
  2017-02-02  3:34   ` Eli Zaretskii
  2 siblings, 1 reply; 15+ messages in thread
From: John Wiegley @ 2017-02-02  3:01 UTC (permalink / raw)
  To: Jordon Biondo; +Cc: Emacs development discussions

>>>>> "JB" == Jordon Biondo <jordonbiondo@gmail.com> writes:

JB> Are maintainers and users still opposed to this change? If not I'd be
JB> happy to update the patch from the previous thread.

I wouldn't mind having them be consistent, if only because it makes it easier
to switch between them, and there is nothing necessary about the
inconsistency. Eli?

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Revisiting `setq-local`s signature
  2017-02-02  3:01 ` John Wiegley
@ 2017-02-02  3:34   ` Eli Zaretskii
  2017-02-02 14:28     ` Jordon Biondo
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2017-02-02  3:34 UTC (permalink / raw)
  To: John Wiegley; +Cc: jordonbiondo, emacs-devel

> From: John Wiegley <jwiegley@gmail.com>
> Date: Wed, 01 Feb 2017 22:01:29 -0500
> Cc: Emacs development discussions <emacs-devel@gnu.org>
> 
> >>>>> "JB" == Jordon Biondo <jordonbiondo@gmail.com> writes:
> 
> JB> Are maintainers and users still opposed to this change? If not I'd be
> JB> happy to update the patch from the previous thread.
> 
> I wouldn't mind having them be consistent, if only because it makes it easier
> to switch between them, and there is nothing necessary about the
> inconsistency. Eli?

No objections.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Revisiting `setq-local`s signature
  2017-02-02  3:34   ` Eli Zaretskii
@ 2017-02-02 14:28     ` Jordon Biondo
  2017-02-02 17:35       ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Jordon Biondo @ 2017-02-02 14:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: John Wiegley, Emacs development discussions

[-- Attachment #1: Type: text/plain, Size: 1986 bytes --]

Below is an updated patch of the change.

From 625060e5a72f0e25bd2c59bad9f4b828ac80ac0f Mon Sep 17 00:00:00 2001
From: jordonbiondo <jordonbiondo@gmail.com>
Date: Thu, 2 Feb 2017 09:20:02 -0500
Subject: [PATCH] * lisp/subr.el (setq-local): Is now variadic like setq

---
 lisp/subr.el | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index a204577..447952c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -118,10 +118,21 @@ lambda
   ;; depend on backquote.el.
   (list 'function (cons 'lambda cdr)))

-(defmacro setq-local (var val)
-  "Set variable VAR to value VAL in current buffer."
+(defmacro setq-local (&rest args)
+  "Set each SYM to the value of its VAL in the current buffer.
+
+\(fn [SYM VAL]...)"
   ;; Can't use backquote here, it's too early in the bootstrap.
-  (list 'set (list 'make-local-variable (list 'quote var)) val))
+  (let ((expr))
+    (while args
+      (setq expr
+            (cons
+             (list 'set
+                   (list 'make-local-variable (list 'quote (car args)))
+                   (car (cdr args)))
+             expr))
+      (setq args (cdr (cdr args))))
+    (cons 'progn (nreverse expr))))

 (defmacro defvar-local (var val &optional docstring)
   "Define VAR as a buffer-local variable with default value VAL.
-- 
2.7.4 (Apple Git-66)


On Wed, Feb 1, 2017 at 10:34 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: John Wiegley <jwiegley@gmail.com>
> > Date: Wed, 01 Feb 2017 22:01:29 -0500
> > Cc: Emacs development discussions <emacs-devel@gnu.org>
> >
> > >>>>> "JB" == Jordon Biondo <jordonbiondo@gmail.com> writes:
> >
> > JB> Are maintainers and users still opposed to this change? If not I'd be
> > JB> happy to update the patch from the previous thread.
> >
> > I wouldn't mind having them be consistent, if only because it makes it
> easier
> > to switch between them, and there is nothing necessary about the
> > inconsistency. Eli?
>
> No objections.
>

[-- Attachment #2: Type: text/html, Size: 3192 bytes --]

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: Revisiting `setq-local`s signature
  2017-02-02 14:28     ` Jordon Biondo
@ 2017-02-02 17:35       ` Eli Zaretskii
  2017-02-02 17:43         ` Jordon Biondo
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2017-02-02 17:35 UTC (permalink / raw)
  To: Jordon Biondo; +Cc: jwiegley, emacs-devel

> From: Jordon Biondo <jordonbiondo@gmail.com>
> Date: Thu, 2 Feb 2017 09:28:06 -0500
> Cc: John Wiegley <jwiegley@gmail.com>, Emacs development discussions <emacs-devel@gnu.org>
> 
> Below is an updated patch of the change.

Thanks, this will need documentation changes to go with it.  And it
looks like the patch is large enough to require legal paperwork.
Would you like me to send you the forms to start that rolling?



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Revisiting `setq-local`s signature
  2017-02-02 17:35       ` Eli Zaretskii
@ 2017-02-02 17:43         ` Jordon Biondo
  2017-02-02 20:31           ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Jordon Biondo @ 2017-02-02 17:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: John Wiegley, Emacs development discussions

[-- Attachment #1: Type: text/plain, Size: 525 bytes --]

Please do.

On Thu, Feb 2, 2017 at 12:35 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Jordon Biondo <jordonbiondo@gmail.com>
> > Date: Thu, 2 Feb 2017 09:28:06 -0500
> > Cc: John Wiegley <jwiegley@gmail.com>, Emacs development discussions <
> emacs-devel@gnu.org>
> >
> > Below is an updated patch of the change.
>
> Thanks, this will need documentation changes to go with it.  And it
> looks like the patch is large enough to require legal paperwork.
> Would you like me to send you the forms to start that rolling?
>

[-- Attachment #2: Type: text/html, Size: 1016 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Revisiting `setq-local`s signature
  2017-02-02 17:43         ` Jordon Biondo
@ 2017-02-02 20:31           ` Eli Zaretskii
  2017-02-08 15:59             ` Jordon Biondo
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2017-02-02 20:31 UTC (permalink / raw)
  To: Jordon Biondo; +Cc: jwiegley, emacs-devel

> From: Jordon Biondo <jordonbiondo@gmail.com>
> Date: Thu, 2 Feb 2017 12:43:30 -0500
> Cc: John Wiegley <jwiegley@gmail.com>, Emacs development discussions <emacs-devel@gnu.org>
> 
> Please do.

Sent off-list.

Thanks.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Revisiting `setq-local`s signature
  2017-02-02 20:31           ` Eli Zaretskii
@ 2017-02-08 15:59             ` Jordon Biondo
  2017-02-10  8:33               ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Jordon Biondo @ 2017-02-08 15:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: John Wiegley, Emacs development discussions

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

My paperwork is now complete, if that's the only thing holding up this
patch.

On Thu, Feb 2, 2017 at 3:31 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Jordon Biondo <jordonbiondo@gmail.com>
> > Date: Thu, 2 Feb 2017 12:43:30 -0500
> > Cc: John Wiegley <jwiegley@gmail.com>, Emacs development discussions <
> emacs-devel@gnu.org>
> >
> > Please do.
>
> Sent off-list.
>
> Thanks.
>

[-- Attachment #2: Type: text/html, Size: 883 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Revisiting `setq-local`s signature
  2017-02-08 15:59             ` Jordon Biondo
@ 2017-02-10  8:33               ` Eli Zaretskii
  0 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2017-02-10  8:33 UTC (permalink / raw)
  To: Jordon Biondo; +Cc: jwiegley, emacs-devel

> From: Jordon Biondo <jordonbiondo@gmail.com>
> Date: Wed, 8 Feb 2017 10:59:19 -0500
> Cc: John Wiegley <jwiegley@gmail.com>, Emacs development discussions <emacs-devel@gnu.org>
> 
> My paperwork is now complete, if that's the only thing holding up this patch.

Thanks.  Could you please re-submit your patch, and add to it suitable
changes to NEWS and to the ELisp manual?



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-02-10  8:33 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-30 18:37 Revisiting `setq-local`s signature Jordon Biondo
2017-01-31  3:47 ` Tino Calancha
2017-01-31 18:13 ` Philipp Stephani
2017-01-31 18:48   ` Tom Tromey
2017-01-31 18:57   ` Drew Adams
2017-01-31 19:13     ` Jordon Biondo
2017-02-01  5:55   ` Tino Calancha
2017-02-02  3:01 ` John Wiegley
2017-02-02  3:34   ` Eli Zaretskii
2017-02-02 14:28     ` Jordon Biondo
2017-02-02 17:35       ` Eli Zaretskii
2017-02-02 17:43         ` Jordon Biondo
2017-02-02 20:31           ` Eli Zaretskii
2017-02-08 15:59             ` Jordon Biondo
2017-02-10  8:33               ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).