emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org.el (org-offer-links-in-entry): Remove code duplication
@ 2014-04-24 14:36 Albert Krewinkel
  2014-05-06  9:29 ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Albert Krewinkel @ 2014-04-24 14:36 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Albert Krewinkel

* org.el (org-offer-links-in-entry): Use `org-any-link-re' to avoid
  code duplication.

The `re' variable defined in function `org-offer-links-in-entry' is
string-equal to `org-any-link-re' and is hence replaced by the latter.

This is a TINYCHANGE.
---
 lisp/org.el | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index ad76e67..741529b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10694,10 +10694,7 @@ there is one, return it."
       (save-restriction
 	(widen)
 	(goto-char marker)
-	(let ((re (concat "\\(" org-bracket-link-regexp "\\)\\|"
-			  "\\(" org-angle-link-re "\\)\\|"
-			  "\\(" org-plain-link-re "\\)"))
-	      (cnt ?0)
+	(let ((cnt ?0)
 	      (in-emacs (if (integerp nth) nil nth))
 	      have-zero end links link c)
 	  (when (and (stringp zero) (string-match org-bracket-link-regexp zero))
@@ -10706,7 +10703,7 @@ there is one, return it."
 	  (save-excursion
 	    (org-back-to-heading t)
 	    (setq end (save-excursion (outline-next-heading) (point)))
-	    (while (re-search-forward re end t)
+	    (while (re-search-forward org-any-link-re end t)
 	      (push (match-string 0) links))
 	    (setq links (org-uniquify (reverse links))))
 	  (cond
-- 
1.9.2

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

* Re: [PATCH] org.el (org-offer-links-in-entry): Remove code duplication
  2014-04-24 14:36 [PATCH] org.el (org-offer-links-in-entry): Remove code duplication Albert Krewinkel
@ 2014-05-06  9:29 ` Bastien
  2014-05-11 16:33   ` Albert Krewinkel
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2014-05-06  9:29 UTC (permalink / raw)
  To: Albert Krewinkel; +Cc: emacs-orgmode

Hi Albert,

thanks for the patch.

Albert Krewinkel <tarleb@moltkeplatz.de> writes:

> * org.el (org-offer-links-in-entry): Use `org-any-link-re' to avoid
>   code duplication.

This is not really code duplication, as the output of `org-any-link-re'
is different from the output of the current sexp in the code.

That said, the change looks good anyway.  Can you double-check there
cannot be any problem with the value of `org-any-link-re'?

> The `re' variable defined in function `org-offer-links-in-entry' is
> string-equal to `org-any-link-re' and is hence replaced by the latter.
>
> This is a TINYCHANGE.

(TINYCHANGE should stand alone on the line.)

Thanks!

-- 
 Bastien

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

* Re: [PATCH] org.el (org-offer-links-in-entry): Remove code duplication
  2014-05-06  9:29 ` Bastien
@ 2014-05-11 16:33   ` Albert Krewinkel
  2014-05-11 16:33     ` [PATCH] org.el (org-offer-links-in-entry): Reuse global variable Albert Krewinkel
  2014-05-11 19:09     ` [PATCH] org.el (org-offer-links-in-entry): Remove code duplication Achim Gratz
  0 siblings, 2 replies; 7+ messages in thread
From: Albert Krewinkel @ 2014-05-11 16:33 UTC (permalink / raw)
  To: Bastien; +Cc: Albert Krewinkel, emacs-orgmode

Hi Bastien,

Bastien <bzg@gnu.org> writes:
> Albert Krewinkel <tarleb@moltkeplatz.de> writes:
>
>> * org.el (org-offer-links-in-entry): Use `org-any-link-re' to avoid
>>   code duplication.
>
> This is not really code duplication, as the output of `org-any-link-re'
> is different from the output of the current sexp in the code.

I'm not exactly sure what you mean, are you referring to the variables'
different representation in the source?  I double checked that

(string-equal re org-any-link-re) => t

when `re' is set to the old value (as of commit 7c8559e).

> That said, the change looks good anyway.  Can you double-check there
> cannot be any problem with the value of `org-any-link-re'?

The variable is only ever changed when calling `org-make-link-regexps',
so I'm quite positive that the change does not have any unintended side
effects.  The test suite passes, too.

>> This is a TINYCHANGE.
>
> (TINYCHANGE should stand alone on the line.)

Done.  As an aside: I did sign the copyright assignment papers to be
able to contrivute to Gnus, but that probably wouldn't help much, as
Org is a different project.  Is that correct?

> Thanks!

No, thank you all for all the work you put into this!  It is truly
amazing!

Albert Krewinkel (1):
  org.el (org-offer-links-in-entry): Reuse global variable

 lisp/org.el | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

-- 
2.0.0.rc0

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

* [PATCH] org.el (org-offer-links-in-entry): Reuse global variable
  2014-05-11 16:33   ` Albert Krewinkel
@ 2014-05-11 16:33     ` Albert Krewinkel
  2014-05-20 21:08       ` Bastien
  2014-05-11 19:09     ` [PATCH] org.el (org-offer-links-in-entry): Remove code duplication Achim Gratz
  1 sibling, 1 reply; 7+ messages in thread
