* Fixed more bugs, probably more hiding in 3300+ lines

This commit is contained in:
capitaomorte 2009-08-13 01:46:52 +00:00
parent 8420238a19
commit ceabe9376e

View File

@ -549,28 +549,28 @@ Here's an example:
["System X-widget" (setq yas/prompt-functions
(cons 'yas/x-prompt
(remove 'yas/x-prompt
(yas/prompt-functions))))
yas/prompt-functions)))
:help "Use your windowing system's (gtk, mac, windows, etc...) default menu"
:active t :style radio :selected (eq (car yas/prompt-functions)
'yas/x-prompt)]
["Dropdown-list" (setq yas/prompt-functions
(cons 'yas/dropdown-prompt
(remove 'yas/dropdown-prompt
(yas/prompt-functions))))
yas/prompt-functions)))
:help "Use a special dropdown list"
:active t :style radio :selected (eq (car yas/prompt-functions)
'yas/dropdown-prompt)]
["Ido" (setq yas/prompt-functions
(cons 'yas/ido-prompt
(remove 'yas/ido-prompt
(yas/prompt-functions))))
yas/prompt-functions)))
:help "Use an ido-style minibuffer prompt"
:active t :style radio :selected (eq (car yas/prompt-functions)
'yas/ido-prompt)]
["Completing read" (setq yas/prompt-functions
(cons 'yas/completing-prompt
(remove 'yas/completing-prompt-prompt
(yas/prompt-functions))))
yas/prompt-functions)))
:help "Use a normal minibuffer prompt"
:active t :style radio :selected (eq (car yas/prompt-functions)
'yas/completing-prompt-prompt)]
@ -1176,7 +1176,8 @@ TEMPLATES is a list of `yas/template'."
;;
(defun yas/load-directory-1 (directory &optional parents no-hierarchy-parents making-groups-sym)
"Recursively load snippet templates from DIRECTORY."
;; TODO: Rewrite this horrible, horrible monster I created
(unless (file-exists-p (concat directory "/" ".yas-skip"))
(let* ((major-mode-and-parents (unless making-groups-sym
(yas/compute-major-mode-and-parents (concat directory "/dummy")
nil
@ -1203,7 +1204,7 @@ TEMPLATES is a list of `yas/template'."
(if make-groups-p
(yas/load-directory-1 subdir parents 't (or mode-sym
making-groups-sym))
(yas/load-directory-1 subdir (list mode-sym))))))
(yas/load-directory-1 subdir (list mode-sym)))))))
(defun yas/load-directory (directory)
"Load snippet definition from a directory hierarchy.
@ -1493,14 +1494,14 @@ its parent modes."
;; a key and a name for the snippet, because that is what
;; indexes the snippet tables
;;
(when (and key
name)
(setq template (yas/make-template (second snippet)
(or name key)
condition
(sixth snippet)
(seventh snippet)
keybinding))
(when (and key
name)
(yas/snippet-table-store snippet-table
name
key
@ -1544,9 +1545,9 @@ its parent modes."
(define-key group-keymap (vector (gensym))
`(menu-item ,(yas/template-name template)
,(yas/make-menu-binding template)
:help name
:keys (when (and key name)
,(concat key yas/trigger-symbol))))))))))
:help ,name
:keys ,(when (and key name)
(concat key yas/trigger-symbol))))))))))
(defun yas/show-menu-p (mode)
(message "what")
@ -3290,8 +3291,9 @@ When multiple expressions are found, only the last one counts."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; `locate-dominating-file' is added for compatibility in emacs < 23
(unless (eq emacs-major-version 23)
(eval-when-compile
(unless (or (eq emacs-major-version 23)
(fboundp 'locate-dominating-file))
(defvar locate-dominating-stop-dir-regexp
"\\`\\(?:[\\/][\\/][^\\/]+[\\/]\\|/\\(?:net\\|afs\\|\\.\\.\\.\\)/\\)\\'"
"Regexp of directory names which stop the search in `locate-dominating-file'.
@ -3302,36 +3304,6 @@ The default regexp prevents fruitless and time-consuming attempts to find
special files in directories in which filenames are interpreted as hostnames,
or mount points potentially requiring authentication as a different user.")
;; (defun locate-dominating-files (file regexp)
;; "Look up the directory hierarchy from FILE for a file matching REGEXP.
;; Stop at the first parent where a matching file is found and return the list
;; of files that that match in this directory."
;; (catch 'found
;; ;; `user' is not initialized yet because `file' may not exist, so we may
;; ;; have to walk up part of the hierarchy before we find the "initial UID".
;; (let ((user nil)
;; ;; Abbreviate, so as to stop when we cross ~/.
;; (dir (abbreviate-file-name (file-name-as-directory file)))
;; files)
;; (while (and dir
;; ;; As a heuristic, we stop looking up the hierarchy of
;; ;; directories as soon as we find a directory belonging to
;; ;; another user. This should save us from looking in
;; ;; things like /net and /afs. This assumes that all the
;; ;; files inside a project belong to the same user.
;; (let ((prev-user user))
;; (setq user (nth 2 (file-attributes dir)))
;; (or (null prev-user) (equal user prev-user))))
;; (if (setq files (condition-case nil
;; (directory-files dir 'full regexp 'nosort)
;; (error nil)))
;; (throw 'found files)
;; (if (equal dir
;; (setq dir (file-name-directory
;; (directory-file-name dir))))
;; (setq dir nil))))
;; nil)))
(defun locate-dominating-file (file name)
"Look up the directory hierarchy from FILE for a file named NAME.
Stop at the first parent directory containing a file NAME,
@ -3369,7 +3341,7 @@ and return the directory. Return nil if not found."
file (file-name-directory
(directory-file-name file))))
(setq file nil))))
root)))
root))))
(provide 'yasnippet)