all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#36664: 27.0.50; definition of string-trim causes warning
@ 2019-07-15 12:20 Andreas Röhler
  2019-07-15 12:24 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Röhler @ 2019-07-15 12:20 UTC (permalink / raw)
  To: 36664

Hi,

concerns subr-x.el

When byte-compiling a file with def of trim-string inside, get a 
warning: Lexical argument shadows the dynamic variable
     string

Changing the argument from "string" into "strg" for example should 
silence that.

Thanks,

Andreas

In GNU Emacs 27.0.50 (build 1, i686-pc-linux-gnu, GTK+ Version 3.14.5)
  of 2019-06-04








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

* bug#36664: 27.0.50; definition of string-trim causes warning
  2019-07-15 12:20 bug#36664: 27.0.50; definition of string-trim causes warning Andreas Röhler
@ 2019-07-15 12:24 ` Lars Ingebrigtsen
  2019-07-15 14:24   ` Andreas Röhler
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-15 12:24 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 36664

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> concerns subr-x.el
>
> When byte-compiling a file with def of trim-string inside, get a
> warning: Lexical argument shadows the dynamic variable
>     string

I'm not sure I follow.  Do you mean if you have a function that calls
string-trim (not define trim-string?) in a file, and you compile that
file, you get that warning?

If that's what you mean, I'm unable to reproduce the error.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#36664: 27.0.50; definition of string-trim causes warning
  2019-07-15 12:24 ` Lars Ingebrigtsen
@ 2019-07-15 14:24   ` Andreas Röhler
  2019-07-15 14:33     ` Andreas Röhler
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andreas Röhler @ 2019-07-15 14:24 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 36664


On 15.07.19 14:24, Lars Ingebrigtsen wrote:
> Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
>
>> concerns subr-x.el
>>
>> When byte-compiling a file with def of trim-string inside, get a
>> warning: Lexical argument shadows the dynamic variable
>>      string
> I'm not sure I follow.  Do you mean if you have a function that calls
> string-trim (not define trim-string?) in a file, and you compile that
> file, you get that warning?
>
> If that's what you mean, I'm unable to reproduce the error.
>

Have that in python-mode.el --as older Emacsen might miss the function--:

;; subr-x.el might not exist yet
(unless (functionp 'string-trim)
   (defsubst string-trim (string &optional trim-left trim-right)
     "Trim STRING of leading and trailing strings matching TRIM-LEFT and 
TRIM-RIGHT.

TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
     (string-trim-left (string-trim-right string trim-right) trim-left))

[...]






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

* bug#36664: 27.0.50; definition of string-trim causes warning
  2019-07-15 14:24   ` Andreas Röhler
@ 2019-07-15 14:33     ` Andreas Röhler
  2019-07-15 15:26       ` Noam Postavsky
  2019-07-15 15:16     ` Lars Ingebrigtsen
  2019-07-15 15:18     ` Lars Ingebrigtsen
  2 siblings, 1 reply; 7+ messages in thread
From: Andreas Röhler @ 2019-07-15 14:33 UTC (permalink / raw)
  To: 36664

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


On 15.07.19 16:24, Andreas Röhler wrote:
>
> On 15.07.19 14:24, Lars Ingebrigtsen wrote:
>> Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
>>
>>> concerns subr-x.el
>>>
>>> When byte-compiling a file with def of trim-string inside, get a
>>> warning: Lexical argument shadows the dynamic variable
>>>      string
>> I'm not sure I follow.  Do you mean if you have a function that calls
>> string-trim (not define trim-string?) in a file, and you compile that
>> file, you get that warning?
>>
>> If that's what you mean, I'm unable to reproduce the error.
>>
>
> Have that in python-mode.el --as older Emacsen might miss the function--:
>
> ;; subr-x.el might not exist yet
> (unless (functionp 'string-trim)
>   (defsubst string-trim (string &optional trim-left trim-right)
>     "Trim STRING of leading and trailing strings matching TRIM-LEFT 
> and TRIM-RIGHT.
>
> TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
>     (string-trim-left (string-trim-right string trim-right) trim-left))
>
> [...]
>
>

Hmm, also can't reproduce with emacs -Q, only from my config - see 
attachment.

Beside of this IMO the warning is reasonable - commonly used symbols 
should not appear as plain argument names.


>
>

[-- Attachment #2: warning.png --]
[-- Type: image/png, Size: 163068 bytes --]

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

* bug#36664: 27.0.50; definition of string-trim causes warning
  2019-07-15 14:24   ` Andreas Röhler
  2019-07-15 14:33     ` Andreas Röhler
@ 2019-07-15 15:16     ` Lars Ingebrigtsen
  2019-07-15 15:18     ` Lars Ingebrigtsen
  2 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-15 15:16 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 36664

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> Have that in python-mode.el --as older Emacsen might miss the function--:
>
> ;; subr-x.el might not exist yet
> (unless (functionp 'string-trim)
>   (defsubst string-trim (string &optional trim-left trim-right)
>     "Trim STRING of leading and trailing strings matching TRIM-LEFT
> and TRIM-RIGHT.
>
> TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
>     (string-trim-left (string-trim-right string trim-right) trim-left))

I put the following in /tmp/a.el and said `M-x byte-compile-file', and I
got no warning...

(unless (functionp 'string-trim)
 (defsubst string-trim (string &optional trim-left trim-right)
   "Trim STRING of leading and trailing strings matching TRIM-LEFT
and TRIM-RIGHT.

TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
   (string-trim-left (string-trim-right string trim-right) trim-left)))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#36664: 27.0.50; definition of string-trim causes warning
  2019-07-15 14:24   ` Andreas Röhler
  2019-07-15 14:33     ` Andreas Röhler
  2019-07-15 15:16     ` Lars Ingebrigtsen
@ 2019-07-15 15:18     ` Lars Ingebrigtsen
  2 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-15 15:18 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 36664

Well, I got the warning about the other two functions, but that's
natural:

\f
Compiling file /tmp/a.el at Mon Jul 15 17:18:07 2019

In end of data:
a.el:12:1:Warning: the following functions are not known to be defined:
    string-trim-left, string-trim-right


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no






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

* bug#36664: 27.0.50; definition of string-trim causes warning
  2019-07-15 14:33     ` Andreas Röhler
@ 2019-07-15 15:26       ` Noam Postavsky
  0 siblings, 0 replies; 7+ messages in thread
From: Noam Postavsky @ 2019-07-15 15:26 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 36664

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

>>>> When byte-compiling a file with def of trim-string inside, get a
>>>> warning: Lexical argument shadows the dynamic variable
>>>>      string

> Hmm, also can't reproduce with emacs -Q, only from my config - see
> attachment.
>
> Beside of this IMO the warning is reasonable - commonly used symbols
> should not appear as plain argument names.

I think the bug is somewhere in your config, there is something like

    (defvar string "foo")

Which makes 'string' into a global special variable.






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

end of thread, other threads:[~2019-07-15 15:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-15 12:20 bug#36664: 27.0.50; definition of string-trim causes warning Andreas Röhler
2019-07-15 12:24 ` Lars Ingebrigtsen
2019-07-15 14:24   ` Andreas Röhler
2019-07-15 14:33     ` Andreas Röhler
2019-07-15 15:26       ` Noam Postavsky
2019-07-15 15:16     ` Lars Ingebrigtsen
2019-07-15 15:18     ` Lars Ingebrigtsen

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.