[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gnuplot 99c3855 130/184: Move gnuplot-context-sensitive-mo
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gnuplot 99c3855 130/184: Move gnuplot-context-sensitive-mode into gnuplot.el |
Date: |
Sun, 29 Aug 2021 11:03:30 -0400 (EDT) |
branch: elpa/gnuplot
commit 99c385553caaa2ddfe74210de76c55017fc84cd1
Author: joddie <jonxfield@gmail.com>
Commit: joddie <jonxfield@gmail.com>
Move gnuplot-context-sensitive-mode into gnuplot.el
This makes it easier to turn on and off w/o loading gnuplot-context.el
---
gnuplot-context.el | 82 ----------------------------------------------
gnuplot.el | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 95 insertions(+), 82 deletions(-)
diff --git a/gnuplot-context.el b/gnuplot-context.el
index 1642578..b685974 100644
--- a/gnuplot-context.el
+++ b/gnuplot-context.el
@@ -269,88 +269,6 @@ These have to be compiled from the Gnuplot source tree
using
`(save-match-data (string-match ,@args)))))
-;;;; Minor mode
-(define-minor-mode gnuplot-context-sensitive-mode
- "Use context-sensitive completion and help in gnuplot-mode.
-
-When context-sensitive mode is enabled, gnuplot-mode tries to
-provide more useful completions and help suggestions for built-in
-keywords and functions by parsing each command as you type. It
-attempts to take into account Gnuplot's many abbreviated
-keywords. For example, with point at the end of a line reading
-\"plot 'datafile' w \", typing \\[completion-at-point] will pop
-up a list of plotting styles.
-
-\\[completion-at-point] will complete the keyword at point based
-on its context in the command. To make keyword completion work on
-pressing TAB, set `tab-always-indent' to `complete', or customize
-`gnuplot-tab-completion' to make this automatic in gnuplot-mode
-buffers.
-
-\\[gnuplot-info-at-point] will try to find the most relevant
-Gnuplot info node for the construction at point, prompting for a
-node name if nothing is found.
-
-\\[gnuplot-help-function] will pop up a brief summary of the
-syntax at point in the minibuffer. To have one-line syntax
-summaries appear in the echo area as you type, toggle
-`eldoc-mode' or customize `gnuplot-eldoc-mode'.
-
-To choose whether to use this mode by default in Gnuplot buffers,
-customize the variable
-`gnuplot-use-context-sensitive-completion'.
-
-Note: help strings for eldoc-mode and \\[gnuplot-help-function]
-need to be provided in an Emacs-readable form by the Gnuplot
-distribution. See gnuplot-context.el for details."
- :keymap
- `((,(kbd "C-c C-/") . gnuplot-help-function)
- (,(kbd "C-c C-d") . gnuplot-info-at-point))
- (unless (derived-mode-p 'gnuplot-mode 'gnuplot-comint-mode)
- (message "Gnuplot context-sensitive mode works only in Gnuplot-mode
buffers")
- (setq gnuplot-context-sensitive-mode nil))
- (if gnuplot-context-sensitive-mode
- ;; Turn on
- (progn
- (setq gnuplot-completion-at-point-function
#'gnuplot-context-completion-at-point)
- (define-key gnuplot-comint-mode-map (kbd "TAB")
'comint-dynamic-complete)
-
- ;; Setup Eldoc
- (set (make-local-variable 'eldoc-documentation-function)
- 'gnuplot-eldoc-function)
- (eldoc-add-command 'completion-at-point) ; Check for eldoc after
completion
- (when (fboundp 'comint-dynamic-complete)
- (eldoc-add-command 'comint-dynamic-complete))
-
- ;; Try to load Eldoc strings
- (when gnuplot-eldoc-mode
- (unless gnuplot-eldoc-hash
- (condition-case nil
- (load-library "gnuplot-eldoc")
- (error
- (message "gnuplot-eldoc.el not found. Install it from the
Gnuplot distribution.")
- (setq gnuplot-eldoc-hash nil
- gnuplot-eldoc-mode nil))))
-
- (if gnuplot-eldoc-hash
- (eldoc-mode 1)
- (eldoc-mode 0)))
-
- ;; Set up tab-to-complete
- (when gnuplot-tab-completion
- (set (make-local-variable 'tab-always-indent) 'complete))
-
- (when called-interactively-p
- (message "Gnuplot context-sensitive help & completion enabled.")))
-
- ;; Turn off
- (setq gnuplot-completion-at-point-function
#'gnuplot-completion-at-point-info-look)
- (setq eldoc-documentation-function nil)
- (eldoc-mode 0)
- (when called-interactively-p
- (message "Gnuplot context-sensitive help & completion disabled."))))
-
-
;;;; The tokenizer.
(defstruct gnuplot-token
diff --git a/gnuplot.el b/gnuplot.el
index 36be805..419d8b7 100644
--- a/gnuplot.el
+++ b/gnuplot.el
@@ -2870,12 +2870,106 @@ Return a list of keywords."
(delete "nil" store)
store ))
+
+;;;; Completion at point
+
+;; There are two alternative completion-at-point mechanisms: the old
+;; one using info-look and the new one (enabled by default) which
+;; parses the command line to provide smarter completions.
+
+;; `gnuplot-completion-at-point-function' defines which one is
+;; used. `gnuplot-context-sensitive-mode' toggles between the two.
+
(defvar gnuplot-completion-at-point-function
#'gnuplot-completion-at-point-info-look
"Function to call to perform completion in Gnuplot buffers.")
(defun gnuplot-completion-at-point ()
(funcall gnuplot-completion-at-point-function))
+;; Enable and disable context-sensitive completion
+(define-minor-mode gnuplot-context-sensitive-mode
+ "Use context-sensitive completion and help in gnuplot-mode.
+
+When context-sensitive mode is enabled, gnuplot-mode tries to
+provide more useful completions and help suggestions for built-in
+keywords and functions by parsing each command as you type. It
+attempts to take into account Gnuplot's many abbreviated
+keywords. For example, with point at the end of a line reading
+\"plot 'datafile' w \", typing \\[completion-at-point] will pop
+up a list of plotting styles.
+
+Key bindings:
+
+\\[completion-at-point] will complete the keyword at point based
+on its context in the command. To make keyword completion work on
+pressing TAB, set `tab-always-indent' to `complete', or customize
+`gnuplot-tab-completion' to make this automatic in gnuplot-mode
+buffers.
+
+\\[gnuplot-info-at-point] will try to find the most relevant
+Gnuplot info node for the construction at point, prompting for a
+node name if nothing is found.
+
+\\[gnuplot-help-function] will pop up a brief summary of the
+syntax at point in the minibuffer. To have one-line syntax
+summaries appear in the echo area as you type, toggle
+`eldoc-mode' or customize `gnuplot-eldoc-mode'.
+
+To choose whether to use this mode by default in Gnuplot buffers,
+customize the variable
+`gnuplot-use-context-sensitive-completion'.
+
+Note: help strings for eldoc-mode and \\[gnuplot-help-function]
+need to be provided in an Emacs-readable form by the Gnuplot
+distribution. See gnuplot-context.el for details."
+ :keymap
+ `((,(kbd "C-c C-/") . gnuplot-help-function)
+ (,(kbd "C-c C-d") . gnuplot-info-at-point))
+ (unless (derived-mode-p 'gnuplot-mode 'gnuplot-comint-mode)
+ (message "Gnuplot context-sensitive mode works only in Gnuplot-mode
buffers")
+ (setq gnuplot-context-sensitive-mode nil))
+ (if gnuplot-context-sensitive-mode
+ ;; Turn on
+ (progn
+ (setq gnuplot-completion-at-point-function
#'gnuplot-context-completion-at-point)
+ (define-key gnuplot-comint-mode-map (kbd "TAB")
'comint-dynamic-complete)
+
+ ;; Setup Eldoc
+ (set (make-local-variable 'eldoc-documentation-function)
+ 'gnuplot-eldoc-function)
+ (eldoc-add-command 'completion-at-point) ; Check for eldoc after
completion
+ (when (fboundp 'comint-dynamic-complete)
+ (eldoc-add-command 'comint-dynamic-complete))
+
+ ;; Try to load Eldoc strings
+ (when gnuplot-eldoc-mode
+ (unless gnuplot-eldoc-hash
+ (condition-case nil
+ (load-library "gnuplot-eldoc")
+ (error
+ (message "gnuplot-eldoc.el not found. Install it from the
Gnuplot distribution.")
+ (setq gnuplot-eldoc-hash nil
+ gnuplot-eldoc-mode nil))))
+
+ (if gnuplot-eldoc-hash
+ (eldoc-mode 1)
+ (eldoc-mode 0)))
+
+ ;; Set up tab-to-complete
+ (when gnuplot-tab-completion
+ (set (make-local-variable 'tab-always-indent) 'complete))
+
+ (when called-interactively-p
+ (message "Gnuplot context-sensitive help & completion enabled.")))
+
+ ;; Turn off
+ (setq gnuplot-completion-at-point-function
#'gnuplot-completion-at-point-info-look)
+ (setq eldoc-documentation-function nil)
+ (eldoc-mode 0)
+ (when called-interactively-p
+ (message "Gnuplot context-sensitive help & completion disabled."))))
+
+;; Older completion method using info-look
(defun gnuplot-completion-at-point-info-look ()
"Return completions of keyword preceding point.
@@ -2914,6 +3008,7 @@ completion."
candidates))
nil)))
+
(defun gnuplot-info-lookup-symbol (symbol &optional mode)
"Wrapper for `info-lookup-symbol'.
Takes SYMBOL and MODE as arguments exactly as
- [nongnu] elpa/gnuplot c97f028 078/184: use a defsubst instead of defmacro in debug-context, (continued)
- [nongnu] elpa/gnuplot c97f028 078/184: use a defsubst instead of defmacro in debug-context, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot f710394 057/184: Add keys C-M-x (evaluate region) and C-j (evaluate line and newline), ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 54f3882 070/184: Silence another compiler warning by using with-current-buffer, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 35f3f8d 080/184: Avoid having text syntax-property changes mark buffer as modified, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot fdd3e1e 101/184: * README.org: update installation section for el-get users., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 35a8a19 108/184: Check for `syntax-propertize-function' when defining syntax-table, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 4cd89ab 109/184: Replace ad-hoc scanning with syntax-propertize-rules, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 09ff207 131/184: Remove un-needed `gnuplot-context-mode-p` function, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot d6f8598 121/184: Cleanup inline-image mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot a885233 124/184: Cleanup workaround for window-full-height-p, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 99c3855 130/184: Move gnuplot-context-sensitive-mode into gnuplot.el,
ELPA Syncer <=
- [nongnu] elpa/gnuplot 2ec49e9 139/184: Update GitHub url, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 4b267b8 146/184: Merge pull request #44 from conao3/change-license, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 4d04c86 150/184: remove weird char, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 8f2ddd0 148/184: untabify, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot fcf5f4b 160/184: [WIP] Start removing Xemacs, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot e47e77e 155/184: Merge pull request #49 from conao3/fix-completion, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot e6dc1f6 164/184: comint-process-echoes is buffer-local, ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot df47e87 181/184: Remove version-related variables., ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 62117fe 171/184: Deprecate XEmacs support and XEmacs toolbar (#59), ELPA Syncer, 2021/08/29
- [nongnu] elpa/gnuplot 32c280e 172/184: Add a gnuplot-program-args variable. (#65), ELPA Syncer, 2021/08/29