Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interfere with elisp mode #51

Closed
twlz0ne opened this issue May 3, 2017 · 1 comment
Closed

Interfere with elisp mode #51

twlz0ne opened this issue May 3, 2017 · 1 comment

Comments

@twlz0ne
Copy link

twlz0ne commented May 3, 2017

Steps to reproduce

  1. Open a .php file
  2. Switch to *scratch*
  3. Type glo

Expect

1 expect

Actual

3 actual

Environment

  • macOS 10.11.6
  • emacs 25.2 ~ 26.0

Configuration

;;; Usage: /path/to/emacs -nw -Q -l /path/to/test-ac-php.el

(toggle-debug-on-error)

(global-set-key (kbd "C-h") 'delete-backward-char)
(global-set-key (kbd "M-h") 'backward-kill-word)
(global-set-key (kbd "<f1>") 'help-command)
(define-key isearch-mode-map "\C-h" 'isearch-delete-char)

(setq package-user-dir (format "%s/elpa--test-ac-php" user-emacs-directory))
(setq package-archives
      '(("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")))
      ;; '(("melpa" . "https://melpa.org/packages/")))

(package-initialize)

(defmacro try-install (pkg)
  `(unless (package-installed-p ,pkg)
     (package-refresh-contents)
     (package-install ,pkg)))

(try-install 'ac-php)
(try-install 'company)
(try-install 'company-php)

(require 'cl)
(require 'php-mode)

(add-hook 'php-mode-hook
          '(lambda ()
             (require 'company-php)
             (company-mode t)
             (ac-php-core-eldoc-setup ) ;; enable eldoc
             (add-to-list 'company-backends 'company-ac-php-backend)))

(setq auto-mode-alist
      (append
       '(("\\.php" . php-mode)) auto-mode-alist))

(add-hook 'after-init-hook 'global-company-mode)
(run-hooks 'after-init-hook)

;;; test-ac-php.el ends here
@xcwen
Copy link
Owner

xcwen commented May 3, 2017

great for test code !!
make company-backends as local var

  (add-to-list 'company-backends 'company-ac-php-backend) => 

  (make-local-variable 'company-backends)
  (add-to-list 'company-backends 'company-ac-php-backend)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants