-
-;; we patch these explicitly so they byte compile and so we don't have to
-;; patch the faster underlying function.
-
-(defun cmpl-beginning-of-line (&optional n)
- "Move point to beginning of current line.\n\
-With argument ARG not nil or 1, move forward ARG - 1 lines first.\n\
-If scan reaches end of buffer, stop there without error."
- (interactive "p")
- (use-completion-under-or-before-point)
- (beginning-of-line n)
- )
-
-(defun cmpl-end-of-line (&optional n)
- "Move point to end of current line.\n\
-With argument ARG not nil or 1, move forward ARG - 1 lines first.\n\
-If scan reaches end of buffer, stop there without error."
- (interactive "p")
- (use-completion-under-or-before-point)
- (end-of-line n)
- )
-
-(defun cmpl-forward-char (n)
- "Move point right ARG characters (left if ARG negative).\n\
-On reaching end of buffer, stop and signal error."
- (interactive "p")
- (use-completion-under-or-before-point)
- (forward-char n)
- )
-(defun cmpl-backward-char (n)
- "Move point left ARG characters (right if ARG negative).\n\
-On attempt to pass beginning or end of buffer, stop and signal error."
- (interactive "p")
- (use-completion-under-point)
- (if (eq last-command 'complete)
- ;; probably a failed completion if you have to back up
- (cmpl-statistics-block (record-complete-failed)))
- (backward-char n)
- )
-
-(defun cmpl-forward-word (n)
- "Move point forward ARG words (backward if ARG is negative).\n\
-Normally returns t.\n\
-If an edge of the buffer is reached, point is left there\n\
-and nil is returned."
- (interactive "p")
- (use-completion-under-or-before-point)
- (forward-word n)
- )
-(defun cmpl-backward-word (n)
- "Move backward until encountering the end of a word.
-With argument, do this that many times.
-In programs, it is faster to call forward-word with negative arg."
- (interactive "p")
- (use-completion-under-point)
- (if (eq last-command 'complete)
- ;; probably a failed completion if you have to back up
- (cmpl-statistics-block (record-complete-failed)))
- (forward-word (- n))
- )
-
-(defun cmpl-forward-sexp (n)
- "Move forward across one balanced expression.
-With argument, do this that many times."
- (interactive "p")
- (use-completion-under-or-before-point)
- (forward-sexp n)
- )
-(defun cmpl-backward-sexp (n)
- "Move backward across one balanced expression.
-With argument, do this that many times."
- (interactive "p")
- (use-completion-under-point)
- (if (eq last-command 'complete)
- ;; probably a failed completion if you have to back up
- (cmpl-statistics-block (record-complete-failed)))
- (backward-sexp n)
- )
-
-(defun cmpl-delete-backward-char (n killflag)
- "Delete the previous ARG characters (following, with negative ARG).\n\
-Optional second arg KILLFLAG non-nil means kill instead (save in kill ring).\n\
-Interactively, ARG is the prefix arg, and KILLFLAG is set if\n\
-ARG was explicitly specified."
- (interactive "p\nP")
- (if (eq last-command 'complete)
- ;; probably a failed completion if you have to back up
- (cmpl-statistics-block (record-complete-failed)))
- (delete-backward-char n killflag)
- )
-
-(defvar $$$cmpl-old-backward-delete-char-untabify
- (symbol-function 'backward-delete-char-untabify))
-
-(defun backward-delete-char-untabify (arg &optional killp)
- "Delete characters backward, changing tabs into spaces.
-Delete ARG chars, and kill (save in kill ring) if KILLP is non-nil.
-Interactively, ARG is the prefix arg (default 1)
-and KILLP is t if prefix arg is was specified."
- (interactive "*p\nP")
- (if (eq last-command 'complete)
- ;; probably a failed completion if you have to back up
- (cmpl-statistics-block (record-complete-failed)))
- (funcall $$$cmpl-old-backward-delete-char-untabify arg killp)
- )
-
-
-(global-set-key "\C-?" 'cmpl-delete-backward-char)
-(global-set-key "\M-\C-F" 'cmpl-forward-sexp)
-(global-set-key "\M-\C-B" 'cmpl-backward-sexp)
-(global-set-key "\M-F" 'cmpl-forward-word)
-(global-set-key "\M-B" 'cmpl-backward-word)
-(global-set-key "\C-F" 'cmpl-forward-char)
-(global-set-key "\C-B" 'cmpl-backward-char)
-(global-set-key "\C-A" 'cmpl-beginning-of-line)
-(global-set-key "\C-E" 'cmpl-end-of-line)
-
-;;;-----------------------------------------------
-;;; Misc.
-;;;-----------------------------------------------
-
-(def-completion-wrapper electric-buffer-list :under-or-before)
-(def-completion-wrapper list-buffers :under-or-before)
-(def-completion-wrapper scroll-up :under-or-before)
-(def-completion-wrapper scroll-down :under-or-before)
-(def-completion-wrapper execute-extended-command
- :under-or-before)
-(def-completion-wrapper other-window :under-or-before)
-
-;;;-----------------------------------------------
-;;; Local Thinking Machines stuff
-;;;-----------------------------------------------
-
-(if (fboundp 'up-ten-lines)
- (def-completion-wrapper up-ten-lines :under-or-before))
-(if (fboundp 'down-ten-lines)
- (def-completion-wrapper down-ten-lines :under-or-before))
-(if (fboundp 'tmc-scroll-up)
- (def-completion-wrapper tmc-scroll-up :under-or-before))
-(if (fboundp 'tmc-scroll-down)
- (def-completion-wrapper tmc-scroll-down :under-or-before))
-(if (fboundp 'execute-extended-command-and-check-for-bindings)
- (def-completion-wrapper execute-extended-command-and-check-for-bindings
- :under-or-before))
-
-;;; Tests --
-;;; foobarbiz
-;;; foobar
-;;; fooquux
-;;; fooper