emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/webpaste cb9cca7 054/298: Stop moving point and remove usa


From: ELPA Syncer
Subject: [nongnu] elpa/webpaste cb9cca7 054/298: Stop moving point and remove usage of save-excursion and therefore
Date: Thu, 9 Dec 2021 18:59:43 -0500 (EST)

branch: elpa/webpaste
commit cb9cca769b04804ab73cb5e6c0bf4df4f8eddfb7
Author: Elis Axelsson <elis.axelsson@gmail.com>
Commit: Elis Axelsson <elis.axelsson@gmail.com>

    Stop moving point and remove usage of save-excursion and therefore
    simplify the code greatly.
---
 webpaste.el | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/webpaste.el b/webpaste.el
index d102fc0..ef2a7d1 100644
--- a/webpaste.el
+++ b/webpaste.el
@@ -177,16 +177,8 @@ When we run out of providers to try, it will restart since
   "Paste selected region to some paste service."
   (interactive)
 
-  (let ((text (buffer-substring (mark) (point))))
-    (webpaste-paste-text text)))
-
-
-;;;###autoload
-(defmacro webpaste-save-mark-and-excursion (&rest body)
-  "Wraps usage of sending BODY to ‘save-mark-and-excursion’ / 
‘save-excursion’."
-  (if (< emacs-major-version 25)
-      `(save-excursion ,@body)
-    `(save-mark-and-excursion ,@body)))
+  ;; Extract the buffer contents with buffer-substring and paste it
+  (webpaste-paste-text (buffer-substring (mark) (point))))
 
 
 ;;;###autoload
@@ -194,10 +186,8 @@ When we run out of providers to try, it will restart since
   "Paste current buffer to some paste service."
   (interactive)
 
-  (webpaste-save-mark-and-excursion
-   (set-mark (point-min))               ; Set mark on point-min
-   (goto-char (point-max))              ; Go to point-max
-   (webpaste-paste-region)))            ; Paste region
+  ;; Extract the buffer contents with buffer-substring and paste it
+  (webpaste-paste-text (buffer-substring (point-min) (point-max))))
 
 
 (provide 'webpaste)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]