소스 검색

Add my-company-length-popup-tip

master
10sr 5 년 전
부모
커밋
5fb5589d09
로그인 계정: 10sr GPG 키 ID: 7BEC428194130EB2
1개의 변경된 파일24개의 추가작업 그리고 2개의 파일을 삭제
  1. +24
    -2
      emacs.el

+ 24
- 2
emacs.el 파일 보기

@@ -1042,7 +1042,8 @@ found, otherwise returns nil."
(set-variable 'company-selection-wrap-around t)

(defvar company-mode-map)
;; TODO: It seems this indent is a bit different from original C-i command
;; TODO: It seems sometimes this indent is a bit different from original C-i command
;; For example python-mode?
(define-key company-mode-map (kbd "C-i") 'company-indent-or-complete-common)
;; (define-key ctl-x-map (kbd "C-i") 'company-complete) ; Originally `indent-rigidly'

@@ -1053,6 +1054,28 @@ found, otherwise returns nil."
(define-key company-active-map (kbd "C-i") 'company-complete-selection)
(define-key company-active-map (kbd "C-f") 'company-complete-selection)

(defvar company-candidates)
(defvar company-candidates-length)
;; (popup-tip "Hello, World!")
(require 'popup nil t)
(defun my-company-length-popup-tip ()
"Show tooltip of candidate length."
(interactive)
;; Do nothing when already in company completion
(unless company-candidates
(let ((l nil))
(unwind-protect
(progn
(company-manual-begin)
(setq l company-candidates-length))
(company-cancel))
(when l
(popup-tip (format "(%d)" l))))))

(set-variable 'my-company-length-popup-tip-timer
(run-with-idle-timer 0.5 t
'my-company-length-popup-tip))

;; https://qiita.com/syohex/items/8d21d7422f14e9b53b17
(set-face-attribute 'company-tooltip nil
:foreground "black" :background "lightgrey")
@@ -1071,7 +1094,6 @@ found, otherwise returns nil."

)


;; https://github.com/lunaryorn/flycheck
(when (safe-require-or-eval 'flycheck)
(call-after-init (global-flycheck-mode)))


불러오는 중...
취소
저장