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

Lines Matching +defs:buffer +defs:display +defs:table

44   :group 'display
55 (defun get-next-valid-buffer (list &optional buffer visible-ok frame)
56 "Search LIST for a valid buffer to display in FRAME.
57 Return nil when all buffers in LIST are undesirable for display,
58 otherwise return the first suitable buffer in LIST.
63 If BUFFER is non-nil, ignore occurrences of that buffer in LIST."
64 ;; This logic is more or less copied from other-buffer.
66 (let ((pred (frame-parameter frame 'buffer-predicate))
70 (if (and (not (eq buffer buf))
71 (buffer-live-p buf)
73 (not (eq (aref (buffer-name buf) 0) ?\s))
74 (or visible-ok (null (get-buffer-window buf 'visible))))
79 (defun last-buffer (&optional buffer visible-ok frame)
80 "Return the last non-hidden displayable buffer in the buffer list.
81 If BUFFER is non-nil, last-buffer will ignore that buffer.
85 buffer list instead of the selected frame's buffer list.
86 If no other buffer exists, the buffer `*scratch*' is returned."
88 (or (get-next-valid-buffer (frame-parameter frame 'buried-buffer-list)
89 buffer visible-ok frame)
90 (get-next-valid-buffer (nreverse (buffer-list frame))
91 buffer visible-ok frame)
93 (set-buffer-major-mode (get-buffer-create "*scratch*"))
94 (get-buffer "*scratch*"))))
96 (defun next-buffer ()
97 "Switch to the next buffer in cyclic order."
99 (let ((buffer (current-buffer))
100 (bbl (frame-parameter nil 'buried-buffer-list)))
101 (switch-to-buffer (other-buffer buffer t))
102 (bury-buffer buffer)
103 (set-frame-parameter nil 'buried-buffer-list
104 (cons buffer (delq buffer bbl)))))
106 (defun previous-buffer ()
107 "Switch to the previous buffer in cyclic order."
109 (let ((buffer (last-buffer (current-buffer) t))
110 (bbl (frame-parameter nil 'buried-buffer-list)))
111 (switch-to-buffer buffer)
112 ;; Clean up buried-buffer-list up to and including the chosen buffer.
113 (while (and bbl (not (eq (car bbl) buffer)))
115 (set-frame-parameter nil 'buried-buffer-list bbl)))
138 If nil, don't highlight the locus in the source buffer.
151 If nil, don't highlight the locus in the source buffer.
171 (defvar next-error-last-buffer nil
172 "The most recent `next-error' buffer.
173 A buffer becomes most recent when its compilation, grep, or
178 "Function to use to find the next error in the current buffer.
184 to indicate to `next-error' that this is a candidate buffer and how
187 (make-variable-buffer-local 'next-error-function)
189 (defsubst next-error-buffer-p (buffer
193 "Test if BUFFER is a `next-error' capable buffer.
195 If AVOID-CURRENT is non-nil, treat the current buffer
198 The function EXTRA-TEST-INCLUSIVE, if non-nil, is called in each buffer
199 that normally would not qualify. If it returns t, the buffer
202 The function EXTRA-TEST-EXCLUSIVE, if non-nil, is called in each buffer
204 that buffer is rejected."
205 (and (buffer-name buffer) ;First make sure it's live.
206 (not (and avoid-current (eq buffer (current-buffer))))
207 (with-current-buffer buffer
217 (defun next-error-find-buffer (&optional avoid-current
220 "Return a `next-error' capable buffer.
222 If AVOID-CURRENT is non-nil, treat the current buffer
225 The function EXTRA-TEST-INCLUSIVE, if non-nil, is called in each buffer
226 that normally would not qualify. If it returns t, the buffer
229 The function EXTRA-TEST-EXCLUSIVE, if non-nil, is called in each buffer
231 that buffer is rejected."
233 ;; 1. If one window on the selected frame displays such buffer, return it.
237 (if (next-error-buffer-p
238 (window-buffer w)
241 (window-buffer w)))
245 ;; 2. If next-error-last-buffer is an acceptable buffer, use that.
246 (if (and next-error-last-buffer
247 (next-error-buffer-p next-error-last-buffer avoid-current
249 next-error-last-buffer)
250 ;; 3. If the current buffer is acceptable, choose it.
251 (if (next-error-buffer-p (current-buffer) avoid-current
253 (current-buffer))
254 ;; 4. Look for any acceptable buffer.
255 (let ((buffers (buffer-list)))
257 (not (next-error-buffer-p
262 ;; 5. Use the current buffer as a last resort if it qualifies,
265 (next-error-buffer-p (current-buffer) nil
268 (message "This is the only buffer with error message locations")
269 (current-buffer)))
277 the message buffer is checked for new ones.
281 Just \\[universal-argument] as a prefix means reparse the error message buffer
287 compilation, grep, or occur buffer. It can also operate on any
288 buffer with output from the \\[compile], \\[grep] commands, or,
289 more generally, on any buffer in Compilation mode or with
290 Compilation Minor mode enabled, or any buffer in which
292 To specify use of a particular buffer for error messages, type
293 \\[next-error] in that buffer when it is the only one displayed
296 Once \\[next-error] has chosen the buffer for error messages, it
297 runs `next-error-hook' with `run-hooks', and stays with that buffer
298 until you use it in some other buffer which uses Compilation mode
305 (when (setq next-error-last-buffer (next-error-find-buffer))
307 (with-current-buffer next-error-last-buffer
313 (setq next-error-last-buffer (current-buffer))
315 (with-current-buffer next-error-last-buffer
341 "Move point to the next error in the `next-error' buffer and highlight match.
345 select the source buffer."
349 (pop-to-buffer next-error-last-buffer))
352 "Move point to the previous error in the `next-error' buffer and highlight match.
356 select the source buffer."
366 buffer causes automatic display of the corresponding source code
409 (barf-if-buffer-read-only)
421 (not (buffer-has-markers-at (1- (point))))
422 (not (buffer-has-markers-at (point)))
547 (buffer-substring (point)
595 "Delete all the trailing whitespace across the current buffer.
660 (let* ((char (let (translation-table-for-input input-method-function)
743 (defun beginning-of-buffer (&optional arg)
744 "Move point to the beginning of the buffer; leave mark at previous position.
748 If the buffer is narrowed, this command uses the beginning and size
749 of the accessible part of the buffer.
761 ;; Avoid overflow for large buffer sizes!
768 (defun end-of-buffer (&optional arg)
769 "Move point to the end of the buffer; leave mark at previous position.
773 If the buffer is narrowed, this command uses the beginning and size
774 of the accessible part of the buffer.
786 ;; Avoid overflow for large buffer sizes!
791 ;; If we went to a place in the middle of the buffer,
795 ;; If the end of the buffer is not already on the screen,
800 (defun mark-whole-buffer ()
801 "Put point at beginning and mark at end of buffer.
814 (defun goto-line (arg &optional buffer)
815 "Goto line ARG, counting from line 1 at beginning of buffer.
816 Normally, move point in the current buffer.
818 displayed other buffer, and switch to it. When called from Lisp code,
819 the optional argument BUFFER specifies a buffer to switch to.
821 If there's a number in the buffer at point, it is the default for ARG."
825 ;; Look for a default, a number in the buffer at point.
830 (buffer-substring-no-properties
835 (buffer
837 (other-buffer (current-buffer) t)))
838 (buffer-prompt
839 (if buffer
840 (concat " in " (buffer-name buffer))
845 buffer-prompt
850 buffer))))
851 ;; Switch to the desired buffer, one way or another.
852 (if buffer
853 (let ((window (get-buffer-window buffer)))
855 (switch-to-buffer-other-window buffer))))
856 ;; Move to the specified line number in that buffer.
860 (if (eq selective-display t)
871 "Print the current buffer line number and narrowed line number of point."
892 (if (eq selective-display t)
904 (- (buffer-size) (forward-line (buffer-size)))))))
907 "Return (narrowed) buffer line number at position POS.
908 If POS is nil, use current buffer location.
910 to the contents of the accessible portion of the buffer."
920 "Print info on cursor position (on screen and within buffer).
925 buffer's selected coding system if the coding system encodes the
931 in *Help* buffer. See also the command `describe-char'."
937 (total (buffer-size))
952 (let ((coding buffer-file-coding-system)
953 encoded encoding-msg display-prop under-display)
956 (setq coding default-buffer-file-coding-system))
960 ;; Check if the character is displayed with some `display'
961 ;; text property. In that case, set under-display to the
962 ;; buffer substring covered by that property.
963 (setq display-prop (get-text-property pos 'display))
964 (if display-prop
965 (let ((to (or (next-single-property-change pos 'display)
968 (setq under-display "")
969 (setq under-display "..."
971 (setq under-display
972 (concat (buffer-substring-no-properties pos to)
973 under-display)))
976 (if display-prop
977 (if (not (stringp display-prop))
978 (format "(%d, #o%o, #x%x, part of display \"%s\")"
979 char char char under-display)
980 (format "(%d, #o%o, #x%x, part of display \"%s\"->\"%s\")"
981 char char char under-display display-prop))
996 (buffer-substring-no-properties (point) (1+ (point))))
1002 (buffer-substring-no-properties (point) (1+ (point))))
1043 display the result of expression evaluation."
1057 ;; for the sake of completion of names like eval-region, eval-buffer.
1063 insert the result into the current buffer instead of printing it in
1092 (let ((standard-output (current-buffer)))
1354 "^" (regexp-quote (buffer-substring (minibuffer-prompt-end) (point))))
1357 ;; Move to the position we were at before changing the buffer contents.
1371 "Return the display width of the minibuffer prompt.
1372 Return 0 if current buffer is not a minibuffer."
1374 ;; the buffer; this should be 0 for normal buffers.
1381 (defconst undo-equiv-table (make-hash-table :test 'eq :weakness t)
1387 "Non-nil if `pending-undo-list' is not just a tail of `buffer-undo-list'.")
1411 (let ((modified (buffer-modified-p))
1421 ;; If something (a timer or filter?) changed the buffer
1423 (let ((list buffer-undo-list))
1428 (gethash list undo-equiv-table))))
1440 (let ((equiv (gethash pending-undo-list undo-equiv-table)))
1448 (while (let ((next (gethash equiv undo-equiv-table)))
1460 (puthash buffer-undo-list
1462 undo-equiv-table)
1465 (let ((tail buffer-undo-list)
1472 (setq buffer-undo-list (cdr tail)))
1478 (setq buffer-undo-list (cdr tail)))
1484 ;; so the next command can tell if the buffer was modified in between.
1485 (and modified (not (buffer-modified-p))
1491 (defun buffer-disable-undo (&optional buffer)
1493 No argument or nil as argument means do this for the current buffer."
1495 (with-current-buffer (if buffer (get-buffer buffer) (current-buffer))
1496 (setq buffer-undo-list t)))
1538 (if (eq buffer-undo-list t)
1539 (error "No undo information in this buffer"))
1543 buffer-undo-list)))
1549 The elements come from `buffer-undo-list', but we keep only
1553 (let ((undo-list-copy (undo-copy-list buffer-undo-list))
1584 ;; Loop down the earlier events adjusting their buffer
1585 ;; positions to reflect the fact that a change to the buffer
1670 ;; Return the first affected buffer position and the delta for an undo element
1671 ;; delta is defined as the change in subsequent buffer positions if we *did*
1708 (make-variable-buffer-local 'undo-extra-outer-limit)
1728 (buffer-name) size)))
1729 (progn (setq buffer-undo-list nil)
1733 (display-warning '(undo discard-info)
1736 (buffer-name) size)
1741 to the buffer. In that case, to prevent similar problems in the
1750 You can disable the popping up of this buffer by adding the entry
1753 (setq buffer-undo-list nil)
1763 (defvar shell-command-default-error-buffer nil
1765 This buffer is used when `shell-command' or `shell-command-on-region'
1769 (defun shell-command (command &optional output-buffer error-buffer)
1770 "Execute string COMMAND in inferior shell; display output, if any.
1774 The output appears in the buffer `*Async Shell Command*'.
1775 That buffer is in shell mode.
1778 the buffer `*Shell Command Output*'. If the output is short enough to
1779 display in the echo area (which is determined by the variables
1781 there, but it is nonetheless available in buffer `*Shell Command
1782 Output*' even though that buffer is not automatically displayed.
1792 says to put the output in some other buffer.
1793 If OUTPUT-BUFFER is a buffer or buffer name, put the output there.
1794 If OUTPUT-BUFFER is not a buffer and not nil,
1795 insert output in current buffer. (This cannot be done asynchronously.)
1799 and you did not specify \"insert it in the current buffer\",
1800 the output can be displayed in the echo area or in its buffer.
1801 If the output is short enough to display in the echo area
1804 the buffer containing the output is displayed.
1807 in the current buffer\", a message about the error goes at the end
1810 If there is no output, or if output is inserted in the current buffer,
1813 If the optional third argument ERROR-BUFFER is non-nil, it is a buffer
1814 or buffer name to which to direct the command's standard error output.
1816 In an interactive call, the variable `shell-command-default-error-buffer'
1822 shell-command-default-error-buffer))
1828 (funcall handler 'shell-command command output-buffer error-buffer)
1829 (if (and output-buffer
1830 (not (or (bufferp output-buffer) (stringp output-buffer))))
1831 ;; Output goes in current buffer.
1833 (if error-buffer
1839 (barf-if-buffer-read-only)
1853 (with-current-buffer (get-buffer-create error-buffer)
1863 (display-buffer (current-buffer))))
1871 (current-buffer)))))
1872 ;; Output goes in a separate buffer.
1877 (let ((buffer (get-buffer-create
1878 (or output-buffer "*Async Shell Command*")))
1884 (setq proc (get-buffer-process buffer))
1889 (with-current-buffer buffer
1890 (setq buffer-read-only nil)
1891 (erase-buffer)
1892 (display-buffer buffer)
1894 (setq proc (start-process "Shell" buffer shell-file-name
1901 output-buffer nil error-buffer)))))))
1903 (defun display-message-or-buffer (message
1904 &optional buffer-name not-this-window frame)
1905 "Display MESSAGE in the echo area if possible, otherwise in a pop-up buffer.
1906 MESSAGE may be either a string or a buffer.
1908 A buffer is displayed using `display-buffer' if MESSAGE is too long for
1913 buffer is used, the window used to display it.
1916 name of the buffer used to display it in the case where a pop-up buffer
1919 the contents are inserted into the buffer anyway.
1921 Optional arguments NOT-THIS-WINDOW and FRAME are as for `display-buffer',
1922 and only used if a buffer is displayed."
1932 (with-current-buffer
1935 (get-buffer-create (or buffer-name "*Message*")))
1938 (erase-buffer)
1942 (if (= (buffer-size) 0)
1957 ;; Don't use the echo area if the output buffer is
1959 (not (get-buffer-window (current-buffer))))
1964 (message "%s" (buffer-substring (point-min) (point))))
1968 (display-buffer (current-buffer)
1973 ;; in the buffer itself.
1981 &optional output-buffer replace
1982 error-buffer display-error-buffer)
1984 Normally display output (if any) in temp buffer `*Shell Command Output*';
1990 before this command. By default, the input (from the current buffer)
1992 `buffer-file-coding-system'. If the output is going to replace the region,
2001 in the echo area or in a buffer.
2002 If the output is short enough to display in the echo area
2005 it is displayed in the buffer `*Shell Command Output*'. The output
2006 is available in that buffer in both cases.
2011 If there is no output, or if output is inserted in the current buffer,
2015 that says to put the output in some other buffer.
2016 If OUTPUT-BUFFER is a buffer or buffer name, put the output there.
2017 If OUTPUT-BUFFER is not a buffer and not nil,
2018 insert output in the current buffer.
2025 If optional sixth argument ERROR-BUFFER is non-nil, it is a buffer
2026 or buffer name to which to direct the command's standard error output.
2028 If DISPLAY-ERROR-BUFFER is non-nil, display the error buffer if there
2030 In an interactive call, the variable `shell-command-default-error-buffer'
2047 shell-command-default-error-buffer
2050 (if error-buffer
2058 (and output-buffer
2059 (not (or (bufferp output-buffer) (stringp output-buffer)))))
2071 ;; It is rude to delete a buffer which the command is not using.
2072 ;; (let ((shell-buffer (get-buffer "*Shell Command Output*")))
2073 ;; (and shell-buffer (not (eq shell-buffer (current-buffer)))
2074 ;; (kill-buffer shell-buffer)))
2077 ;; No prefix argument: put the output in a temp buffer,
2079 (let ((buffer (get-buffer-create
2080 (or output-buffer "*Shell Command Output*"))))
2082 (if (eq buffer (current-buffer))
2083 ;; If the input is the same buffer as the output,
2086 (progn (setq buffer-read-only nil)
2097 ;; Clear the output buffer, then run the command with
2101 (set-buffer buffer)
2102 (setq buffer-read-only nil)
2103 (if (not output-buffer)
2105 (erase-buffer)))
2109 (list buffer error-file)
2110 buffer)
2113 (with-current-buffer buffer
2121 (if (with-current-buffer buffer (> (point-max) (point-min)))
2122 ;; There's some output, display it
2123 (display-message-or-buffer buffer)
2142 ;; (kill-buffer buffer)
2147 (with-current-buffer (get-buffer-create error-buffer)
2157 (and display-error-buffer
2158 (display-buffer (current-buffer)))))
2165 (with-current-buffer
2169 (defun process-file (program &optional infile buffer display &rest args)
2187 (if fh (apply fh 'process-file program infile buffer display args)
2189 (setq stderr-file (when (and (consp buffer) (stringp (cadr buffer)))
2194 (if stderr-file (list (car buffer) stderr-file) buffer)
2195 display args)
2196 (when stderr-file (copy-file stderr-file (cadr buffer)))))
2340 (defvar buffer-substring-filters nil
2341 "List of filter functions for `filter-buffer-substring'.
2343 a string. The buffer substring is passed to the first function
2346 return value of `filter-buffer-substring'.
2350 (defun filter-buffer-substring (beg end &optional delete noprops)
2351 "Return the buffer substring between BEG and END, after filtering.
2352 The buffer substring is passed through each of the filter
2353 functions in `buffer-substring-filters', and the value from the
2354 last filter function is returned. If `buffer-substring-filters'
2355 is nil, the buffer substring is returned unaltered.
2358 from the buffer.
2362 includes text properties from the buffer text.
2365 `buffer-substring-filters', in case the functions need to know
2368 This function should be used instead of `buffer-substring',
2369 `buffer-substring-no-properties', or `delete-and-extract-region'
2371 major or minor modes can use `buffer-substring-filters' to
2372 extract characters that are special to a buffer, and should not
2375 ((or delete buffer-substring-filters)
2379 (buffer-substring beg end))))
2380 (dolist (filter buffer-substring-filters)
2386 (buffer-substring-no-properties beg end))
2388 (buffer-substring beg end))))
2406 similar argument to `x-set-cut-buffer', which see.")
2460 inserted into a buffer; see `insert-for-yank' for details.
2539 '(text-read-only buffer-read-only error))
2544 This deletes the text from the buffer and saves it in the kill ring.
2551 If the buffer is read-only, Emacs will beep and refrain from deleting
2553 you can use the killing commands to copy text from a read-only buffer.
2572 (let ((string (filter-buffer-substring beg end t)))
2581 ((buffer-read-only text-read-only)
2582 ;; The code above failed because the buffer, or some of the characters
2593 ;; Signal an error if the buffer is read-only.
2594 (barf-if-buffer-read-only)
2595 ;; If the buffer isn't read-only, the text is.
2596 (signal 'text-read-only (list (current-buffer)))))))
2608 (kill-append (filter-buffer-substring beg end) (< end beg))
2609 (kill-new (filter-buffer-substring beg end)))
2639 (set-marker (mark-marker) (point) (current-buffer))
2643 (set-marker (mark-marker) other-end (current-buffer))
2704 When this command inserts killed text into the buffer, it honors
2718 (set-marker (mark-marker) (point) (current-buffer))
2728 (set-marker (mark-marker) (point) (current-buffer))))))
2739 When this command inserts killed text into the buffer, it honors
2759 (set-marker (mark-marker) (point) (current-buffer)))))
2828 Case is ignored if `case-fold-search' is non-nil in the current buffer.
2831 (if (char-table-p translation-table-for-input)
2832 (setq char (or (aref translation-table-for-input char) char)))
2865 If the buffer is read-only, Emacs will beep and refrain from deleting
2867 you can use this command to copy text from a read-only buffer.
2873 ;; before killing. That way, in a read-only buffer, point
2881 (signal 'end-of-buffer nil))
2904 (signal 'end-of-buffer nil))
2906 (signal 'beginning-of-buffer nil))
2942 (signal 'end-of-buffer nil))
2947 (if (if (eq buffer-invisibility-spec t)
2949 (or (memq prop buffer-invisibility-spec)
2950 (assq prop buffer-invisibility-spec)))
2959 (if (eq buffer-invisibility-spec t)
2961 (or (memq prop buffer-invisibility-spec)
2962 (assq prop buffer-invisibility-spec)))))
2975 (signal 'beginning-of-buffer nil)))
2981 (unless (if (eq buffer-invisibility-spec t)
2983 (or (memq prop buffer-invisibility-spec)
2984 (assq prop buffer-invisibility-spec)))
2993 (if (eq buffer-invisibility-spec t)
2995 (or (memq prop buffer-invisibility-spec)
2996 (assq prop buffer-invisibility-spec)))))
3004 ((beginning-of-buffer end-of-buffer)
3018 (if (eq buffer-invisibility-spec t)
3020 (or (memq prop buffer-invisibility-spec)
3021 (assq prop buffer-invisibility-spec))))))
3029 (defun insert-buffer (buffer)
3032 BUFFER may be a buffer or a buffer name.
3035 Don't call it from programs: use `insert-buffer-substring' instead!"
3039 (barf-if-buffer-read-only)
3040 (read-buffer "Insert buffer: "
3042 (other-buffer (current-buffer))
3043 (window-buffer (next-window (selected-window))))
3047 (insert-buffer-substring (get-buffer buffer))
3051 (defun append-to-buffer (buffer start end)
3052 "Append to specified buffer the text of the region.
3053 It is inserted into that buffer before its point.
3056 BUFFER (or buffer name), START and END.
3057 START and END specify the portion of the current buffer to be copied."
3059 (list (read-buffer "Append to buffer: " (other-buffer (current-buffer) t))
3061 (let ((oldbuf (current-buffer)))
3063 (let* ((append-to (get-buffer-create buffer))
3064 (windows (get-buffer-window-list append-to t t))
3066 (set-buffer append-to)
3068 (barf-if-buffer-read-only)
3069 (insert-buffer-substring oldbuf start end)
3074 (defun prepend-to-buffer (buffer start end)
3075 "Prepend to specified buffer the text of the region.
3076 It is inserted into that buffer after its point.
3079 BUFFER (or buffer name), START and END.
3080 START and END specify the portion of the current buffer to be copied."
3081 (interactive "BPrepend to buffer: \nr")
3082 (let ((oldbuf (current-buffer)))
3084 (set-buffer (get-buffer-create buffer))
3085 (barf-if-buffer-read-only)
3087 (insert-buffer-substring oldbuf start end)))))
3089 (defun copy-to-buffer (buffer start end)
3090 "Copy to specified buffer the text of the region.
3091 It is inserted into that buffer, replacing existing text there.
3094 BUFFER (or buffer name), START and END.
3095 START and END specify the portion of the current buffer to be copied."
3096 (interactive "BCopy to buffer: \nr")
3097 (let ((oldbuf (current-buffer)))
3098 (with-current-buffer (get-buffer-create buffer)
3099 (barf-if-buffer-read-only)
3100 (erase-buffer)
3102 (insert-buffer-substring oldbuf start end)))))
3117 "Return this buffer's mark value as integer, or nil if never set.
3144 "Set this buffer's mark to POS. Don't use this function!
3164 (set-marker (mark-marker) pos (current-buffer)))
3173 "The list of former marks of the current buffer, most recent first.")
3174 (make-variable-buffer-local 'mark-ring)
3196 (error "No mark set in this buffer")
3235 global mark ring, if the previous mark was set in another buffer.
3286 If the last global mark pushed was not in the current buffer,
3299 (set-marker (mark-marker) (or location (point)) (current-buffer))
3302 (eq (marker-buffer (car global-mark-ring)) (current-buffer)))
3303 ;; The last global mark pushed was in this same buffer.
3317 "Pop off mark ring into the buffer's actual mark.
3321 (set-marker (mark-marker) (+ 0 (car mark-ring)) (current-buffer))
3342 (error "No mark set in this buffer"))
3352 Changing the buffer \"deactivates\" the mark.
3355 incremental search, \\[beginning-of-buffer], and \\[end-of-buffer].
3362 default part of the buffer's text. Examples of such commands include
3373 the current accessible part of the buffer.
3376 as a fallback, and won't change the buffer bounds.")
3382 (while (and global-mark-ring (not (marker-buffer (car global-mark-ring))))
3387 (buffer (marker-buffer marker))
3391 (set-buffer buffer)
3396 (error "Global mark position is outside accessible part of buffer")))
3398 (switch-to-buffer buffer)))
3402 "*If non-nil, `next-line' inserts newline to avoid `end of buffer' error."
3413 If there is no line in the buffer after this one, behavior depends on the
3416 cursor to the end of the buffer.
3440 ((beginning-of-buffer end-of-buffer) (ding)))
3466 ((beginning-of-buffer end-of-buffer) (ding)))
3482 (make-variable-buffer-local 'goal-column)
3500 (if (eq buffer-invisibility-spec t)
3502 (or (memq prop buffer-invisibility-spec)
3503 (assq prop buffer-invisibility-spec)))))
3599 (if (and (not (integerp selective-display))
3616 'beginning-of-buffer
3617 'end-of-buffer)
3638 (signal 'end-of-buffer nil)
3641 (not (integerp selective-display))
3649 (signal 'end-of-buffer nil)
3667 (signal 'beginning-of-buffer nil)
3670 (not (integerp selective-display))
3675 (signal 'beginning-of-buffer nil)
3814 ;; but with a more reasonable buffer position.
3826 If point reaches the beginning or end of buffer, it stops there.
3860 If point reaches the beginning or end of buffer, it stops there.
3941 (defun beginning-of-buffer-other-window (arg)
3942 "Move point to the beginning of the buffer in the other window.
3953 ;; Set point and mark in that window's buffer.
3955 (beginning-of-buffer arg))
3960 (defun end-of-buffer-other-window (arg)
3961 "Move point to the end of the buffer in the other window.
3965 ;; See beginning-of-buffer-other-window for comments.
3972 (end-of-buffer arg))
4173 (buffer-substring-no-properties start end)))))
4181 (make-variable-buffer-local 'fill-prefix)
4197 ;; This function is used as the auto-fill-function of a buffer
4341 (defun set-selective-display (arg)
4342 "Set `selective-display' to ARG; clear it if no arg.
4343 When the value of `selective-display' is a number > 0,
4345 The variable `selective-display' has a separate value for each buffer."
4347 (if (eq selective-display t)
4348 (error "selective-display already in use for marked lines"))
4354 (setq selective-display
4358 (princ "selective-display set to " t)
4359 (prin1 selective-display t)
4366 "Toggle whether to fold or truncate long lines for the current buffer.
4376 (let ((buffer (current-buffer)))
4378 (if (eq buffer (window-buffer window))
4434 with very long lines; see variables `line-number-display-limit'
4435 and `line-number-display-limit-width'."
4449 of the buffer appears in the mode line."
4476 If nil, search stops at the beginning of the accessible portion of the buffer."
4554 (buffer-substring (line-beginning-position)
4561 (buffer-substring blinkpos
4569 (buffer-substring (progn
4577 (buffer-substring blinkpos (1+ blinkpos)))
4579 (buffer-substring blinkpos (1+ blinkpos)))))))
4601 (defvar buffer-quit-function nil
4602 "Function to call to \"quit\" the current buffer, or nil if none.
4611 cancel the use of the current buffer (for special-purpose buffers),
4623 (buffer-quit-function
4624 (funcall buffer-quit-function))
4627 ((string-match "^ \\*" (buffer-name (current-buffer)))
4628 (bury-buffer))))
4709 (let ((special-display-buffer-names nil)
4710 (special-display-regexps nil)
4711 (same-window-buffer-names nil)
4750 switch to and display the buffer used for mail composition.
4773 'switch-to-buffer-other-window yank-action send-actions))
4782 'switch-to-buffer-other-frame yank-action send-actions))
4801 With a prefix argument, set VARIABLE to VALUE buffer-locally."
4813 "(buffer-local)")
4816 "buffer-locally")
4854 ;; has an effect on the display, like `tab-width' has.
4876 (defvar completion-reference-buffer nil
4877 "Record the buffer that was current when the completion list was requested.
4878 This is a local variable in the completion list buffer.
4888 This is a local variable in the completion list buffer
4889 but it talks about the buffer in `completion-reference-buffer'.
4891 of the tail end of the buffer's text is involved in completion.")
4897 (let ((buf completion-reference-buffer))
4902 (if (get-buffer-window buf)
4903 (select-window (get-buffer-window buf))))))
4941 (let (beg end completion (buffer completion-reference-buffer)
4951 (setq completion (buffer-substring-no-properties beg end))
4955 ;; This is a special buffer's frame
4958 (bury-buffer)))
4960 (choose-completion-string completion buffer base-size)))
4976 (let ((tail (buffer-substring (point) opoint)))
4987 CHOICE - the string to insert in the buffer,
4988 BUFFER - the buffer in which the choice should be inserted,
5000 (defun choose-completion-string (choice &optional buffer base-size)
5010 (let* ((buffer (or buffer completion-reference-buffer))
5011 (mini-p (minibufferp buffer)))
5016 (not (equal buffer
5017 (window-buffer (active-minibuffer-window))))))
5019 ;; Set buffer so buffer-local choose-completion-string-functions works.
5020 (set-buffer buffer)
5023 choice buffer mini-p base-size)
5024 ;; Insert the completion into the buffer where it was requested.
5035 (let ((window (get-buffer-window buffer t)))
5039 (equal buffer (window-buffer (minibuffer-window)))
5040 minibuffer-completion-table
5043 (if (and (eq minibuffer-completion-table 'read-file-name-internal)
5067 "Finish setup of the completions buffer.
5068 Called from `temp-buffer-show-hook'."
5072 (add-hook 'temp-buffer-show-hook 'completion-list-mode-finish)
5075 "Normal hook run at the end of setting up a completion list buffer.
5076 When this hook is run, the current buffer is the one in which the
5077 command to display the completion list buffer was run.
5078 The completion list buffer is available as the value of `standard-output'.
5080 value of `completion-common-substring'. See also `display-completion-list'.")
5086 "Non-nil means show help message in *Completions* buffer."
5093 "Face put on the first uncommon character in completions in *Completions* buffer."
5098 "Face put on the common prefix substring in completions in *Completions* buffer.
5112 The value is set by `display-completion-list' during running `completion-setup-hook'.
5115 in the `*Completions*' buffer, the common prefix substring in completions
5120 ;; after the text of the completion list buffer is written.
5122 (let* ((mainbuf (current-buffer))
5127 ;; so it will get copied into the completion list buffer.
5129 (with-current-buffer mainbuf
5132 (with-current-buffer standard-output
5134 (set (make-local-variable 'completion-reference-buffer) mainbuf)
5137 ((and (symbolp minibuffer-completion-table)
5138 (get minibuffer-completion-table 'completion-base-size-function))
5141 (with-current-buffer mainbuf
5142 (funcall (get minibuffer-completion-table
5147 (with-current-buffer mainbuf
5182 (if (display-mouse-p)
5186 "In this buffer, type \\[choose-completion] to \
5198 (or (get-buffer-window "*Completions*")
5200 (let ((window (get-buffer-window "*Completions*")))
5304 ;;;; forking a twin copy of a buffer.
5307 (defvar clone-buffer-hook nil
5308 "Normal hook to run in the new buffer at the end of `clone-buffer'.")
5314 If PROCESS is associated with a buffer, the new process will be associated
5315 with the current buffer instead.
5326 (setq args (plist-put args :buffer
5327 (if (process-buffer process)
5328 (current-buffer))))
5331 (if (process-buffer process) (current-buffer))
5343 ;; - syntax-table
5345 (defun clone-buffer (&optional newname display-flag)
5346 "Create and return a twin copy of the current buffer.
5347 Unlike an indirect buffer, the new buffer can be edited
5349 NEWNAME is the name of the new buffer. It may be modified by
5351 unique buffer name. If nil, it defaults to the name of the
5352 current buffer, with the proper suffix. If DISPLAY-FLAG is
5353 non-nil, the new buffer is shown with `pop-to-buffer'. Trying to
5354 clone a file-visiting buffer, or a buffer whose major mode symbol
5358 current buffer with appropriate suffix. However, if a prefix
5362 This runs the normal hook `clone-buffer-hook' in the new buffer
5366 (if buffer-file-name
5367 (error "Cannot clone a file-visiting buffer"))
5369 (error "Cannot clone a buffer in %s mode" mode-name))
5371 (read-buffer "Name of new cloned buffer: " (current-buffer)))
5373 (if buffer-file-name
5374 (error "Cannot clone a file-visiting buffer"))
5376 (error "Cannot clone a buffer in %s mode" mode-name))
5377 (setq newname (or newname (buffer-name)))
5380 (let ((buf (current-buffer))
5385 (modified (buffer-modified-p))
5387 (lvars (buffer-local-variables))
5388 (process (get-buffer-process (current-buffer)))
5389 (new (generate-new-buffer (or newname (buffer-name)))))
5392 (with-current-buffer new
5393 (insert-buffer-substring buf)))
5394 (with-current-buffer new
5398 (set-buffer-modified-p modified)
5400 ;; Clone the old buffer's process, if any.
5417 (run-hooks 'clone-buffer-hook))
5418 (if display-flag
5419 ;; Presumably the current buffer is shown in the selected frame, so
5420 ;; we want to display the clone elsewhere.
5422 (same-window-buffer-names))
5423 (pop-to-buffer new)))
5427 (defun clone-indirect-buffer (newname display-flag &optional norecord)
5428 "Create an indirect buffer that is a twin copy of the current buffer.
5430 Give the indirect buffer name NEWNAME. Interactively, read NEWNAME
5433 buffer's name. The name is modified by adding a `<N>' suffix to it
5436 DISPLAY-FLAG non-nil means show the new buffer with `pop-to-buffer'.
5439 Optional third arg NORECORD non-nil means do not put this buffer at the
5444 (error "Cannot indirectly clone a buffer in %s mode" mode-name))
5446 (read-buffer "Name of indirect buffer: " (current-buffer)))
5449 (error "Cannot indirectly clone a buffer in %s mode" mode-name))
5450 (setq newname (or newname (buffer-name)))
5453 (let* ((name (generate-new-buffer-name newname))
5454 (buffer (make-indirect-buffer (current-buffer) name t)))
5455 (when display-flag
5456 (pop-to-buffer buffer norecord))
5457 buffer))
5460 (defun clone-indirect-buffer-other-window (newname display-flag &optional norecord)
5461 "Like `clone-indirect-buffer' but display in another window."
5465 (error "Cannot indirectly clone a buffer in %s mode" mode-name))
5467 (read-buffer "Name of indirect buffer: " (current-buffer)))
5470 (clone-indirect-buffer newname display-flag norecord)))
5597 (defvar vis-mode-saved-buffer-invisibility-spec nil
5598 "Saved value of `buffer-invisibility-spec' when Visible mode is on.")
5606 works by saving the value of `buffer-invisibility-spec' and setting it to nil."
5609 (when (local-variable-p 'vis-mode-saved-buffer-invisibility-spec)
5610 (setq buffer-invisibility-spec vis-mode-saved-buffer-invisibility-spec)
5611 (kill-local-variable 'vis-mode-saved-buffer-invisibility-spec))
5613 (set (make-local-variable 'vis-mode-saved-buffer-invisibility-spec)
5614 buffer-invisibility-spec)
5615 (setq buffer-invisibility-spec nil)))
5629 ; (when (consp buffer-undo-list)
5630 ; (setq buffer-undo-list (cddr buffer-undo-list)))