unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: emacs-29 dc78779c0c: Fix SVG scaling (bug#59802)
       [not found] ` <20221216155001.8BDCAC0060F@vcs2.savannah.gnu.org>
@ 2022-12-17  1:26   ` Po Lu
  2022-12-17  8:25     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Po Lu @ 2022-12-17  1:26 UTC (permalink / raw)
  To: emacs-devel; +Cc: Manuel Giraud

Eli Zaretskii <eliz@gnu.org> writes:

> +	  if (! (0 < viewbox_width) && (iwidth.unit == RSVG_UNIT_PERCENT))
> +	    viewbox_width = (viewbox_height * viewbox.width / viewbox.height)
> +	      * iwidth.length;
> +	  else if (! (0 < viewbox_height) && (iheight.unit == RSVG_UNIT_PERCENT))
> +	    viewbox_height = (viewbox_width * viewbox.height / viewbox.width)
> +	      * iheight.length;

Our style is to write:

  viewbox_width = ((viewbox_height * viewbox.width / viewbox.height)
  		   * iwidth.length);

and not:

  viewbox_width = (viewbox_height * viewbox.width / viewbox.height)
    * iwidth.length;

Thanks.



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

* Re: emacs-29 dc78779c0c: Fix SVG scaling (bug#59802)
  2022-12-17  1:26   ` emacs-29 dc78779c0c: Fix SVG scaling (bug#59802) Po Lu
@ 2022-12-17  8:25     ` Eli Zaretskii
  2022-12-17  9:51       ` Po Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2022-12-17  8:25 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel, manuel

> From: Po Lu <luangruo@yahoo.com>
> Cc: Manuel Giraud <manuel@ledu-giraud.fr>
> Date: Sat, 17 Dec 2022 09:26:08 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > +	  if (! (0 < viewbox_width) && (iwidth.unit == RSVG_UNIT_PERCENT))
> > +	    viewbox_width = (viewbox_height * viewbox.width / viewbox.height)
> > +	      * iwidth.length;
> > +	  else if (! (0 < viewbox_height) && (iheight.unit == RSVG_UNIT_PERCENT))
> > +	    viewbox_height = (viewbox_width * viewbox.height / viewbox.width)
> > +	      * iheight.length;
> 
> Our style is to write:
> 
>   viewbox_width = ((viewbox_height * viewbox.width / viewbox.height)
>   		   * iwidth.length);
> 
> and not:
> 
>   viewbox_width = (viewbox_height * viewbox.width / viewbox.height)
>     * iwidth.length;

There's nothing wrong with the original style, although I agree that
using extra parentheses makes it more plausible.  There's no reason to
be so stringent in insisting on the other style.



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

* Re: emacs-29 dc78779c0c: Fix SVG scaling (bug#59802)
  2022-12-17  8:25     ` Eli Zaretskii
@ 2022-12-17  9:51       ` Po Lu
  2022-12-17 10:38         ` Eli Zaretskii
  2022-12-18  3:23         ` Richard Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Po Lu @ 2022-12-17  9:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel, manuel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Po Lu <luangruo@yahoo.com>
>> Cc: Manuel Giraud <manuel@ledu-giraud.fr>
>> Date: Sat, 17 Dec 2022 09:26:08 +0800
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> > +	  if (! (0 < viewbox_width) && (iwidth.unit == RSVG_UNIT_PERCENT))
>> > +	    viewbox_width = (viewbox_height * viewbox.width / viewbox.height)
>> > +	      * iwidth.length;
>> > +	  else if (! (0 < viewbox_height) && (iheight.unit == RSVG_UNIT_PERCENT))
>> > +	    viewbox_height = (viewbox_width * viewbox.height / viewbox.width)
>> > +	      * iheight.length;
>> 
>> Our style is to write:
>> 
>>   viewbox_width = ((viewbox_height * viewbox.width / viewbox.height)
>>   		   * iwidth.length);
>> 
>> and not:
>> 
>>   viewbox_width = (viewbox_height * viewbox.width / viewbox.height)
>>     * iwidth.length;
>
> There's nothing wrong with the original style, although I agree that
> using extra parentheses makes it more plausible.  There's no reason to
> be so stringent in insisting on the other style.

The GNU coding standards seem to say something else:

  Insert extra parentheses so that Emacs will indent the code properly.
  For example, the following indentation looks nice if you do it by
  hand,

v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
    + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000;

  but Emacs would alter it.  Adding a set of parentheses produces
  something that looks equally nice, and which Emacs will preserve:

v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
     + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000);



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

* Re: emacs-29 dc78779c0c: Fix SVG scaling (bug#59802)
  2022-12-17  9:51       ` Po Lu
@ 2022-12-17 10:38         ` Eli Zaretskii
  2022-12-17 17:18           ` Manuel Giraud
  2022-12-18  3:23         ` Richard Stallman
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2022-12-17 10:38 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel, manuel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org,  manuel@ledu-giraud.fr
> Date: Sat, 17 Dec 2022 17:51:44 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Our style is to write:
> >> 
> >>   viewbox_width = ((viewbox_height * viewbox.width / viewbox.height)
> >>   		   * iwidth.length);
> >> 
> >> and not:
> >> 
> >>   viewbox_width = (viewbox_height * viewbox.width / viewbox.height)
> >>     * iwidth.length;
> >
> > There's nothing wrong with the original style, although I agree that
> > using extra parentheses makes it more plausible.  There's no reason to
> > be so stringent in insisting on the other style.
> 
> The GNU coding standards seem to say something else:
> 
>   Insert extra parentheses so that Emacs will indent the code properly.
>   For example, the following indentation looks nice if you do it by
>   hand,

Please assume I'm aware of the GCS.

That section explicitly says these are recommendations, not hard
requirements, a little above the text that you cite:

     The rest of this section gives our recommendations for other aspects
  of C formatting style, which is also the default style of the 'indent'
  program in version 1.2 and newer.  It corresponds to the options

       -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2
       -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob

     We don't think of these recommendations as requirements, because it
  causes no problems for users if two different programs have different
  formatting styles.

So please do not push too hard for adopting only one style and nothing
else.  Doing so makes this community less pleasant than it should be.



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

* Re: emacs-29 dc78779c0c: Fix SVG scaling (bug#59802)
  2022-12-17 10:38         ` Eli Zaretskii
@ 2022-12-17 17:18           ` Manuel Giraud
  2022-12-17 17:53             ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Manuel Giraud @ 2022-12-17 17:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Po Lu, emacs-devel

Hi,

Do you want me to fix this style?
-- 
Manuel Giraud



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

* Re: emacs-29 dc78779c0c: Fix SVG scaling (bug#59802)
  2022-12-17 17:18           ` Manuel Giraud
@ 2022-12-17 17:53             ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2022-12-17 17:53 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: luangruo, emacs-devel

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: Po Lu <luangruo@yahoo.com>,  emacs-devel@gnu.org
> Date: Sat, 17 Dec 2022 18:18:42 +0100
> 
> Hi,
> 
> Do you want me to fix this style?

There's no need.  If we decide to do it, we can do it ourselves.



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

* Re: emacs-29 dc78779c0c: Fix SVG scaling (bug#59802)
  2022-12-17  9:51       ` Po Lu
  2022-12-17 10:38         ` Eli Zaretskii
@ 2022-12-18  3:23         ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2022-12-18  3:23 UTC (permalink / raw)
  To: Po Lu; +Cc: eliz, emacs-devel, manuel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
  >     + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000;

  >   but Emacs would alter it.  Adding a set of parentheses produces
  >   something that looks equally nice, and which Emacs will preserve:

  > v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
  >      + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000);

You're right, these parentheses should be added.  There is no downside
to them, and they will keep the code looking good if it happens to be
reindented.

If I were doing anything with that code, I would add them.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

end of thread, other threads:[~2022-12-18  3:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <167120580083.8436.12355011753442988358@vcs2.savannah.gnu.org>
     [not found] ` <20221216155001.8BDCAC0060F@vcs2.savannah.gnu.org>
2022-12-17  1:26   ` emacs-29 dc78779c0c: Fix SVG scaling (bug#59802) Po Lu
2022-12-17  8:25     ` Eli Zaretskii
2022-12-17  9:51       ` Po Lu
2022-12-17 10:38         ` Eli Zaretskii
2022-12-17 17:18           ` Manuel Giraud
2022-12-17 17:53             ` Eli Zaretskii
2022-12-18  3:23         ` Richard Stallman

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).