From: Albert Krewinkel @ 2014-05-11 16:33 UTC (permalink / raw)
  To: Bastien; +Cc: Albert Krewinkel, emacs-orgmode

* org.el (org-offer-links-in-entry): Use global variable
  `org-any-link-re' instead of defining a string-equal local variable.

The `re' variable defined in function `org-offer-links-in-entry' is
string-equal to `org-any-link-re' and is hence replaced by the latter.

TINYCHANGE
---
 lisp/org.el | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index c16fab0..40d6972 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10709,10 +10709,7 @@ there is one, return it."
       (save-restriction
 	(widen)
 	(goto-char marker)
-	(let ((re (concat "\\(" org-bracket-link-regexp "\\)\\|"
-			  "\\(" org-angle-link-re "\\)\\|"
-			  "\\(" org-plain-link-re "\\)"))
-	      (cnt ?0)
+	(let ((cnt ?0)
 	      (in-emacs (if (integerp nth) nil nth))
 	      have-zero end links link c)
 	  (when (and (stringp zero) (string-match org-bracket-link-regexp zero))
@@ -10721,7 +10718,7 @@ there is one, return it."
 	  (save-excursion
 	    (org-back-to-heading t)
 	    (setq end (save-excursion (outline-next-heading) (point)))
-	    (while (re-search-forward re end t)
+	    (while (re-search-forward org-any-link-re end t)
 	      (push (match-string 0) links))
 	    (setq links (org-uniquify (reverse links))))
 	  (cond
-- 
2.0.0.rc0

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

* Re: [PATCH] org.el (org-offer-links-in-entry): Remove code duplication
  2014-05-11 16:33   ` Albert Krewinkel
  2014-05-11 16:33     ` [PATCH] org.el (org-offer-links-in-entry): Reuse global variable Albert Krewinkel
@ 2014-05-11 19:09     ` Achim Gratz
  2014-05-15 10:41       ` Bastien
  1 sibling, 1 reply; 7+ messages in thread
From: Achim Gratz @ 2014-05-11 19:09 UTC (permalink / raw)
  To: emacs-orgmode

Albert Krewinkel writes:
> Done.  As an aside: I did sign the copyright assignment papers to be
> able to contrivute to Gnus, but that probably wouldn't help much, as
> Org is a different project.  Is that correct?

If you assigned copyright just for Gnus, then you'd have to do it again
for Org.  If instead you've assigned it for Emacs, then everything
is already OK, just let Bastien know and perhaps give him the number of
your assignment so it's easier for him to check.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs

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

* Re: [PATCH] org.el (org-offer-links-in-entry): Remove code duplication
  2014-05-11 19:09     ` [PATCH] org.el (org-offer-links-in-entry): Remove code duplication Achim Gratz
@ 2014-05-15 10:41       ` Bastien
  0 siblings, 0 replies; 7+ messages in thread
From: Bastien @ 2014-05-15 10:41 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Hi Albert,

Achim Gratz <Stromeko@nexgo.de> writes:

> Albert Krewinkel writes:
>> Done.  As an aside: I did sign the copyright assignment papers to be
>> able to contrivute to Gnus, but that probably wouldn't help much, as
>> Org is a different project.  Is that correct?
>
> If you assigned copyright just for Gnus, then you'd have to do it again
> for Org.

I've just checked and yes, Albert's assignment is made for EMACS/GNUS.

So I'm afraid Albert you have to go through the process of assigning
your copyright again for Emacs :/

You can use the form here:

http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt

HTH,

-- 
 Bastien

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

* Re: [PATCH] org.el (org-offer-links-in-entry): Reuse global variable
  2014-05-11 16:33     ` [PATCH] org.el (org-offer-links-in-entry): Reuse global variable Albert Krewinkel
@ 2014-05-20 21:08       ` Bastien
  0 siblings, 0 replies; 7+ messages in thread
From: Bastien @ 2014-05-20 21:08 UTC (permalink / raw)
  To: Albert Krewinkel; +Cc: emacs-orgmode

Hi Albert,

Albert Krewinkel <tarleb@moltkeplatz.de> writes:

> * org.el (org-offer-links-in-entry): Use global variable
>   `org-any-link-re' instead of defining a string-equal local variable.
>
> The `re' variable defined in function `org-offer-links-in-entry' is
> string-equal to `org-any-link-re' and is hence replaced by the latter.
>
> TINYCHANGE

Finally applied, thanks!

-- 
 Bastien

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

end of thread, other threads:[~2014-05-20 21:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-24 14:36 [PATCH] org.el (org-offer-links-in-entry): Remove code duplication Albert Krewinkel
2014-05-06  9:29 ` Bastien
2014-05-11 16:33   ` Albert Krewinkel
2014-05-11 16:33     ` [PATCH] org.el (org-offer-links-in-entry): Reuse global variable Albert Krewinkel
2014-05-20 21:08       ` Bastien
2014-05-11 19:09     ` [PATCH] org.el (org-offer-links-in-entry): Remove code duplication Achim Gratz
2014-05-15 10:41       ` Bastien

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

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