[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gnuplot b0beecd 008/184: Improved gnuplot-send-string-to-g
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gnuplot b0beecd 008/184: Improved gnuplot-send-string-to-gnuplot |
Date: |
Sun, 29 Aug 2021 11:03:05 -0400 (EDT) |
branch: elpa/gnuplot
commit b0beecdcf312e10078bb1f606ce2b24630d2cd55
Author: Jonathan Oddie <j.j.oddie@gmail.com>
Commit: Jonathan Oddie <j.j.oddie@gmail.com>
Improved gnuplot-send-string-to-gnuplot
- Use (with-current-buffer) instead of explicitly setting and restoring
with (other-window)
- New defun: gnuplot-display-and-recenter-gnuplot-buffer factors out
a couple of repeated lines in gnuplot-send-string-to-gnuplot
---
gnuplot.el | 58 ++++++++++++++++++++++++++++++----------------------------
1 file changed, 30 insertions(+), 28 deletions(-)
diff --git a/gnuplot.el b/gnuplot.el
index 3afa05e..19fc651 100644
--- a/gnuplot.el
+++ b/gnuplot.el
@@ -30,7 +30,7 @@
;; program's maintainer or write to: The Free Software Foundation,
;; Inc.; 675 Massachusetts Avenue; Cambridge, MA 02139, USA.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; send bug reports to the author (ravel@phys.washington.edu)
+;; send bug reports to the author (bruceravel1@gmail.com)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Commentary:
;;
@@ -1633,6 +1633,8 @@ called by this function after all of STRING is sent to
gnuplot."
(gnuplot-fetch-version-number)
(sit-for 2)))
(setq gnuplot-comint-recent-buffer (current-buffer))
+
+ ;; Create a gnuplot frame if needed
(if (equal gnuplot-display-process 'frame)
(or (and gnuplot-process-frame
(frame-live-p gnuplot-process-frame))
@@ -1641,39 +1643,39 @@ called by this function after all of STRING is sent to
gnuplot."
(select-frame gnuplot-process-frame)
(switch-to-buffer gnuplot-buffer)
(delete-other-windows)
- (select-frame frame))) )
- (let ((buffer (current-buffer))
- (gbuffer (get-buffer gnuplot-buffer))
- (list (gnuplot-split-string string)))
- (set-buffer gbuffer)
- (goto-char (point-max))
- ;; bruce asks: what is this next line for?
- (set-marker (process-mark gnuplot-process) (point-marker))
- (sleep-for (* 20 gnuplot-delay))
- (while list
- (insert (car list))
- (comint-send-input)
- (sleep-for gnuplot-delay)
- (setq list (cdr list))
- (goto-char (point-max)))
- (set-buffer buffer)
+ (select-frame frame))))
+
+ (let ((list (gnuplot-split-string string)))
+ (with-current-buffer (get-buffer gnuplot-buffer)
+ (goto-char (point-max))
+ ;; bruce asks: what is this next line for?
+ (set-marker (process-mark gnuplot-process) (point-marker))
+ (sleep-for (* 20 gnuplot-delay))
+ (while list
+ (insert (car list))
+ (comint-send-input)
+ (sleep-for gnuplot-delay)
+ (setq list (cdr list))
+ (goto-char (point-max))))
+
(cond ((equal gnuplot-display-process 'window)
- (select-window (display-buffer gbuffer))
- (goto-char (point-max))
- (or (pos-visible-in-window-p (point) (selected-window))
- (recenter 5))
- (other-window 1))
+ (gnuplot-display-and-recenter-gnuplot-buffer))
((equal gnuplot-display-process 'frame)
;;(raise-frame gnuplot-process-frame)
- (select-frame gnuplot-process-frame)
- (display-buffer gbuffer)
- (goto-char (point-max))
- (or (pos-visible-in-window-p (point) (selected-window))
- (recenter 5))))
- ;;(process-send-string gnuplot-program string)
+ (with-selected-frame gnuplot-process-frame
+ (gnuplot-display-and-recenter-gnuplot-buffer))))
+
(setq gnuplot-recently-sent text)
(run-hooks 'gnuplot-after-plot-hook)))
+(defun gnuplot-display-and-recenter-gnuplot-buffer ()
+ "Make sure the gnuplot comint buffer is displayed, and
+move point to the end if necessary"
+ (save-selected-window
+ (select-window (display-buffer (get-buffer gnuplot-buffer)))
+ (goto-char (point-max))
+ (unless (pos-visible-in-window-p (point) (selected-window)) (recenter 5))))
+
(defun gnuplot-send-region-to-gnuplot (&optional begin end text)
"Sends a selected region to the gnuplot program.
If BEGIN and END are not specified, point and mark are used. TEXT
- [nongnu] elpa/gnuplot 2c1e7cb 177/184: Rewrite README.org, (continued)
- [nongnu] elpa/gnuplot 2c1e7cb 177/184: Rewrite README.org, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot fbb15b6 168/184: Merge pull request #60 from conao3/fix-ci, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 24dd2d0 170/184: Merge pull request #64 from mtreca/info-update, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 1f8f051 166/184: use actions/setup-python@v2 instead of v1.1.1, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 90bfd6d 179/184: Simplify Makefile situation, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot f0001c3 163/184: Merge pull request #55 from emacsorphanage/revert-54-delete-xemacs, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 07a8027 183/184: Do not add lines to kill-ring when trimming the gnuplot buffer (#72), ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 7138b13 184/184: Fixup parens in gnuplot-trim-gnuplot-buffer, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 10f0d54 004/184: updated README.org, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot b51d4a9 001/184: initial commit, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot b0beecd 008/184: Improved gnuplot-send-string-to-gnuplot,
ELPA Syncer <=
- [nongnu] elpa/gnuplot 00dadc3 011/184: Restored the check for XEmacs before calling make-local-hook, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 0beb68b 009/184: Corrected a couple typos in contact info, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 316d7df 006/184: Again README.org, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 10cf107 021/184: Fixed some more XEmacs compatibility that I broke, ho hum!, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 958db84 018/184: Use `add-hook' instead of `make-local-variable' in `gnuplot-comint-mode', ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot db98e06 012/184: Changed set up of info-look documentation and completion, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 51756c3 015/184: Changed fetch-version-number to work with older gnuplots, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 710854f 026/184: Fixed a bug in gnuplot-end-of-continuation at beginning of buffer, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot cc4c45c 042/184: Merge branch 'context' of github.com:bruceravel/gnuplot-mode into context, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 8169bb8 045/184: Minor updates to info pages for some "set" commands, ELPA Syncer, 2021/08/29