Stop moving point and remove usage of save-excursion and therefore

simplify the code greatly.
master
Elis Axelsson 10 years ago
parent abe4fd5c4d
commit cb9cca769b
  1. 18
      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." "Paste selected region to some paste service."
(interactive) (interactive)
(let ((text (buffer-substring (mark) (point)))) ;; Extract the buffer contents with buffer-substring and paste it
(webpaste-paste-text text))) (webpaste-paste-text (buffer-substring (mark) (point))))
;;;###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)))
;;;###autoload ;;;###autoload
@ -194,10 +186,8 @@ When we run out of providers to try, it will restart since
"Paste current buffer to some paste service." "Paste current buffer to some paste service."
(interactive) (interactive)
(webpaste-save-mark-and-excursion ;; Extract the buffer contents with buffer-substring and paste it
(set-mark (point-min)) ; Set mark on point-min (webpaste-paste-text (buffer-substring (point-min) (point-max))))
(goto-char (point-max)) ; Go to point-max
(webpaste-paste-region))) ; Paste region
(provide 'webpaste) (provide 'webpaste)

Loading…
Cancel
Save