branch: elpa/gnuplot
commit c4d464a73de1ef0e5c8b57252457af2738da5720
Author: joddie <[email protected]>
Commit: joddie <[email protected]>
Use `gnuplot-completion-at-point-function' instead of advice hackery
---
gnuplot-context.el | 15 ++-------------
gnuplot.el | 6 ++++++
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/gnuplot-context.el b/gnuplot-context.el
index dfac86b..5b60096 100644
--- a/gnuplot-context.el
+++ b/gnuplot-context.el
@@ -248,7 +248,6 @@
;; Library dependencies
(eval-when-compile
(require 'cl)
- (require 'advice)
;; Prevent compiler warnings about undefined functions
(require 'gnuplot))
@@ -338,9 +337,7 @@ off. With no argument, toggle context-sensitive mode."
,@forms)))))
(defun gnuplot--turn-on-context-sensitive-mode ()
- (ad-enable-advice 'gnuplot-completion-at-point
- 'around 'gnuplot-context)
- (ad-activate 'gnuplot-completion-at-point)
+ (setq gnuplot-completion-at-point-function
#'gnuplot-context-completion-at-point)
(dolist (keymap (list gnuplot-mode-map gnuplot-comint-mode-map))
(define-key keymap (kbd "C-c M-h") 'gnuplot-help-function)
@@ -357,9 +354,7 @@ off. With no argument, toggle context-sensitive mode."
(define-key keymap (kbd "C-c M-h") 'undefined)
(define-key keymap (kbd "C-c C-/") 'undefined)
(define-key keymap (kbd "C-c C-d") 'gnuplot-info-lookup-symbol))
- (ad-disable-advice 'gnuplot-completion-at-point
- 'around 'gnuplot-context)
- (ad-activate 'gnuplot-completion-at-point)
+ (setq gnuplot-completion-at-point-function
#'gnuplot-completion-at-point-info-look)
(remove-hook 'gnuplot-mode-hook 'gnuplot-setup-eldoc)
(remove-hook 'gnuplot-comint-mode-hook 'gnuplot-setup-eldoc)
@@ -367,12 +362,6 @@ off. With no argument, toggle context-sensitive mode."
(setq eldoc-documentation-function nil)
(eldoc-mode 0)))
-;; Has to be defined here. Grumble.
-(defadvice gnuplot-completion-at-point (around gnuplot-context disable)
- ;; This around-advice gets activated/deactivated when turning
- ;; context-sensitivity on and off
- (setq ad-return-value (gnuplot-context-completion-at-point)))
-
(defun gnuplot-setup-eldoc ()
(set (make-local-variable 'eldoc-documentation-function)
'gnuplot-eldoc-function)
diff --git a/gnuplot.el b/gnuplot.el
index 6e25b15..7c6929a 100644
--- a/gnuplot.el
+++ b/gnuplot.el
@@ -2893,7 +2893,13 @@ Return a list of keywords."
(delete "nil" store)
store ))
+(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))
+
+(defun gnuplot-completion-at-point-info-look ()
"Return completions of keyword preceding point.
Uses the cache of keywords generated by info-lookup. See