[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 26/52: Backport defvar-local from Emacs 24.2
From: |
Dmitry Gutov |
Subject: |
[elpa] 26/52: Backport defvar-local from Emacs 24.2 |
Date: |
Tue, 01 Jul 2014 11:53:19 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit a00d59a981b583b4d3e825169e541b5e8920db3b
Author: Bozhidar Batsov <address@hidden>
Date: Wed Jun 4 16:48:48 2014 +0300
Backport defvar-local from Emacs 24.2
---
company-capf.el | 4 +-
company-eclim.el | 6 +--
company-etags.el | 3 +-
company-gtags.el | 5 +--
company-pysmell.el | 4 +-
company-semantic.el | 3 +-
company-template.el | 3 +-
company-xcode.el | 3 +-
company.el | 91 ++++++++++++++++++++++-----------------------------
9 files changed, 51 insertions(+), 71 deletions(-)
diff --git a/company-capf.el b/company-capf.el
index 3aaeb13..4a3c083 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -25,10 +25,10 @@
;;; Code:
+(require 'company)
(require 'cl-lib)
-(defvar company--capf-data nil)
-(make-variable-buffer-local 'company--capf-data)
+(defvar-local company--capf-data nil)
(defun company--capf-clear-data (&optional _ignore)
(setq company--capf-data nil)
diff --git a/company-eclim.el b/company-eclim.el
index 0eaf382..1f1beae 100644
--- a/company-eclim.el
+++ b/company-eclim.el
@@ -60,11 +60,9 @@ eclim can only complete correctly when the buffer has been
saved."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar company-eclim--project-dir 'unknown)
-(make-variable-buffer-local 'company-eclim--project-dir)
+(defvar-local company-eclim--project-dir 'unknown)
-(defvar company-eclim--project-name nil)
-(make-variable-buffer-local 'company-eclim--project-name)
+(defvar-local company-eclim--project-name nil)
(declare-function json-read "json")
(defvar json-array-type)
diff --git a/company-etags.el b/company-etags.el
index 8634103..32c13f7 100644
--- a/company-etags.el
+++ b/company-etags.el
@@ -47,8 +47,7 @@ buffer automatically."
(defvar company-etags-modes '(prog-mode c-mode objc-mode c++-mode java-mode
jde-mode pascal-mode perl-mode python-mode))
-(defvar company-etags-buffer-table 'unknown)
-(make-variable-buffer-local 'company-etags-buffer-table)
+(defvar-local company-etags-buffer-table 'unknown)
(defun company-etags-find-table ()
(let ((file (locate-dominating-file (or buffer-file-name
diff --git a/company-gtags.el b/company-gtags.el
index 204a111..d36ac1b 100644
--- a/company-gtags.el
+++ b/company-gtags.el
@@ -41,8 +41,7 @@
'company-gtags-gnu-global-program-name
'company-gtags-executable "earlier")
-(defvar company-gtags--tags-available-p 'unknown)
-(make-variable-buffer-local 'company-gtags--tags-available-p)
+(defvar-local company-gtags--tags-available-p 'unknown)
(defvar company-gtags-modes '(c-mode c++-mode jde-mode java-mode php-mode))
@@ -64,7 +63,7 @@
"\\([^ ]*\\)" ;; completion
"[ \t]+\\([[:digit:]]+\\)" ;; linum
"[ \t]+\\([^ \t]+\\)" ;; file
- "[ \t]+\\(.*\\)" ;; definition
+ "[ \t]+\\(.*\\)" ;; definition
"$"
) nil t)
collect
diff --git a/company-pysmell.el b/company-pysmell.el
index 2f22bf0..8a69e76 100644
--- a/company-pysmell.el
+++ b/company-pysmell.el
@@ -28,10 +28,10 @@
;;; Code:
(if t (require 'pysmell)) ;Don't load during compilation.
+(require 'company)
(require 'cl-lib)
-(defvar company-pysmell--available-p 'unknown)
-(make-variable-buffer-local 'company-pysmell--available-p)
+(defvar-local company-pysmell--available-p 'unknown)
(defun company-pysmell--available-p ()
(if (eq company-pysmell--available-p 'unknown)
diff --git a/company-semantic.el b/company-semantic.el
index 110d4fd..6c020a3 100644
--- a/company-semantic.el
+++ b/company-semantic.el
@@ -49,9 +49,8 @@
(defvar company-semantic-modes '(c-mode c++-mode jde-mode java-mode))
-(defvar company-semantic--current-tags nil
+(defvar-local company-semantic--current-tags nil
"Tags for the current context.")
-(make-variable-buffer-local 'company-semantic--current-tags)
(defun company-semantic-documentation-for-tag (tag)
(when (semantic-tag-buffer tag)
diff --git a/company-template.el b/company-template.el
index d689183..576b246 100644
--- a/company-template.el
+++ b/company-template.el
@@ -35,8 +35,7 @@
(define-key keymap (kbd "TAB") 'company-template-forward-field)
keymap))
-(defvar company-template--buffer-templates nil)
-(make-variable-buffer-local 'company-template--buffer-templates)
+(defvar-local company-template--buffer-templates nil)
;; interactive
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/company-xcode.el b/company-xcode.el
index 7a985aa..91ae60b 100644
--- a/company-xcode.el
+++ b/company-xcode.el
@@ -62,8 +62,7 @@ valid in most contexts."
(const "Structure") (const "Type") (const "Union")
(const "Variable") (const "Function")))
-(defvar company-xcode-project 'unknown)
-(make-variable-buffer-local 'company-xcode-project)
+(defvar-local company-xcode-project 'unknown)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/company.el b/company.el
index b95a255..08b3a96 100644
--- a/company.el
+++ b/company.el
@@ -81,6 +81,19 @@
(add-to-list 'debug-ignored-errors "^Cannot complete at point$")
(add-to-list 'debug-ignored-errors "^No other back-end$")
+;;; Compatibility
+(eval-and-compile
+ ;; `defvar-local' for Emacs 24.2 and below
+ (unless (fboundp 'defvar-local)
+ (defmacro defvar-local (var val &optional docstring)
+ "Define VAR as a buffer-local variable with default value VAL.
+Like `defvar' but additionally marks the variable as being automatically
+buffer-local wherever it is set."
+ (declare (debug defvar) (doc-string 3))
+ `(progn
+ (defvar ,var ,val ,docstring)
+ (make-variable-buffer-local ',var)))))
+
(defgroup company nil
"Extensible inline text completion mechanism"
:group 'abbrev
@@ -639,8 +652,7 @@ asynchronous call into synchronous.")
(defvar company-default-lighter " company")
-(defvar company-lighter company-default-lighter)
-(make-variable-buffer-local 'company-lighter)
+(defvar-local company-lighter company-default-lighter)
;;;###autoload
(define-minor-mode company-mode
@@ -714,8 +726,7 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
;;; keymaps
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar company-my-keymap nil)
-(make-variable-buffer-local 'company-my-keymap)
+(defvar-local company-my-keymap nil)
(defvar company-emulation-alist '((t . nil)))
@@ -769,8 +780,7 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
;;; backends
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar company-backend nil)
-(make-variable-buffer-local 'company-backend)
+(defvar-local company-backend nil)
(defun company-grab (regexp &optional expression limit)
(when (looking-back regexp limit)
@@ -919,51 +929,38 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
;;; completion mechanism
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar company-prefix nil)
-(make-variable-buffer-local 'company-prefix)
+(defvar-local company-prefix nil)
-(defvar company-candidates nil)
-(make-variable-buffer-local 'company-candidates)
+(defvar-local company-candidates nil)
-(defvar company-candidates-length nil)
-(make-variable-buffer-local 'company-candidates-length)
+(defvar-local company-candidates-length nil)
-(defvar company-candidates-cache nil)
-(make-variable-buffer-local 'company-candidates-cache)
+(defvar-local company-candidates-cache nil)
-(defvar company-candidates-predicate nil)
-(make-variable-buffer-local 'company-candidates-predicate)
+(defvar-local company-candidates-predicate nil)
-(defvar company-common nil)
-(make-variable-buffer-local 'company-common)
+(defvar-local company-common nil)
-(defvar company-selection 0)
-(make-variable-buffer-local 'company-selection)
+(defvar-local company-selection 0)
-(defvar company-selection-changed nil)
-(make-variable-buffer-local 'company-selection-changed)
+(defvar-local company-selection-changed nil)
-(defvar company--manual-action nil
+(defvar-local company--manual-action nil
"Non-nil, if manual completion took place.")
-(make-variable-buffer-local 'company--manual-action)
-(defvar company--manual-prefix nil)
-(make-variable-buffer-local 'company--manual-prefix)
+(defvar-local company--manual-prefix nil)
(defvar company--auto-completion nil
"Non-nil when current candidate is being inserted automatically.
Controlled by `company-auto-complete'.")
-(defvar company--point-max nil)
-(make-variable-buffer-local 'company--point-max)
+(defvar-local company--point-max nil)
-(defvar company-point nil)
-(make-variable-buffer-local 'company-point)
+(defvar-local company-point nil)
(defvar company-timer nil)
-(defvar company-added-newline nil)
-(make-variable-buffer-local 'company-added-newline)
+(defvar-local company-added-newline nil)
(defsubst company-strip-prefix (str)
(substring str (length company-prefix)))
@@ -1490,17 +1487,13 @@ Keywords and function definition names are ignored."
;;; search
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar company-search-string nil)
-(make-variable-buffer-local 'company-search-string)
+(defvar-local company-search-string nil)
-(defvar company-search-lighter " Search: \"\"")
-(make-variable-buffer-local 'company-search-lighter)
+(defvar-local company-search-lighter " Search: \"\"")
-(defvar company-search-old-map nil)
-(make-variable-buffer-local 'company-search-old-map)
+(defvar-local company-search-old-map nil)
-(defvar company-search-old-selection 0)
-(make-variable-buffer-local 'company-search-old-selection)
+(defvar-local company-search-old-selection 0)
(defun company-search (text lines)
(let ((quoted (regexp-quote text))
@@ -1841,8 +1834,7 @@ To show the number next to the candidates in some
back-ends, enable
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar company-last-metadata nil)
-(make-variable-buffer-local 'company-last-metadata)
+(defvar-local company-last-metadata nil)
(defun company-fetch-metadata ()
(let ((selected (nth company-selection company-candidates)))
@@ -1917,8 +1909,7 @@ To show the number next to the candidates in some
back-ends, enable
;;; package functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar company-callback nil)
-(make-variable-buffer-local 'company-callback)
+(defvar-local company-callback nil)
(defun company-remove-callback (&optional ignored)
(remove-hook 'company-completion-finished-hook company-callback t)
@@ -1979,11 +1970,9 @@ If SHOW-VERSION is non-nil, show the version in the echo
area."
;;; pseudo-tooltip
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar company-pseudo-tooltip-overlay nil)
-(make-variable-buffer-local 'company-pseudo-tooltip-overlay)
+(defvar-local company-pseudo-tooltip-overlay nil)
-(defvar company-tooltip-offset 0)
-(make-variable-buffer-local 'company-tooltip-offset)
+(defvar-local company-tooltip-offset 0)
(defun company-tooltip--lines-update-offset (selection num-lines limit)
(cl-decf limit 2)
@@ -2414,8 +2403,7 @@ Returns a negative number if the tooltip should be
displayed above point."
;;; overlay
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar company-preview-overlay nil)
-(make-variable-buffer-local 'company-preview-overlay)
+(defvar-local company-preview-overlay nil)
(defun company-preview-show-at-point (pos)
(company-preview-hide)
@@ -2472,8 +2460,7 @@ Returns a negative number if the tooltip should be
displayed above point."
;;; echo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar company-echo-last-msg nil)
-(make-variable-buffer-local 'company-echo-last-msg)
+(defvar-local company-echo-last-msg nil)
(defvar company-echo-timer nil)
- [elpa] 21/52: Merge pull request #126 from ksjogo/gtags, (continued)
- [elpa] 21/52: Merge pull request #126 from ksjogo/gtags, Dmitry Gutov, 2014/07/01
- [elpa] 19/52: fixing let in gtags annotation, Dmitry Gutov, 2014/07/01
- [elpa] 20/52: Add new possible value to `company-dabbrev-code-other-buffers', Dmitry Gutov, 2014/07/01
- [elpa] 03/52: company-clang: don't mistake scoping operator for objc args, Dmitry Gutov, 2014/07/01
- [elpa] 24/52: Merge pull request #127 from bbatsov/doc-fixes, Dmitry Gutov, 2014/07/01
- [elpa] 23/52: Small fixes, Dmitry Gutov, 2014/07/01
- [elpa] 25/52: Some indentation fixes, Dmitry Gutov, 2014/07/01
- [elpa] 27/52: Merge pull request #128 from bbatsov/defvar-local, Dmitry Gutov, 2014/07/01
- [elpa] 30/52: Merge pull request #129 from bbatsov/c-h, Dmitry Gutov, 2014/07/01
- [elpa] 22/52: Update NEWS, Dmitry Gutov, 2014/07/01
- [elpa] 26/52: Backport defvar-local from Emacs 24.2,
Dmitry Gutov <=
- [elpa] 28/52: Add package-version property to vars after in 0.7.0, Dmitry Gutov, 2014/07/01
- [elpa] 29/52: Bind company-show-doc-buffer to C-h, Dmitry Gutov, 2014/07/01
- [elpa] 31/52: company-css-value-classes: fix border-width infloop, Dmitry Gutov, 2014/07/01
- [elpa] 32/52: company-css-property-values: port to lexical-binding, Dmitry Gutov, 2014/07/01
- [elpa] 33/52: company-css: add a bunch of CSS3 properties, Dmitry Gutov, 2014/07/01
- [elpa] 36/52: company-css-property-alist: remove reference to font-variant in value for font, Dmitry Gutov, 2014/07/01
- [elpa] 34/52: company-gtags: add arguments insertion, Dmitry Gutov, 2014/07/01
- [elpa] 38/52: Indicate current candidate's backend when it's in a group, Dmitry Gutov, 2014/07/01
- [elpa] 39/52: company-update-group-lighter: privatize, Dmitry Gutov, 2014/07/01
- [elpa] 41/52: Improve comment wording, Dmitry Gutov, 2014/07/01