emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Use (point-marker) instead of (move-marker (make-marker) (point))
@ 2012-12-20  4:51 Dmitry Antipov
  2012-12-20 10:57 ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Antipov @ 2012-12-20  4:51 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bastien Guerry

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

Since (point-marker) is shorter and a bit faster than
(move-marker (make-marker) (point)), why not use it?

Dmitry

[-- Attachment #2: point-marker.patch --]
[-- Type: text/plain, Size: 6158 bytes --]

commit 1988bf0f4a5e486030e6c03b6ec172ede609d491
Author: Dmitry Antipov <dmantipov@yandex.ru>
Date:   Thu Dec 20 08:46:41 2012 +0400

    Use (point-marker) instead of (move-marker (make-marker) (point))
    
    * org-agenda.el (org-agenda-get-restriction-and-command): Use `point-marker'.
    * org-capture.el (org-capture-place-template): Likewise.
    * org-colview-xemacs.el (org-dblock-write:columnview): Likewise.
    * org-colview.el (org-dblock-write:columnview): Likewise.
    * org-mobile.el (org-mobile-locate-entry): Likewise.
    * org-table.el (org-table-convert-region): Likewise.
    * org.el (org-update-statistics-cookies): Likewise.
    * contrib/lisp/org-invoice.el (org-dblock-write:invoice): Likewise.

diff --git a/contrib/lisp/org-invoice.el b/contrib/lisp/org-invoice.el
index 59c36e2..0aa2187 100644
--- a/contrib/lisp/org-invoice.el
+++ b/contrib/lisp/org-invoice.el
@@ -290,7 +290,7 @@ information about dblock parameters, please see the Org manual):
 :summary Set to nil to turn off the final summary line."
   (let ((scope (plist-get params :scope))
         (org-invoice-table-params params)
-        (zone (move-marker (make-marker) (point)))
+        (zone (point-marker))
         table)
     (unless scope (setq scope 'default))
     (unless (plist-member params :price) (plist-put params :price t))
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index bfbfb9b..1f3ad3e 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2681,7 +2681,7 @@ L   Timeline for current buffer         #   List stuck projects (!=configure)
 		      (add-text-properties (match-beginning 2) (match-end 2)
 					   '(face bold) header))
 		    header)))
-	(setq header-end (move-marker (make-marker) (point)))
+	(setq header-end (point-marker))
 	(while t
 	  (setq custom1 custom)
 	  (when (eq rmheader t)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 405d897..7a14da4 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -983,7 +983,7 @@ it.  When it is a variable, retrieve the value.  Return whatever we get."
   (show-all)
   (goto-char (org-capture-get :pos))
   (org-set-local 'org-capture-target-marker
-		 (move-marker (make-marker) (point)))
+		 (point-marker))
   (org-set-local 'outline-level 'org-outline-level)
   (let* ((template (org-capture-get :template))
 	 (type (org-capture-get :type)))
diff --git a/lisp/org-colview-xemacs.el b/lisp/org-colview-xemacs.el
index 713ad1f..1cbd459 100644
--- a/lisp/org-colview-xemacs.el
+++ b/lisp/org-colview-xemacs.el
@@ -1393,7 +1393,7 @@ PARAMS is a property list of parameters:
 :maxlevel When set to a number, don't capture headlines below this level.
 :skip-empty-rows
           When t, skip rows where all specifiers other than ITEM are empty."
-  (let ((pos (move-marker (make-marker) (point)))
+  (let ((pos (point-marker))
 	(hlines (plist-get params :hlines))
 	(vlines (plist-get params :vlines))
 	(maxlevel (plist-get params :maxlevel))
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 62c8e74..af609aa 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1242,7 +1242,7 @@ PARAMS is a property list of parameters:
 :skip-empty-rows
 	  When t, skip rows where all specifiers other than ITEM are empty.
 :format   When non-nil, specify the column view format to use."
-  (let ((pos (move-marker (make-marker) (point)))
+  (let ((pos (point-marker))
 	(hlines (plist-get params :hlines))
 	(vlines (plist-get params :vlines))
 	(maxlevel (plist-get params :maxlevel))
diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el
index ffdd665..1092917 100644
--- a/lisp/org-mobile.el
+++ b/lisp/org-mobile.el
@@ -983,7 +983,7 @@ is currently a noop.")
 	      (goto-char (point-max))
 	      (newline)
 	      (goto-char (point-max))
-	      (move-marker (make-marker) (point)))))
+	      (point-marker))))
       (let ((file (match-string 1 link))
 	    (path (match-string 2 link)))
 	(setq file (org-link-unescape file))
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 9d1c68a..aeeb67f 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -509,10 +509,10 @@ nil      When nil, the command tries to be smart and figure out the
 	 re)
     (goto-char beg)
     (beginning-of-line 1)
-    (setq beg (move-marker (make-marker) (point)))
+    (setq beg (point-marker))
     (goto-char end)
     (if (bolp) (backward-char 1) (end-of-line 1))
-    (setq end (move-marker (make-marker) (point)))
+    (setq end (point-marker))
     ;; Get the right field separator
     (unless separator
       (goto-char beg)
@@ -1895,7 +1895,7 @@ it can be edited in place."
       (if (and (boundp 'font-lock-mode) font-lock-mode)
 	  (font-lock-fontify-block))))
    (t
-    (let ((pos (move-marker (make-marker) (point)))
+    (let ((pos (point-marker))
 	  (coord
 	   (if (eq org-table-use-standard-references t)
 	       (concat (org-number-to-letters (org-table-current-column))
@@ -3229,7 +3229,7 @@ Parameters get priority."
   (let ((key (org-table-current-field-formula 'key 'noerror))
 	(eql (sort (org-table-get-stored-formulas 'noerror)
 		   'org-table-formula-less-p))
-	(pos (move-marker (make-marker) (point)))
+	(pos (point-marker))
 	(startline 1)
 	(wc (current-window-configuration))
 	(sel-win (selected-window))
diff --git a/lisp/org.el b/lisp/org.el
index 8d402ba..8e64965 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11981,7 +11981,7 @@ This should be called with the cursor in a line with a statistics cookie."
 	(org-map-entries 'org-update-parent-todo-statistics))
     (if (not (org-at-heading-p))
 	(org-update-checkbox-count)
-      (let ((pos (move-marker (make-marker) (point)))
+      (let ((pos (point-marker))
 	    end l1 l2)
 	(ignore-errors (org-back-to-heading t))
 	(if (not (org-at-heading-p))
@@ -15264,7 +15264,7 @@ only headings."
 	    (setq lmin (1+ flevel) lmax (+ lmin (if org-odd-levels-only 1 0)))
 	    (setq end (save-excursion (org-end-of-subtree t t))))
 	  (when (org-at-heading-p)
-	    (move-marker (make-marker) (point))))))))
+	    (point-marker)))))))
 
 (defun org-find-exact-headline-in-buffer (heading &optional buffer pos-only)
   "Find node HEADING in BUFFER.

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

* Re: [PATCH] Use (point-marker) instead of (move-marker (make-marker) (point))
  2012-12-20  4:51 [PATCH] Use (point-marker) instead of (move-marker (make-marker) (point)) Dmitry Antipov
@ 2012-12-20 10:57 ` Bastien
  2012-12-20 11:58   ` Achim Gratz
  2012-12-20 12:13   ` Dmitry Antipov
  0 siblings, 2 replies; 8+ messages in thread
From: Bastien @ 2012-12-20 10:57 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: emacs-orgmode

Dmitry Antipov <dmantipov@yandex.ru> writes:

> Since (point-marker) is shorter and a bit faster than
> (move-marker (make-marker) (point)), why not use it?

Indeed.  I cannot apply the patch, git am returns "patch format
detection faild."  Can you resubmit it using git format-patch?

Thanks!

-- 
 Bastien

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

* Re: [PATCH] Use (point-marker) instead of (move-marker (make-marker) (point))
  2012-12-20 10:57 ` Bastien
@ 2012-12-20 11:58   ` Achim Gratz
  2012-12-20 12:01     ` Bastien
  2012-12-20 12:13   ` Dmitry Antipov
  1 sibling, 1 reply; 8+ messages in thread
From: Achim Gratz @ 2012-12-20 11:58 UTC (permalink / raw)
  To: emacs-orgmode

Bastien writes:
> Indeed.  I cannot apply the patch, git am returns "patch format
> detection faild."  Can you resubmit it using git format-patch?

You want to use 'git apply' on that patch, 'git am' is for applying
patches produced by 'git format-patch' only.  In a pinch however, you
can relatively easily convert the patch format from 'git show to
something suitable for 'git am':

Replace "commit" with "From", Replace "Author" with "From" and replace
the whitespace at the beginning of the first line of the commit message
with "Subject: [PATCH] ".


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

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

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

* Re: [PATCH] Use (point-marker) instead of (move-marker (make-marker) (point))
  2012-12-20 11:58   ` Achim Gratz
@ 2012-12-20 12:01     ` Bastien
  2012-12-20 12:11       ` Achim Gratz
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien @ 2012-12-20 12:01 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Achim Gratz <Stromeko@nexgo.de> writes:

> Bastien writes:
>> Indeed.  I cannot apply the patch, git am returns "patch format
>> detection faild."  Can you resubmit it using git format-patch?
>
> You want to use 'git apply' on that patch, 'git am' is for applying
> patches produced by 'git format-patch' only.  

Well, I'm trying to encourage people to submit patches that I can apply
easily with git am without having to edit the patch or to use git commit
--author=""... to credit the patch correctly.

> In a pinch however, you
> can relatively easily convert the patch format from 'git show to
> something suitable for 'git am':
>
> Replace "commit" with "From", Replace "Author" with "From" and replace
> the whitespace at the beginning of the first line of the commit message
> with "Subject: [PATCH] ".

Good to know, thank you.

-- 
 Bastien

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

* Re: [PATCH] Use (point-marker) instead of (move-marker (make-marker) (point))
  2012-12-20 12:01     ` Bastien
@ 2012-12-20 12:11       ` Achim Gratz
  2012-12-20 12:17         ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Achim Gratz @ 2012-12-20 12:11 UTC (permalink / raw)
  To: emacs-orgmode

Bastien writes:
> Well, I'm trying to encourage people to submit patches that I can apply
> easily with git am without having to edit the patch or to use git commit
> --author=""... to credit the patch correctly.

I wasn't trying to distract from that, just remind that you can at least
test the patch easily when it is in this format — and since it actually
contains all necessary information, make it applicable as well.  Maybe
an output filter for Gnus or an extension to patchwork would make this
even easier.


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

SD adaptations for KORG EX-800 and Poly-800MkII V0.9:
http://Synth.Stromeko.net/Downloads.html#KorgSDada

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

* Re: [PATCH] Use (point-marker) instead of (move-marker (make-marker) (point))
  2012-12-20 10:57 ` Bastien
  2012-12-20 11:58   ` Achim Gratz
@ 2012-12-20 12:13   ` Dmitry Antipov
  2012-12-20 12:17     ` Bastien
  1 sibling, 1 reply; 8+ messages in thread
From: Dmitry Antipov @ 2012-12-20 12:13 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

On 12/20/2012 02:57 PM, Bastien wrote:

> Indeed.  I cannot apply the patch, git am returns "patch format
> detection faild."  Can you resubmit it using git format-patch?

OK.

Dmitry


[-- Attachment #2: 0001-Use-point-marker-instead-of-move-marker-make-marker-.patch --]
[-- Type: text/plain, Size: 6518 bytes --]

From 1988bf0f4a5e486030e6c03b6ec172ede609d491 Mon Sep 17 00:00:00 2001
From: Dmitry Antipov <dmantipov@yandex.ru>
Date: Thu, 20 Dec 2012 08:46:41 +0400
Subject: [PATCH] Use (point-marker) instead of (move-marker (make-marker)
 (point))

* org-agenda.el (org-agenda-get-restriction-and-command): Use `point-marker'.
* org-capture.el (org-capture-place-template): Likewise.
* org-colview-xemacs.el (org-dblock-write:columnview): Likewise.
* org-colview.el (org-dblock-write:columnview): Likewise.
* org-mobile.el (org-mobile-locate-entry): Likewise.
* org-table.el (org-table-convert-region): Likewise.
* org.el (org-update-statistics-cookies): Likewise.
* contrib/lisp/org-invoice.el (org-dblock-write:invoice): Likewise.
---
 contrib/lisp/org-invoice.el | 2 +-
 lisp/org-agenda.el          | 2 +-
 lisp/org-capture.el         | 2 +-
 lisp/org-colview-xemacs.el  | 2 +-
 lisp/org-colview.el         | 2 +-
 lisp/org-mobile.el          | 2 +-
 lisp/org-table.el           | 8 ++++----
 lisp/org.el                 | 4 ++--
 8 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/contrib/lisp/org-invoice.el b/contrib/lisp/org-invoice.el
index 59c36e2..0aa2187 100644
--- a/contrib/lisp/org-invoice.el
+++ b/contrib/lisp/org-invoice.el
@@ -290,7 +290,7 @@ information about dblock parameters, please see the Org manual):
 :summary Set to nil to turn off the final summary line."
   (let ((scope (plist-get params :scope))
         (org-invoice-table-params params)
-        (zone (move-marker (make-marker) (point)))
+        (zone (point-marker))
         table)
     (unless scope (setq scope 'default))
     (unless (plist-member params :price) (plist-put params :price t))
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index bfbfb9b..1f3ad3e 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2681,7 +2681,7 @@ L   Timeline for current buffer         #   List stuck projects (!=configure)
 		      (add-text-properties (match-beginning 2) (match-end 2)
 					   '(face bold) header))
 		    header)))
-	(setq header-end (move-marker (make-marker) (point)))
+	(setq header-end (point-marker))
 	(while t
 	  (setq custom1 custom)
 	  (when (eq rmheader t)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 405d897..7a14da4 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -983,7 +983,7 @@ it.  When it is a variable, retrieve the value.  Return whatever we get."
   (show-all)
   (goto-char (org-capture-get :pos))
   (org-set-local 'org-capture-target-marker
-		 (move-marker (make-marker) (point)))
+		 (point-marker))
   (org-set-local 'outline-level 'org-outline-level)
   (let* ((template (org-capture-get :template))
 	 (type (org-capture-get :type)))
diff --git a/lisp/org-colview-xemacs.el b/lisp/org-colview-xemacs.el
index 713ad1f..1cbd459 100644
--- a/lisp/org-colview-xemacs.el
+++ b/lisp/org-colview-xemacs.el
@@ -1393,7 +1393,7 @@ PARAMS is a property list of parameters:
 :maxlevel When set to a number, don't capture headlines below this level.
 :skip-empty-rows
           When t, skip rows where all specifiers other than ITEM are empty."
-  (let ((pos (move-marker (make-marker) (point)))
+  (let ((pos (point-marker))
 	(hlines (plist-get params :hlines))
 	(vlines (plist-get params :vlines))
 	(maxlevel (plist-get params :maxlevel))
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 62c8e74..af609aa 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1242,7 +1242,7 @@ PARAMS is a property list of parameters:
 :skip-empty-rows
 	  When t, skip rows where all specifiers other than ITEM are empty.
 :format   When non-nil, specify the column view format to use."
-  (let ((pos (move-marker (make-marker) (point)))
+  (let ((pos (point-marker))
 	(hlines (plist-get params :hlines))
 	(vlines (plist-get params :vlines))
 	(maxlevel (plist-get params :maxlevel))
diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el
index ffdd665..1092917 100644
--- a/lisp/org-mobile.el
+++ b/lisp/org-mobile.el
@@ -983,7 +983,7 @@ is currently a noop.")
 	      (goto-char (point-max))
 	      (newline)
 	      (goto-char (point-max))
-	      (move-marker (make-marker) (point)))))
+	      (point-marker))))
       (let ((file (match-string 1 link))
 	    (path (match-string 2 link)))
 	(setq file (org-link-unescape file))
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 9d1c68a..aeeb67f 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -509,10 +509,10 @@ nil      When nil, the command tries to be smart and figure out the
 	 re)
     (goto-char beg)
     (beginning-of-line 1)
-    (setq beg (move-marker (make-marker) (point)))
+    (setq beg (point-marker))
     (goto-char end)
     (if (bolp) (backward-char 1) (end-of-line 1))
-    (setq end (move-marker (make-marker) (point)))
+    (setq end (point-marker))
     ;; Get the right field separator
     (unless separator
       (goto-char beg)
@@ -1895,7 +1895,7 @@ it can be edited in place."
       (if (and (boundp 'font-lock-mode) font-lock-mode)
 	  (font-lock-fontify-block))))
    (t
-    (let ((pos (move-marker (make-marker) (point)))
+    (let ((pos (point-marker))
 	  (coord
 	   (if (eq org-table-use-standard-references t)
 	       (concat (org-number-to-letters (org-table-current-column))
@@ -3229,7 +3229,7 @@ Parameters get priority."
   (let ((key (org-table-current-field-formula 'key 'noerror))
 	(eql (sort (org-table-get-stored-formulas 'noerror)
 		   'org-table-formula-less-p))
-	(pos (move-marker (make-marker) (point)))
+	(pos (point-marker))
 	(startline 1)
 	(wc (current-window-configuration))
 	(sel-win (selected-window))
diff --git a/lisp/org.el b/lisp/org.el
index 8d402ba..8e64965 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11981,7 +11981,7 @@ This should be called with the cursor in a line with a statistics cookie."
 	(org-map-entries 'org-update-parent-todo-statistics))
     (if (not (org-at-heading-p))
 	(org-update-checkbox-count)
-      (let ((pos (move-marker (make-marker) (point)))
+      (let ((pos (point-marker))
 	    end l1 l2)
 	(ignore-errors (org-back-to-heading t))
 	(if (not (org-at-heading-p))
@@ -15264,7 +15264,7 @@ only headings."
 	    (setq lmin (1+ flevel) lmax (+ lmin (if org-odd-levels-only 1 0)))
 	    (setq end (save-excursion (org-end-of-subtree t t))))
 	  (when (org-at-heading-p)
-	    (move-marker (make-marker) (point))))))))
+	    (point-marker)))))))
 
 (defun org-find-exact-headline-in-buffer (heading &optional buffer pos-only)
   "Find node HEADING in BUFFER.
-- 
1.8.0


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

* Re: [PATCH] Use (point-marker) instead of (move-marker (make-marker) (point))
  2012-12-20 12:13   ` Dmitry Antipov
@ 2012-12-20 12:17     ` Bastien
  0 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2012-12-20 12:17 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: emacs-orgmode

Dmitry Antipov <dmantipov@yandex.ru> writes:

> OK.

Applied, thanks!

-- 
 Bastien

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

* Re: [PATCH] Use (point-marker) instead of (move-marker (make-marker) (point))
  2012-12-20 12:11       ` Achim Gratz
@ 2012-12-20 12:17         ` Bastien
  0 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2012-12-20 12:17 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Achim Gratz <Stromeko@nexgo.de> writes:

> Bastien writes:
>> Well, I'm trying to encourage people to submit patches that I can apply
>> easily with git am without having to edit the patch or to use git commit
>> --author=""... to credit the patch correctly.
>
> I wasn't trying to distract from that, just remind that you can at least
> test the patch easily when it is in this format — and since it actually
> contains all necessary information, make it applicable as well.  

Yes, thanks -- I actually did test the patch with git apply before
replying to Dmitry.

-- 
 Bastien

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

end of thread, other threads:[~2012-12-20 12:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-20  4:51 [PATCH] Use (point-marker) instead of (move-marker (make-marker) (point)) Dmitry Antipov
2012-12-20 10:57 ` Bastien
2012-12-20 11:58   ` Achim Gratz
2012-12-20 12:01     ` Bastien
2012-12-20 12:11       ` Achim Gratz
2012-12-20 12:17         ` Bastien
2012-12-20 12:13   ` Dmitry Antipov
2012-12-20 12:17     ` 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).