• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/emulation/

Lines Matching +defs:find +defs:file +defs:other +defs:window

8 ;; This file is part of GNU Emacs.
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
32 (defvar read-file-name-map)
40 (defvar viper-custom-file-name)
42 (defvar explicit-shell-file-name)
49 (let ((load-path (cons (expand-file-name ".") load-path)))
99 ("Buffer" (if ex-cycle-other-window
101 (viper-switch-to-buffer-other-window)))
102 ("Next" (ex-next (not ex-cycle-other-window)))
110 ("buffer" (if ex-cycle-other-window
111 (viper-switch-to-buffer-other-window)
122 ("file" (ex-set-visited-file-name))
136 ("next" (ex-next ex-cycle-other-window))
190 ;; No code should touch anything in the alist entry! (other than the name,
300 (and (stringp shell-file-name)
314 shell-file-name)))
322 (cond ((string-match "\\(csh$\\|csh.exe$\\)" shell-file-name)
324 ((string-match "\\(bash$\\|bash.exe$\\)" shell-file-name)
344 "Expand the file spec containing wildcard symbols.
358 ;; file used by Ex commands like :r, :w, :n
359 (defvar ex-file nil)
375 ;; flag used in viper-ex-read-file-name to indicate that we may be reading
376 ;; multiple file names. Used for :edit and :next
379 (defcustom ex-cycle-other-window t
380 "*If t, :n and :b cycles through files and buffers in other window.
381 Then :N and :B cycles in the current window. If nil, this behavior is
387 "*Cycle through *scratch* and other buffers that don't visit any file."
417 (save-window-excursion
561 (save-window-excursion ;; put cursor at the end of the Ex working buffer
665 (save-window-excursion
687 (save-window-excursion
728 (save-window-excursion
786 (save-window-excursion
903 (save-window-excursion
929 (save-window-excursion
958 (setq cf buffer-file-name)
959 (setq pf (ex-next nil t))) ; this finds alternative file name
961 (error "No current file to substitute for `%%'"))
963 (error "No alternate file to substitute for `#'"))
983 ;; Get a file name and set `ex-variant', `ex-append' and `ex-offset' if found
985 (defun viper-get-ex-file ()
987 (setq ex-file nil
994 (save-window-excursion
1025 ;; this takes care of :r, :w, etc., when they get file names
1029 (setq ex-file (buffer-substring (point) (1- (point-max))))
1030 (setq ex-file
1032 ;; by white. For others, find the first non-white string
1037 ex-file)
1039 ;; if file name comes from history, don't leave
1043 (substring ex-file (match-end 0) nil))
1045 (substring ex-file (match-beginning 0) (match-end 0))
1049 ;; file names are gone
1061 (setq ex-file (viper-ex-read-file-name (format ":%s " prompt)))
1062 ;; file was typed in-line
1063 (setq ex-file (or ex-file "")))
1067 ;; Completes file name or exits minibuffer. If Ex command accepts multiple
1068 ;; file names, arranges to re-enter the minibuffer.
1086 (buffer-string) (viper-abbreviate-file-name default-directory))
1094 ;; Read file name from the minibuffer in an ex command.
1097 (defun viper-ex-read-file-name (prompt)
1106 read-file-name-map))
1111 val (read-file-name (concat prompt str) nil default-directory))
1112 (setq val (expand-file-name val))
1142 (if (null (get-buffer-window b))
1143 (let ((f (buffer-file-name b)))
1158 (file-count 1))
1161 (setq args (format "%s %d) %s\n" args file-count (car l))
1162 file-count (1+ file-count)))
1167 (save-window-excursion
1169 (princ "\n\nThese files are not displayed in any window.\n")
1179 (viper-get-ex-file)
1180 (if (string= ex-file "")
1181 (setq ex-file "~"))
1182 (setq default-directory (file-name-as-directory (expand-file-name ex-file))))
1255 ;; This command can take multiple file names. It replaces the current buffer
1256 ;; with the first file in its argument list
1257 (defun ex-edit (&optional file)
1258 (if (not file)
1259 (viper-get-ex-file))
1260 (cond ((and (string= ex-file "") buffer-file-name)
1261 (setq ex-file (viper-abbreviate-file-name (buffer-file-name))))
1262 ((string= ex-file "")
1266 (if buffer-file-name
1272 ((not (verify-visited-file-modtime (current-buffer)))
1275 buffer-file-name)
1287 (if (null (setq file (get-file-buffer ex-file)))
1290 (ex-find-file
1291 ;; replace # and % with the previous/current file
1292 (ex-expand-filsyms ex-file (current-buffer)))
1296 (switch-to-buffer file))
1299 (save-window-excursion
1307 (ex-fixup-history viper-last-ex-prompt ex-file))
1309 ;; Find-file FILESPEC if it appears to specify a single file.
1312 ;; Each line is assumed to be a file name.
1313 (defun ex-find-file (filespec)
1315 (cond ((file-exists-p filespec) (find-file filespec))
1317 (mapcar 'find-file (funcall viper-glob-function filespec)))
1318 (t (find-file filespec)))
1382 (save-window-excursion
1463 (save-window-excursion
1481 ;; Alternate file is the file next to the first one in the buffer ring
1482 (defun ex-next (cycle-other-window &optional find-alt-file)
1485 (if (not find-alt-file)
1487 (viper-get-ex-file)
1489 (and (not (string= "" ex-file))
1490 (not (string-match "^[0-9]+$" ex-file))))
1494 (setq count (string-to-number ex-file))
1505 (if find-alt-file (car l)
1507 (if (and (car l) (get-file-buffer (car l)))
1508 (let* ((w (if cycle-other-window
1509 (get-lru-window) (selected-window)))
1510 (b (window-buffer w)))
1511 (set-window-buffer w (get-file-buffer (car l)))
1514 (ex-fixup-history viper-last-ex-prompt ex-file))
1522 (let ((file-or-buffer-name
1525 (old-win (selected-window))
1532 (or (stringp file-or-buffer-name)
1534 "File and buffer names must be strings, %S" file-or-buffer-name))
1536 (setq buf (cond ((get-buffer file-or-buffer-name))
1537 ((file-exists-p file-or-buffer-name)
1538 (find-file-noselect file-or-buffer-name))
1542 (error "Didn't find buffer %S or file %S"
1543 file-or-buffer-name
1544 (viper-abbreviate-file-name
1545 (expand-file-name file-or-buffer-name))))
1557 (if (setq wind (viper-get-visible-buffer-window buf))
1559 (setq wind (get-lru-window (if viper-xemacs-p nil 'visible)))
1560 (set-window-buffer wind buf))
1562 (if (viper-window-display-p)
1564 (raise-frame (window-frame wind))
1565 (if (equal (window-frame wind) (window-frame old-win))
1566 (save-window-excursion (select-window wind) (sit-for 1))
1567 (select-window wind)))
1568 (save-window-excursion (select-window wind) (sit-for 1)))
1608 ;; ex-read doesn't support wildcards, because file completion is a better
1610 ;; because file history is a better mechanism.
1612 (viper-get-ex-file)
1618 (if (and (not ex-variant) (string= ex-file ""))
1620 (if (null buffer-file-name)
1622 (setq ex-file buffer-file-name)))
1626 ;; replace # and % with the previous/current file
1628 (concat (shell-quote-argument ex-file) ex-cmdfile-args)
1631 (insert-file-contents ex-file)))
1632 (ex-fixup-history viper-last-ex-prompt ex-file ex-cmdfile-args))
1640 ;; Ex recover from emacs \#file\#
1642 (viper-get-ex-file)
1645 (if (string= ex-file "")
1647 (if (null buffer-file-name)
1648 (error "This buffer isn't visiting any file"))
1649 (setq ex-file buffer-file-name))
1650 (setq ex-file (expand-file-name ex-file)))
1651 (if (and (not (string= ex-file (buffer-file-name)))
1655 (recover-file ex-file))
1789 val (format "(- (window-width) %s)" val)
1792 (setq var "explicit-shell-file-name"
1805 viper-custom-file-name)))
1807 (viper-save-string-in-file
1808 actual-lisp-cmd viper-custom-file-name
1813 (viper-save-string-in-file
1817 viper-custom-file-name
1819 (viper-save-string-in-file
1820 nil viper-custom-file-name delete-turn-on-auto-fill-pattern)
1821 (viper-save-string-in-file
1822 nil viper-custom-file-name
1884 The Info file for Viper does not seem to be installed.
1886 This file is part of the standard distribution of %sEmacs.
1891 ;; Ex source command. Loads the file specified as argument or `~/.viper'
1893 (viper-get-ex-file)
1894 (if (string= ex-file "")
1895 (load viper-custom-file-name)
1896 (load ex-file)))
1997 (save-window-excursion
2009 (find-tag ex-tag t)
2010 (find-tag-other-window ex-tag))
2017 ;; ex-write doesn't support wildcards, because file completion is a better
2019 ;; because file history is a better mechanism.
2022 (viper-get-ex-file)
2026 ;;(orig-buf-file-name (buffer-file-name))
2029 temp-buf writing-same-file region
2030 file-exists writing-whole-file)
2036 (concat ex-file ex-cmdfile-args)))
2037 (if (and (string= ex-file "") (not (buffer-file-name)))
2038 (setq ex-file
2039 (read-file-name
2040 (format "Buffer %s isn't visiting any file. File to save in: "
2043 (setq writing-whole-file (and (= (point-min) beg) (= (point-max) end))
2044 ex-file (if (string= ex-file "")
2045 (buffer-file-name)
2046 (expand-file-name ex-file)))
2047 ;; if ex-file is a directory use the file portion of the buffer file name
2048 (if (and (file-directory-p ex-file)
2049 buffer-file-name
2050 (not (file-directory-p buffer-file-name)))
2051 (setq ex-file
2052 (concat (file-name-as-directory ex-file)
2053 (file-name-nondirectory buffer-file-name))))
2055 (setq file-exists (file-exists-p ex-file)
2056 writing-same-file (string= ex-file (buffer-file-name)))
2059 (if (and writing-whole-file writing-same-file)
2060 ;; saving whole buffer in visited file
2067 (ex-write-info file-exists ex-file (point-min) (point-max))
2069 ;; writing to non-visited file and it already exists
2070 (if (and file-exists (not writing-same-file)
2072 (format "File %s exists. Overwrite? " ex-file))))
2074 ;; writing a region or whole buffer to non-visited file
2083 (set-visited-file-name ex-file) ; xemacs
2084 (set-visited-file-name ex-file 'noquerry) ; emacs
2087 (if (and file-exists ex-append)
2088 (insert-file-contents ex-file))
2096 file-exists ex-file (point-min) (point-max))
2105 ;; set the right file modification time
2106 (if (and (buffer-file-name) writing-same-file)
2107 (set-visited-file-modtime))
2108 ;; prevent loss of data if saving part of the buffer in visited file
2109 (or writing-whole-file
2110 (not writing-same-file)
2122 (defun ex-write-info (exists file-name beg end)
2124 (viper-abbreviate-file-name file-name)
2125 (if exists "" " [New file]")
2159 (save-window-excursion
2165 ;; replace # and % with the previous/current file
2189 (save-window-excursion
2214 ;; Give information on the file visited by the current buffer
2215 (defun viper-info-on-file ()
2219 lines file info)
2221 file (if (buffer-file-name)
2222 (concat (viper-abbreviate-file-name (buffer-file-name)) ":")
2223 (concat (buffer-name) " [Not visiting any file]:"))
2232 (if (< (+ 1 (length info) (length file))
2233 (window-width (minibuffer-window)))
2234 (message "%s" (concat file " " info))
2235 (save-window-excursion
2237 (princ (concat "\n" file "\n\n\t" info "\n\n")))
2244 ;; Without arguments displays info on file. With an arg, sets the visited file
2246 (defun ex-set-visited-file-name ()
2247 (viper-get-ex-file)
2248 (if (string= ex-file "")
2249 (viper-info-on-file)
2250 ;; If ex-file is a directory, use the file portion of the buffer
2251 ;; file name (like ex-write). Do this even if ex-file is a
2252 ;; non-existent directory, since set-visited-file-name signals an
2254 (if (and (string= (file-name-nondirectory ex-file) "")
2255 buffer-file-name
2256 (not (file-directory-p buffer-file-name)))
2257 (setq ex-file (concat (file-name-as-directory ex-file)
2258 (file-name-nondirectory buffer-file-name))))
2259 (set-visited-file-name ex-file)))
2278 (- (window-width) fill-column)))
2280 (- (window-width) (default-value 'fill-column))))
2281 (princ (format "shell \t\t\t= %S\n" (if (boundp 'explicit-shell-file-name)
2282 explicit-shell-file-name