;;; completion.el --- dynamic word-completion code
-;; Copyright (C) 1990, 1993, 1995, 1997, 2001-2015 Free Software
+;; Copyright (C) 1990, 1993, 1995, 1997, 2001-2016 Free Software
;; Foundation, Inc.
;; Maintainer: emacs-devel@gnu.org
;; Remove chars to ignore at the start.
(cond ((= (char-syntax (char-after cmpl-symbol-start)) ?w)
(goto-char cmpl-symbol-start)
- (forward-word 1)
+ (forward-word-strictly 1)
(setq cmpl-symbol-start (point))
(goto-char saved-point)))
;; Remove chars to ignore at the end.
(cond ((= (char-syntax (char-after (1- cmpl-symbol-end))) ?w)
(goto-char cmpl-symbol-end)
- (forward-word -1)
+ (forward-word-strictly -1)
(setq cmpl-symbol-end (point))
(goto-char saved-point)))
;; Return completion if the length is reasonable.
;; Remove chars to ignore at the start.
(cond ((= (char-syntax (char-after cmpl-symbol-start)) ?w)
(goto-char cmpl-symbol-start)
- (forward-word 1)
+ (forward-word-strictly 1)
(setq cmpl-symbol-start (point))
(goto-char cmpl-symbol-end)))
;; Return value if long enough.
(let ((saved-point (point)))
(setq cmpl-symbol-start (scan-sexps saved-point -1))
;; take off chars. from end
- (forward-word -1)
+ (forward-word-strictly -1)
(setq cmpl-symbol-end (point))
;; remove chars to ignore at the start
(cond ((= (char-syntax (char-after cmpl-symbol-start)) ?w)
(goto-char cmpl-symbol-start)
- (forward-word 1)
+ (forward-word-strictly 1)
(setq cmpl-symbol-start (point))))
;; Restore state.
(goto-char saved-point)
;; Remove chars to ignore at the start.
(cond ((= (char-syntax (char-after cmpl-symbol-start)) ?w)
(goto-char cmpl-symbol-start)
- (forward-word 1)
+ (forward-word-strictly 1)
(setq cmpl-symbol-start (point))
(goto-char cmpl-symbol-end)))
;; Return completion if the length is reasonable.
;; symbol char to ignore at end. Are we at end ?
(progn
(setq saved-point-2 (point))
- (forward-word -1)
+ (forward-word-strictly -1)
(prog1
(= (char-syntax (preceding-char)) ? )
(goto-char saved-point-2)))))
(cond ((looking-at "\\(define\\|ifdef\\)\\>")
;; skip forward over definition symbol
;; and add it to database
- (and (forward-word 2)
+ (and (forward-word-strictly 2)
(setq string (symbol-before-point))
;;(push string foo)
(add-completion-to-tail-if-new string)))))
;; move to next separator char.
(goto-char
(setq next-point (scan-sexps (point) 1))))
- (forward-word -1)
+ (forward-word-strictly -1)
;; add to database
(if (setq string (symbol-under-point))
;; (push string foo)
;; Local TMC hack (useful for parsing paris.h)
(if (and (looking-at "_AP") ;; "ansi prototype"
(progn
- (forward-word -1)
+ (forward-word-strictly -1)
(setq string
(symbol-under-point))))
(add-completion-to-tail-if-new string)))
(defun completion-lisp-mode-hook ()
(setq completion-syntax-table completion-lisp-syntax-table)
;; Lisp Mode diffs
- (local-set-key "!" 'self-insert-command)
- (local-set-key "&" 'self-insert-command)
- (local-set-key "%" 'self-insert-command)
- (local-set-key "?" 'self-insert-command)
- (local-set-key "=" 'self-insert-command)
- (local-set-key "^" 'self-insert-command))
+ (setq-local completion-separator-chars
+ (cl-set-difference completion-separator-chars
+ (append "!&%?=^" nil))))
;; C mode diffs.