unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* org-macs ignoring stock functionality
@ 2018-11-19 14:13 Sam Steingold
  2018-11-19 18:30 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Steingold @ 2018-11-19 14:13 UTC (permalink / raw)
  To: emacs-devel

Hi
I do not use org, but it
accidentally(https://emacs.stackexchange.com/a/46083/795) came to my
attention that org-macs.el duplicates some emacs stock functionality:

1. org-split-string - ignores split-string-default-separators; can
probably be simplified to (split-string string separators nil t)
2. org-current-line - can be replaced with line-number-at-pos
3. org-goto-line - can be replaced with goto-line

Shouldn't these functions be obsoleted? (cf org-compat)

Thanks.

-- 
Sam Steingold <http://sds.podval.org> <http://www.childpsy.net>
<http://steingoldpsychology.com>



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

* Re: org-macs ignoring stock functionality
  2018-11-19 14:13 org-macs ignoring stock functionality Sam Steingold
@ 2018-11-19 18:30 ` Nicolas Goaziou
  2018-11-19 21:01   ` Sam Steingold
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2018-11-19 18:30 UTC (permalink / raw)
  To: Sam Steingold; +Cc: emacs-devel

Hello,

Sam Steingold <sds@gnu.org> writes:

> I do not use org, but it
> accidentally(https://emacs.stackexchange.com/a/46083/795) came to my
> attention that org-macs.el duplicates some emacs stock functionality:
>
> 1. org-split-string - ignores split-string-default-separators; can
> probably be simplified to (split-string string separators nil t)

`org-split-string' and `split-string' are slightly different. The former
ignores separators at the beginning and at the end of the string, not
the latter. At some point, it used `split-string', but it happened to be
too slow for a core Org function.

> 2. org-current-line - can be replaced with line-number-at-pos

Indeed, it could be replaced by (line-number-at-pos nil t). I will
obsolete it in Org 9.2.

> 3. org-goto-line - can be replaced with goto-line

Function `goto-line' messes with the mark. From its docstring,

  This function is for interactive use only;
  in Lisp code use ‘forward-line’ instead.

and

  This function is usually the wrong thing to use in a Lisp program.

So, no, `goto-line' cannot replace `org-goto-line'.

Regards,

-- 
Nicolas Goaziou



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

* Re: org-macs ignoring stock functionality
  2018-11-19 18:30 ` Nicolas Goaziou
@ 2018-11-19 21:01   ` Sam Steingold
  2018-11-19 22:13     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Steingold @ 2018-11-19 21:01 UTC (permalink / raw)
  To: mail; +Cc: emacs-devel

On Mon, Nov 19, 2018 at 1:30 PM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Sam Steingold <sds@gnu.org> writes:
>
> > I do not use org, but it
> > accidentally(https://emacs.stackexchange.com/a/46083/795) came to my
> > attention that org-macs.el duplicates some emacs stock functionality:
> >
> > 1. org-split-string - ignores split-string-default-separators; can
> > probably be simplified to (split-string string separators nil t)
>
> `org-split-string' and `split-string' are slightly different. The former
> ignores separators at the beginning and at the end of the string, not
> the latter.

Indeed, and the last argument `t` takes care of this difference.

> At some point, it used `split-string', but it happened to be
> too slow for a core Org function.

The org-split-string I see in git master calls split-string.

Thanks.

-- 
Sam Steingold <http://sds.podval.org> <http://www.childpsy.net>
<http://steingoldpsychology.com>



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

* Re: org-macs ignoring stock functionality
  2018-11-19 21:01   ` Sam Steingold
@ 2018-11-19 22:13     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2018-11-19 22:13 UTC (permalink / raw)
  To: Sam Steingold; +Cc: emacs-devel

Sam Steingold <sds@gnu.org> writes:

> On Mon, Nov 19, 2018 at 1:30 PM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>> Sam Steingold <sds@gnu.org> writes:
>>
>> > I do not use org, but it
>> > accidentally(https://emacs.stackexchange.com/a/46083/795) came to my
>> > attention that org-macs.el duplicates some emacs stock functionality:
>> >
>> > 1. org-split-string - ignores split-string-default-separators; can
>> > probably be simplified to (split-string string separators nil t)
>>
>> `org-split-string' and `split-string' are slightly different. The former
>> ignores separators at the beginning and at the end of the string, not
>> the latter.
>
> Indeed, and the last argument `t` takes care of this difference.

No, it doesn't. 

Notwithstanding the fact that t is not a valid TRIM argument,
`org-split-string' doesn't trim at all:

(org-split-string "|a| b ||c|" "|") => ("a" " b " "" "c")

> The org-split-string I see in git master calls split-string.

It is no longer the case in Org's HEAD. For the record:

(benchmark-run 1000 (org-split-string "|a|b||c|" "|")) => (0.00832757 0 0.0)
(benchmark-run 1000 (split-string "|a|b||c|" "|" nil " ")) => (0.026091297 0 0.0)


Regards,



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

end of thread, other threads:[~2018-11-19 22:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-19 14:13 org-macs ignoring stock functionality Sam Steingold
2018-11-19 18:30 ` Nicolas Goaziou
2018-11-19 21:01   ` Sam Steingold
2018-11-19 22:13     ` Nicolas Goaziou

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