[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gnuplot a290617 079/184: Make info window/frame handling w
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gnuplot a290617 079/184: Make info window/frame handling work alike in context and non-context modes |
Date: |
Sun, 29 Aug 2021 11:03:19 -0400 (EDT) |
branch: elpa/gnuplot
commit a290617eef82b6c2e3383de2b203c769902f78a4
Author: joddie <jonxfield@gmail.com>
Commit: joddie <jonxfield@gmail.com>
Make info window/frame handling work alike in context and non-context modes
- Also make sure that visiting a particular info node works in pre-23
emacs versions, where (info "(gnuplot)node") doesn't work: see
`gnuplot--find-info-node'
---
.gitignore | 1 +
gnuplot-context.el | 30 ++++++++++-----------
gnuplot.el | 77 ++++++++++++++++++++++++++++++------------------------
3 files changed, 59 insertions(+), 49 deletions(-)
diff --git a/.gitignore b/.gitignore
index 4f4afcc..b33132c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,4 @@
/Makefile
/config.cache
/config.status
+/info-look.el
diff --git a/gnuplot-context.el b/gnuplot-context.el
index d125525..07632bd 100644
--- a/gnuplot-context.el
+++ b/gnuplot-context.el
@@ -248,9 +248,11 @@
;; It would be possible to provide more helpful ElDoc strings for
;; sub-parts of complicated options like "cntrparam". This is a time
;; and maintenance issue rather than a technical one.
-;;
-;;
+;;; Code:
+
+
+;; Library dependencies
(eval-when-compile
(require 'cl)
(require 'advice)
@@ -282,11 +284,7 @@ These have to be compiled from the Gnuplot source tree
using
(when (not (fboundp 'buffer-local-value))
(defmacro buffer-local-value (variable buffer)
- `(with-current-buffer ,buffer ,variable)))
-
- (when (not (fboundp 'info-other-window))
- (defmacro info-other-window (&rest args)
- `(info ,@args))))
+ `(with-current-buffer ,buffer ,variable))))
;;;; Interface to turning the mode on and off
@@ -2237,14 +2235,16 @@ there."
(let ((info
(info-lookup-interactive-arguments 'symbol)))
(setq gnuplot-info-at-point (car info))))
- (and gnuplot-info-at-point
- (info-other-window (format "(gnuplot)%s" gnuplot-info-at-point))))
-
-(defun gnuplot-info-look-guess ()
- (gnuplot-parse-at-point nil)
- gnuplot-info-at-point)
-
-
+ (when gnuplot-info-at-point
+ (gnuplot--find-info-node gnuplot-info-at-point)))
+
+(defun gnuplot--find-info-node (node)
+ (save-window-excursion
+ (if (>= emacs-major-version 23)
+ (info (format "(gnuplot)%s" node))
+ (info)
+ (Info-find-node "gnuplot" node)))
+ (gnuplot--adjust-info-display))
;;; Some context-sensitive hacks
diff --git a/gnuplot.el b/gnuplot.el
index 65ca228..9740fd7 100644
--- a/gnuplot.el
+++ b/gnuplot.el
@@ -2849,12 +2849,10 @@ completion."
(defun gnuplot-info-lookup-symbol (symbol &optional mode)
"Wrapper for `info-lookup-symbol'.
-Takes SYMBOL and MODE as arguments exactly as `info-lookup-symbol'.
-After doing the info lookup, this displays the info file in a window
-frame as specified by the value of `gnuplot-info-display'. If
-`gnuplot-info-display' is 'window, then the window will be shrunk to
-the size of the info entry if it is smaller than half the height of
-the frame."
+Takes SYMBOL and MODE as arguments exactly as
+`info-lookup-symbol'. After doing the info lookup, calls
+`gnuplot--adjust-info-display' to display the info buffer
+according to the value of `gnuplot-info-display'."
(interactive
(cond (gnuplot-keywords
(info-lookup-interactive-arguments 'symbol))
@@ -2865,34 +2863,45 @@ the frame."
(list nil (message
"Help is not available. The gnuplot info file could not be found.")))))
- (if (and (featurep 'info-look) gnuplot-keywords)
- (let ((buff (current-buffer))
- (info-lookup-other-window-flag
- (if gnuplot-info-display t nil)))
- (if symbol () (setq symbol "Commands"))
- (info-lookup-symbol symbol mode)
- (cond ((equal gnuplot-info-display 'window)
- ;; Adjust window height only if the frame is split
- ;; horizontally, so as not to mess up the minibuffer <jjo>
- ;; we can't use shrink-window-if-larger-than-buffer here
- ;; because it doesn't work with Info mode's narrowing
- (with-selected-window (get-buffer-window "*info*")
- (unless (gnuplot-window-full-height-p)
- (enlarge-window
- (min (- (count-lines (point-min) (point-max))
(window-height) -1)
- (- (/ (frame-height) 2) (window-height)))))))
-
- ((equal gnuplot-info-display 'frame)
- (switch-to-buffer buff)
- (delete-other-windows)
- (or (and gnuplot-info-frame
- (frame-live-p gnuplot-info-frame))
- (setq gnuplot-info-frame (make-frame)))
- (select-frame gnuplot-info-frame)
- (raise-frame gnuplot-info-frame)
- (if gnuplot-xemacs-p (setq toolbar-info-frame
gnuplot-info-frame))
- (switch-to-buffer "*info*"))))))
-
+ (when (and (featurep 'info-look) gnuplot-keywords)
+ (unless symbol (setq symbol "Commands"))
+ (save-window-excursion
+ (info-lookup-symbol symbol mode))
+ (gnuplot--adjust-info-display)))
+
+(defun gnuplot--adjust-info-display ()
+ "Displays the *info* buffer in a window or frame as specified
+by the value of `gnuplot-info-display'. If
+`gnuplot-info-display' is 'window, then the window will be shrunk
+to the size of the info entry if it is smaller than half the
+height of the frame.
+
+The *info* buffer should already exist when this function is
+called."
+ (case gnuplot-info-display
+ (window
+ (switch-to-buffer-other-window "*info*")
+ ;; Adjust window height only if the frame is split
+ ;; horizontally, so as not to mess up the minibuffer <jjo>
+ ;; we can't use shrink-window-if-larger-than-buffer here
+ ;; because it doesn't work with Info mode's narrowing
+ (with-selected-window (get-buffer-window "*info*")
+ (unless (gnuplot-window-full-height-p)
+ (enlarge-window
+ (min (- (count-lines (point-min) (point-max)) (window-height) -1)
+ (- (/ (frame-height) 2) (window-height)))))))
+
+ (frame
+ (unless (and gnuplot-info-frame
+ (frame-live-p gnuplot-info-frame))
+ (setq gnuplot-info-frame (make-frame)))
+ (select-frame gnuplot-info-frame)
+ (raise-frame gnuplot-info-frame)
+ (if gnuplot-xemacs-p (setq toolbar-info-frame gnuplot-info-frame))
+ (switch-to-buffer "*info*"))
+
+ (t
+ (switch-to-buffer "*info*"))))
(defun gnuplot-insert (string)
"Insert STRING at point and display help for for STRING.
- [nongnu] elpa/gnuplot d4f8c3a 082/184: display progress while running parse tests, (continued)
- [nongnu] elpa/gnuplot d4f8c3a 082/184: display progress while running parse tests, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 6da76ee 052/184: Merge branch 'devel', ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot d26d498 062/184: Added a customization option for gnuplot-inline-image-mode., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot d70c94a 065/184: Better docstrings for context-sensitive and inline-image modes, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 43effb0 068/184: Add gnuplot-context to makefiles., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot f0b1ea7 085/184: Update lists of font-lock keywords., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 70dd22e 060/184: Keyboard shortcut and menu item for toggling inline mode., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot a0fee02 086/184: use `many1' for iteration spec, and tweak its test case, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 2dc71de 077/184: Move window-full-height-p up with other compatibility hacks, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 3245468 084/184: Fixes to context-sensitive grammar, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot a290617 079/184: Make info window/frame handling work alike in context and non-context modes,
ELPA Syncer <=
- [nongnu] elpa/gnuplot af7e8de 073/184: Remove references to obsolete kw-compl and hilit19 packages, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 630c945 093/184: Clean up build process to be closer to gnuplot source tree., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot c827a90 090/184: Load gnuplot-eldoc only if needed, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot cabfc6c 088/184: fix annoying delay in indentation with blinking paren mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 327d564 091/184: Fix indentation: only outdent a maximum of one closing brace per line, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 7046fe1 092/184: Misc cleanup and documentation, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot a25b290 094/184: Update README for new release., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 0134457 098/184: Add configure scripts, etc. back to repository for easier building, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 1b8e0e3 095/184: Update included info file for Gnuplot 4.6, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot d5eb309 102/184: Merge pull request #17 from yyr/master, ELPA Syncer, 2021/08/29