• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/

Lines Matching +defs:before +defs:string

38 ;;  (also check the documentation string of the functions)
71 ;; A "word" is any string containing characters with either word or symbol
72 ;; syntax. [E.G. Any alphanumeric string with hyphens, underscores, etc.]
138 ;; Completion is string case independent if case-fold-search has its
159 ;; add-completion string &optional num-uses
160 ;; Adds a new string to the database
162 ;; add-permanent-completion string
163 ;; Adds a new string to the database with num-uses = T
166 ;; kill-completion string
176 ;; next-completion string &optional index
177 ;; Returns a completion entry that starts with string.
179 ;; find-exact-completion string
180 ;; Returns a completion entry that exactly matches string.
196 ;; get-completion-list string
199 ;; make-completion string num-uses
201 ;; completion-string completion
203 ;; set-completion-string completion string
362 ;; "*The period in seconds to wait for emacs to be idle before autosaving
374 "The minimum length of a completion search string.
391 (defvar completion-string)
402 (defun cmpl-string-case-type (string)
405 (cond ((string-match "[[:lower:]]" string)
406 (cond ((string-match "[[:upper:]]" string)
407 (cond ((and (> (length string) 1)
408 (null (string-match "[[:upper:]]" string 1)))
414 (cond ((string-match "[[:upper:]]" string)
419 ;; (cmpl-string-case-type "123ABCDEF456") --> :up
420 ;; (cmpl-string-case-type "123abcdef456") --> :down
421 ;; (cmpl-string-case-type "123aBcDeF456") --> :mixed
422 ;; (cmpl-string-case-type "123456") --> :neither
423 ;; (cmpl-string-case-type "Abcde123") --> :capitalized
425 (defun cmpl-coerce-string-case (string case-type)
426 (cond ((eq case-type :down) (downcase string))
427 ((eq case-type :up) (upcase string))
429 (setq string (downcase string))
430 (aset string 0 (logand ?\337 (aref string 0)))
431 string)
432 (t string)))
434 (defun cmpl-merge-string-cases (string-to-coerce given-string)
435 (let ((string-case-type (cmpl-string-case-type string-to-coerce)))
436 (cond ((memq string-case-type '(:down :up :capitalized))
437 ;; Found string is in a standard case. Coerce to a type based on
438 ;; the given string
439 (cmpl-coerce-string-case string-to-coerce
440 (cmpl-string-case-type given-string)))
442 ;; If the found string is in some unusual case, just insert it
444 string-to-coerce))))
447 ;; (cmpl-merge-string-cases "AbCdEf456" "abc") --> AbCdEf456
448 ;; (cmpl-merge-string-cases "abcdef456" "ABC") --> ABCDEF456
449 ;; (cmpl-merge-string-cases "ABCDEF456" "Abc") --> Abcdef456
450 ;; (cmpl-merge-string-cases "ABCDEF456" "abc") --> abcdef456
462 ;; The functions symbol-before-point, symbol-under-point, etc. quickly return
463 ;; an appropriate symbol string. The strategy is to temporarily change
592 (defun symbol-before-point ()
593 "Return a string of the symbol immediately before point.
633 ;; tests for symbol-before-point
647 (defun symbol-under-or-before-point ()
650 ;; However, it is only used by the completion string prompter.
656 (symbol-before-point)))
659 (defun symbol-before-point-for-complete ()
660 ;; "Returns a string of the symbol immediately before point
661 ;; or nil if there isn't one. Like symbol-before-point but doesn't trim the
682 ;; tests for symbol-before-point-for-complete
760 (defvar cdabbrev-abbrev-string "")
773 (defun reset-cdabbrev (abbrev-string &optional initial-completions-tried)
777 (setq cdabbrev-abbrev-string abbrev-string
779 (cons (downcase abbrev-string) initial-completions-tried))
790 "Reset the cdabbrev search to search for abbrev-string."
840 (;; search for the string
841 (search-backward cdabbrev-abbrev-string cdabbrev-stop-point t)
857 ;; have we not tried this one before
863 (not (string-equal downcase-expansion
941 ;; A completion entry is a LIST of string, prefix-symbol num-uses, and
943 ;; last-use-time is t if the string should be kept permanently
951 (defmacro completion-string (completion-entry)
968 (defmacro set-completion-string (completion-entry string)
969 (list 'setcar completion-entry string))
978 (defun make-completion (string)
980 (list string 0 nil current-completion-source))
1062 "Set to a string that is pending its acceptance.")
1065 (defvar cmpl-db-downcase-string nil
1066 "Setup by `find-exact-completion', etc. The given string, downcased.")
1068 "The interned symbol corresponding to `cmpl-db-downcase-string'.
1071 "The interned prefix symbol corresponding to `cmpl-db-downcase-string'.")
1077 (defun find-exact-completion (string)
1079 Sets up `cmpl-db-downcase-string' and `cmpl-db-symbol'."
1081 (intern (setq cmpl-db-downcase-string (downcase string))
1085 (defun find-cmpl-prefix-entry (prefix-string)
1086 "Return the prefix entry for string.
1088 Prefix-string must be exactly `completion-prefix-min-length' long
1091 (intern prefix-string cmpl-prefix-obarray)))
1099 Returns a pointer to the element before the completion entry or nil if
1117 completion-string))
1129 (add-completion (completion-string old-entry)
1132 (let* ((cmpl-entry (find-exact-completion (completion-string old-entry)))
1136 (substring cmpl-db-downcase-string
1149 (defun add-completion-to-tail-if-new (string)
1156 (or (find-exact-completion string)
1159 (entry (list (make-completion string)))
1162 (substring cmpl-db-downcase-string 0
1179 (defun add-completion-to-head (completion-string)
1184 Updates the saved string with the supplied string.
1190 (if (setq cmpl-db-entry (find-exact-completion completion-string))
1193 (substring cmpl-db-downcase-string 0
1198 (set-completion-string cmpl-db-entry completion-string)
1213 (entry (list (make-completion completion-string)))
1216 (substring cmpl-db-downcase-string 0
1231 (defun delete-completion (completion-string)
1236 (if (setq cmpl-db-entry (find-exact-completion completion-string))
1239 (substring cmpl-db-downcase-string 0
1258 (error "Unknown completion `%s'" completion-string)))
1309 (defun interactive-completion-string-reader (prompt)
1310 (let* ((default (symbol-under-or-before-point))
1319 (defun check-completion-length (string)
1320 (if (< (length string) completion-min-length)
1321 (error "The string `%s' is too short to be saved as a completion"
1322 string)
1323 (list string)))
1325 (defun add-completion (string &optional num-uses last-use-time)
1329 (interactive (interactive-completion-string-reader "Completion to add"))
1330 (check-completion-length string)
1334 (entry (add-completion-to-head string)))
1340 (defun add-permanent-completion (string)
1343 (interactive-completion-string-reader "Completion to add permanently"))
1347 (add-completion string nil t)))
1349 (defun kill-completion (string)
1350 (interactive (interactive-completion-string-reader "Completion to kill"))
1351 (check-completion-length string)
1352 (delete-completion string))
1358 (let ((string completion-to-accept)
1363 (setq entry (add-completion-to-head string))
1369 (let ((string (and enable-completion (symbol-under-point)))
1371 (if string (add-completion-to-head string))))
1373 (defun use-completion-before-point ()
1374 "Add the completion symbol before point into the completion buffer."
1375 (let ((string (and enable-completion (symbol-before-point)))
1377 (if string (add-completion-to-head string))))
1379 (defun use-completion-under-or-before-point ()
1380 "Add the completion symbol before point into the completion buffer."
1381 (let ((string (and enable-completion (symbol-under-or-before-point)))
1383 (if string (add-completion-to-head string))))
1385 (defun use-completion-before-separator ()
1386 "Add the completion symbol before point into the completion buffer.
1389 (let ((string (and enable-completion (symbol-before-point)))
1393 (note-separator-character string))
1394 (cond (string
1395 (setq entry (add-completion-to-head string))
1436 (defvar cmpl-test-string "")
1437 ;; "The current string used by completion-search-next."
1440 ;; (derived from cmpl-test-string)"
1456 (defun completion-search-reset (string)
1463 (downcase (substring string 0 completion-prefix-min-length))))
1464 cmpl-test-string string
1465 cmpl-test-regexp (concat (regexp-quote string) "."))
1478 If there are no more entries, try cdabbrev and returns only a string."
1498 ;; otherwise point to one before current
1519 string being returned. Depends on `case-fold-search'.
1520 If there are no more entries, try cdabbrev and then return only a string."
1528 (and (not (eq 0 (string-match cmpl-test-regexp
1529 (completion-string (car cmpl-next-possibilities)))))
1534 cmpl-tried-list (cons (downcase (completion-string cmpl-next-possibility))
1541 (reset-cdabbrev cmpl-test-string cmpl-tried-list)
1600 (defvar cmpl-original-string nil)
1605 "Fill out a completion of the word before point.
1628 ;; get string
1629 (setq cmpl-original-string (symbol-before-point-for-complete))
1630 (cond ((not cmpl-original-string)
1638 (note-complete-entered-afresh cmpl-original-string))
1640 (completion-search-reset cmpl-original-string)
1651 string)
1652 ;; entry is either a completion entry or a string (if cdabbrev)
1657 (setq string (if (stringp entry)
1658 entry (completion-string entry)))
1659 (setq string (cmpl-merge-string-cases
1660 string cmpl-original-string))
1662 (insert string)
1664 (setq completion-to-accept string)
1684 (setq string (if (stringp entry)
1685 entry (completion-string entry)))
1686 (setq string (cmpl-merge-string-cases
1687 string cmpl-original-string))
1688 (message "Next completion: %s" string))))
1690 (insert cmpl-original-string)
1773 (let (string)
1778 (and (setq string (symbol-under-point))
1779 (add-completion-to-tail-if-new string))
1799 ;; (and (string-match *lisp-def-regexp* "\n(defun foo") (match-end 0)) -> 8
1800 ;; (and (string-match *lisp-def-regexp* "\n(si:def foo") (match-end 0)) -> 9
1801 ;; (and (string-match *lisp-def-regexp* "\n(def-bar foo")(match-end 0)) -> 10
1802 ;; (and (string-match *lisp-def-regexp* "\n(defun (foo") (match-end 0)) -> 9
1809 (let (string)
1815 (and (setq string (symbol-under-point))
1816 (add-completion-to-tail-if-new string)))
1865 ;; This stops before the symbol to add. {Test cases in parens. below}
1879 ;(defun test-c-def-regexp (regexp string)
1880 ; (and (eq 0 (string-match regexp string)) (match-end 0))
1902 (let (string next-point char)
1920 (setq string (symbol-before-point))
1921 ;;(push string foo)
1922 (add-completion-to-tail-if-new string)))))
1939 (if (setq string (symbol-under-point))
1940 ;; (push string foo)
1941 (add-completion-to-tail-if-new string)
1946 (setq string
1948 (add-completion-to-tail-if-new string)))
1997 ;; Format is (<string> . <last-use-time>)
1998 ;; <string> is the completion
2055 ;; or it was saved before and
2064 (insert (prin1-to-string (cons (completion-string completion)
2126 string entry last-use-time
2152 (stringp (setq string (car entry)))
2166 (add-completion-to-tail-if-new string))))
2178 (prin1-to-string entry))
2227 (insert cmpl-original-string)
2246 ;; If the character before this was an alpha-numeric then this adds the
2247 ;; symbol before point to the completion list (using ADD-COMPLETION).
2251 (use-completion-before-separator)
2256 (use-completion-before-separator)
2269 "Add a call to update the completion database before function execution.
2270 TYPE is the type of the wrapper to be added. Can be :before or :under."
2273 '((:separator . use-completion-before-separator)
2274 (:before . use-completion-before-point)
2278 (:under-or-before . use-completion-under-or-before-point)
2284 (use-completion-before-separator)))
2297 (defun completion-before-command ()
2300 'use-completion-under-or-before-point)))
2369 (pre-command-hook . completion-before-command)
2470 (completion-def-wrapper 'next-line :under-or-before)
2471 (completion-def-wrapper 'previous-line :under-or-before)
2472 (completion-def-wrapper 'beginning-of-buffer :under-or-before)
2473 (completion-def-wrapper 'end-of-buffer :under-or-before)
2474 (completion-def-wrapper 'beginning-of-line :under-or-before)
2475 (completion-def-wrapper 'end-of-line :under-or-before)
2476 (completion-def-wrapper 'forward-char :under-or-before)
2477 (completion-def-wrapper 'forward-word :under-or-before)
2478 (completion-def-wrapper 'forward-sexp :under-or-before)
2491 "^The string \".*\" is too short to be saved as a completion\\.$"))