all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* shr-copy-url: arg misnamed?
@ 2018-09-22 16:12 T.V Raman
  2018-09-23 20:04 ` Noam Postavsky
  2018-09-23 20:57 ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: T.V Raman @ 2018-09-22 16:12 UTC (permalink / raw)
  To: emacs-devel

Should the arg in this function be renamed?

The name "url" is confusing, and is likely being shadowed 
(defun shr-copy-url (url)
  "Copy the URL under point to the kill ring.
If IMAGE-URL (the prefix) is non-nil, or there is no link under
point, but there is an image under point then copy the URL of the
image under point instead."
  (interactive (list (shr-url-at-point current-prefix-arg)))
  (if (not url)
      (message "No URL under point")
    (setq url (url-encode-url url))
    (kill-new url)
    (message "Copied %s" url)))
-- 

-- 



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

* Re: shr-copy-url: arg misnamed?
  2018-09-22 16:12 shr-copy-url: arg misnamed? T.V Raman
@ 2018-09-23 20:04 ` Noam Postavsky
  2018-09-23 23:45   ` T.V Raman
  2018-09-23 20:57 ` Stefan Monnier
  1 sibling, 1 reply; 8+ messages in thread
From: Noam Postavsky @ 2018-09-23 20:04 UTC (permalink / raw)
  To: raman; +Cc: Emacs developers

On Sat, 22 Sep 2018 at 12:22, T.V Raman <raman@google.com> wrote:
>
> Should the arg in this function be renamed?
>
> The name "url" is confusing, and is likely being shadowed

Not sure what you mean by shadowed, but the docstring has a copy-paste
mistake: it should say "with a prefix argument" instead of referencing
IMAGE-URL (which is an arg of shr-url-at-point).



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

* Re: shr-copy-url: arg misnamed?
  2018-09-22 16:12 shr-copy-url: arg misnamed? T.V Raman
  2018-09-23 20:04 ` Noam Postavsky
@ 2018-09-23 20:57 ` Stefan Monnier
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2018-09-23 20:57 UTC (permalink / raw)
  To: emacs-devel

> Should the arg in this function be renamed?

Any suggestion?

> The name "url" is confusing,

I don't see why.

> and is likely being shadowed 

I don't see that either, sorry.


        Stefan




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

* Re: shr-copy-url: arg misnamed?
  2018-09-23 20:04 ` Noam Postavsky
@ 2018-09-23 23:45   ` T.V Raman
  2018-09-25  0:42     ` Noam Postavsky
  2018-09-25  7:31     ` Andreas Schwab
  0 siblings, 2 replies; 8+ messages in thread
From: T.V Raman @ 2018-09-23 23:45 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Emacs developers

Noam Postavsky <npostavs@gmail.com> writes:
What I meant was:

Interactive form returns "url" to fill-in its arg (url) --- agree re the
cut-and-paste error.
Not sure why I typed "shadowed" -- what I meant was that the naming of
"url" is confusing 
(interactive (list (shr-url-at-point current-prefix-arg)))
> On Sat, 22 Sep 2018 at 12:22, T.V Raman <raman@google.com> wrote:
>>
>> Should the arg in this function be renamed?
>>
>> The name "url" is confusing, and is likely being shadowed
>
> Not sure what you mean by shadowed, but the docstring has a copy-paste
> mistake: it should say "with a prefix argument" instead of referencing
> IMAGE-URL (which is an arg of shr-url-at-point).

-- 



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

* Re: shr-copy-url: arg misnamed?
  2018-09-23 23:45   ` T.V Raman
@ 2018-09-25  0:42     ` Noam Postavsky
  2018-09-25  7:31     ` Andreas Schwab
  1 sibling, 0 replies; 8+ messages in thread
From: Noam Postavsky @ 2018-09-25  0:42 UTC (permalink / raw)
  To: raman; +Cc: Emacs developers

On Sun, 23 Sep 2018 at 19:45, T.V Raman <raman@google.com> wrote:

> Interactive form returns "url" to fill-in its arg (url)

Not sure why that's a problem. Generally, pretty much all Emacs
functions which operate on a URL name their argument "url". It seems
like the most obvious and simplest name.



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

* Re: shr-copy-url: arg misnamed?
  2018-09-23 23:45   ` T.V Raman
  2018-09-25  0:42     ` Noam Postavsky
@ 2018-09-25  7:31     ` Andreas Schwab
  2018-09-25 13:55       ` T.V Raman
  1 sibling, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2018-09-25  7:31 UTC (permalink / raw)
  To: T.V Raman; +Cc: Noam Postavsky, Emacs developers

On Sep 23 2018, "T.V Raman" <raman@google.com> wrote:

> Noam Postavsky <npostavs@gmail.com> writes:
> What I meant was:
>
> Interactive form returns "url" to fill-in its arg (url) --- agree re the

The interactive form returns nothing, and it doesn't even reference url.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



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

* Re: shr-copy-url: arg misnamed?
  2018-09-25  7:31     ` Andreas Schwab
@ 2018-09-25 13:55       ` T.V Raman
  2018-09-25 14:27         ` Noam Postavsky
  0 siblings, 1 reply; 8+ messages in thread
From: T.V Raman @ 2018-09-25 13:55 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Noam Postavsky, Emacs developers

Andreas Schwab <schwab@suse.de> writes:

Yes. url here is misnamed -- should be called prefix.

Basically if you read the doc and the function signature,  you're likely to call it with a url string.> On Sep 23 2018, "T.V Raman" <raman@google.com> wrote:
>
>> Noam Postavsky <npostavs@gmail.com> writes:
>> What I meant was:
>>
>> Interactive form returns "url" to fill-in its arg (url) --- agree re the
>
> The interactive form returns nothing, and it doesn't even reference url.
>
> Andreas.

-- 



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

* Re: shr-copy-url: arg misnamed?
  2018-09-25 13:55       ` T.V Raman
@ 2018-09-25 14:27         ` Noam Postavsky
  0 siblings, 0 replies; 8+ messages in thread
From: Noam Postavsky @ 2018-09-25 14:27 UTC (permalink / raw)
  To: raman; +Cc: Andreas Schwab, Emacs developers

On Tue, 25 Sep 2018 at 09:55, T.V Raman <raman@google.com> wrote:
>
> Yes. url here is misnamed -- should be called prefix.

No, I don't think so.

> Basically if you read the doc and the function signature,  you're likely to call it with a url string.

That is the correct way to call it.



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

end of thread, other threads:[~2018-09-25 14:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-22 16:12 shr-copy-url: arg misnamed? T.V Raman
2018-09-23 20:04 ` Noam Postavsky
2018-09-23 23:45   ` T.V Raman
2018-09-25  0:42     ` Noam Postavsky
2018-09-25  7:31     ` Andreas Schwab
2018-09-25 13:55       ` T.V Raman
2018-09-25 14:27         ` Noam Postavsky
2018-09-23 20:57 ` Stefan Monnier

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.