1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-02-01 20:06:00 +00:00

Merge from trunk.

This commit is contained in:
Paul Eggert 2011-09-04 12:18:28 -07:00
commit 6511acf257
51 changed files with 871 additions and 614 deletions

View File

@ -1,3 +1,7 @@
2011-09-04 Eli Zaretskii <eliz@gnu.org>
* basic.texi (Inserting Text): Add index entries. (Bug#9433)
2011-08-29 Chong Yidong <cyd@stupidchicken.com>
* modes.texi (Choosing Modes): auto-mode-case-fold is now t.

View File

@ -101,7 +101,9 @@ character to insert (@pxref{Arguments}).
@findex ucs-insert
@kindex C-x 8 RET
@cindex Unicode
@cindex Unicode characters, inserting
@cindex insert Unicode character
@cindex characters, inserting by name or code-point
Instead of @kbd{C-q}, you can use @kbd{C-x 8 @key{RET}}
(@code{ucs-insert}) to insert a character based on its Unicode name or
code-point. This command prompts for a character to insert, using

View File

@ -1,3 +1,116 @@
2011-09-04 Michael Albinus <michael.albinus@gmx.de>
* net/tramp.el (top): Require 'shell. Use `tramp-unload-hook' but
`tramp-cache-unload-hook' where appropriate.
(tramp-methods): Rename `tramp-remote-sh' to
`tramp-remote-shell'. Add `tramp-remote-shell-args'.
(tramp-handle-shell-command): New defun, moved from tramp-sh.el.
* net/tramp-sh.el (top): Don't require 'shell.
(tramp-methods): Add `tramp-remote-shell' and
`tramp-remote-shell-args' entries.
(tramp-sh-file-name-handler-alist): Use `tramp-handle-shell-command'.
(tramp-sh-handle-shell-command): Remove.
(tramp-find-shell, tramp-open-connection-setup-interactive-shell):
Use `tramp-remote-shell'.
2011-09-03 Chong Yidong <cyd@stupidchicken.com>
* mail/sendmail.el (sendmail-query-once-function): Deleted.
(sendmail-query-once): Save directly to send-mail-function.
Update message-send-mail-function too.
* mail/smtpmail.el (smtpmail-try-auth-methods): Clarify prompt.
2011-09-03 Christoph Scholtes <cschol2112@googlemail.com>
* progmodes/python.el (python-mode-map): Use correct function to
start python interpreter from menu-bar (as reported by Geert
Kloosterman).
(inferior-python-mode-map): Fix typo.
(python-shell-map): Removed.
2011-09-03 Deniz Dogan <deniz@dogan.se>
* net/rcirc.el (rcirc-print): Simplify code for
rcirc-scroll-show-maximum-output. There is no need to walk
through all windows to find the right one.
2011-09-03 Christoph Scholtes <cschol2112@googlemail.com>
* help.el (help-return-method): Doc fix.
2011-09-03 Martin Rudalics <rudalics@gmx.at>
* window.el (window-deletable-p): Don't return a non-nil value
when there's a buffer that was shown in the window before.
(Bug#9419)
(display-buffer-pop-up-frame, display-buffer-pop-up-window): Set
window's previous buffers to nil.
2011-09-03 Eli Zaretskii <eliz@gnu.org>
* mail/rmailmm.el (rmail-mime-insert-tagline): Insert an extra
newline before and after the tag line, so it doesn't interfere
with determining the paragraph direction of bidirectional text.
2011-09-03 Leo Liu <sdl.web@gmail.com>
* files.el (find-file-not-true-dirname-list): Remove. (Bug#9422)
2011-09-02 Chong Yidong <cyd@stupidchicken.com>
* window.el (pop-to-buffer-1, pop-to-buffer-same-window): Deleted.
(pop-to-buffer): Change interactive spec. Pass second argument
directly to display-buffer.
(display-buffer): Fix interactive spec. Use functionp to
distinguish between a function and a list of functions.
* abbrev.el (edit-abbrevs):
* arc-mode.el (archive-extract):
* autoinsert.el (auto-insert):
* bookmark.el (bookmark-bmenu-list):
* files.el (find-file):
* view.el (view-buffer):
* progmodes/compile.el (compilation-goto-locus):
* textmodes/bibtex.el (bibtex-initialize): Use switch-to-buffer.
2011-09-02 Chong Yidong <cyd@stupidchicken.com>
* window.el (display-buffer-alist): Doc fix.
(display-buffer): Add docstring. Don't treat
display-buffer-default specially.
(display-buffer-reuse-selected-window)
(display-buffer-same-window, display-buffer-maybe-same-window)
(display-buffer-reuse-window, display-buffer-pop-up-frame)
(display-buffer-pop-up-window)
(display-buffer-reuse-or-pop-window)
(display-buffer-use-some-window): New functions.
(display-buffer-default-action): Use them.
(display-buffer-default): Deleted.
(pop-to-buffer-1): Fix choice of actions.
2011-09-02 Stefan Monnier <monnier@iro.umontreal.ca>
* minibuffer.el (completion--insert-strings): Don't get confused by
completion entries that end with an LF char.
2011-09-01 Eli Zaretskii <eliz@gnu.org>
* window.el (frame-auto-delete, window-deletable-p): Doc fix.
2011-09-01 Chong Yidong <cyd@stupidchicken.com>
* window.el (display-buffer): Restore interactive spec.
(display-buffer-same-window, display-buffer-other-window):
New functions.
(pop-to-buffer-1): New function. Use the above.
(pop-to-buffer, pop-to-buffer-same-window): Use it.
(pop-to-buffer-other-window, pop-to-buffer-other-frame): Delete.
* view.el (view-buffer-other-window, view-buffer-other-frame):
Just use pop-to-buffer.
2011-09-01 Thierry Volpiatto <thierry.volpiatto@gmail.com>
* vc/vc-rcs.el (vc-rcs-responsible-p): Handle directories. (Bug#9391)
@ -44,8 +157,8 @@
(display-buffer-alist-set-1, display-buffer-alist-set-2)
(display-buffer-alist-set): Remove.
(display-buffer-function, special-display-buffer-names)
(special-display-regexps, special-display-function): In
doc-string refer to display-buffer-window and quit-restore
(special-display-regexps, special-display-function):
In doc-string refer to display-buffer-window and quit-restore
parameter.
(pop-up-frame-alist, pop-up-frame-function, special-display-p)
(special-display-frame-alist, special-display-popup-frame)
@ -56,8 +169,8 @@
(split-window-sensibly, window--try-to-split-window)
(window--frame-usable-p, even-window-heights)
(window--even-window-heights, window--display-buffer-1)
(window--display-buffer-2, display-buffer-other-frame): Restore
old Emacs 23 code, order and doc-strings where applicable.
(window--display-buffer-2, display-buffer-other-frame):
Restore old Emacs 23 code, order and doc-strings where applicable.
(display-buffer-default, display-buffer-assq-regexp): New functions.
(display-buffer-alist): Rewrite doc-string.
(display-buffer-default-action)
@ -69,8 +182,8 @@
Restore Emacs 23 behavior but use
window-normalize-buffer-to-switch-to.
(pop-to-buffer-same-window): Rewrite.
(pop-to-buffer-other-window, pop-to-buffer-other-frame): Rewrite
using Emacs 23 options.
(pop-to-buffer-other-window, pop-to-buffer-other-frame):
Rewrite using Emacs 23 options.
2011-08-31 Michael Albinus <michael.albinus@gmx.de>
@ -79,8 +192,8 @@
(tramp-completion-file-name-regexp-separate)
(tramp-completion-file-name-regexp-url): Don't use leading volume
letter on win32 systems. (Bug#5303, Bug#9311)
(tramp-drop-volume-letter): Simplify definition. Suggested by
Stefan Monnier <monnier@iro.umontreal.ca>.
(tramp-drop-volume-letter): Simplify definition.
Suggested by Stefan Monnier <monnier@iro.umontreal.ca>.
2011-08-30 Stefan Monnier <monnier@iro.umontreal.ca>

View File

@ -159,7 +159,7 @@ where NAME and EXPANSION are strings with quotes,
USECOUNT is an integer, and HOOK is any valid function
or may be omitted (it is usually omitted)."
(interactive)
(pop-to-buffer-same-window (prepare-abbrev-list-buffer)))
(switch-to-buffer (prepare-abbrev-list-buffer)))
(defun edit-abbrevs-redefine ()
"Redefine abbrevs according to current buffer contents."

View File

@ -1083,7 +1083,7 @@ using `make-temp-file', and the generated name is returned."
(view-buffer buffer (and just-created 'kill-buffer-if-not-modified)))
((eq other-window-p 'display) (display-buffer buffer))
(other-window-p (switch-to-buffer-other-window buffer))
(t (pop-to-buffer-same-window buffer))))))
(t (switch-to-buffer buffer))))))
(defun archive-*-extract (archive name command)
(let* ((default-directory (file-name-as-directory archive-tmpdir))

View File

@ -360,7 +360,7 @@ Matches the visited file name against the elements of `auto-insert-alist'."
(save-window-excursion
;; make buffer visible before skeleton or function
;; which might ask the user for something
(pop-to-buffer-same-window (current-buffer))
(switch-to-buffer (current-buffer))
(if (and (consp action)
(not (eq (car action) 'lambda)))
(skeleton-insert action)

View File

@ -1539,7 +1539,7 @@ deletion, or > if it is flagged for displaying."
(bookmark-maybe-load-default-file)
(let ((buf (get-buffer-create "*Bookmark List*")))
(if (called-interactively-p 'interactive)
(pop-to-buffer-same-window buf)
(switch-to-buffer buf)
(set-buffer buf)))
(let ((inhibit-read-only t))
(erase-buffer)

View File

@ -1342,8 +1342,8 @@ automatically choosing a major mode, use \\[find-file-literally]."
(confirm-nonexistent-file-or-buffer)))
(let ((value (find-file-noselect filename nil nil wildcards)))
(if (listp value)
(mapcar #'pop-to-buffer-same-window (nreverse value))
(pop-to-buffer-same-window value))))
(mapcar 'switch-to-buffer (nreverse value))
(switch-to-buffer value))))
(defun find-file-other-window (filename &optional wildcards)
"Edit file FILENAME, in another window.
@ -1639,11 +1639,6 @@ home directory is a root directory) and removes automounter prefixes
(substring filename (match-end 0)))))
filename)))
(defcustom find-file-not-true-dirname-list nil
"List of logical names for which visiting shouldn't save the true dirname."
:type '(repeat (string :tag "Name"))
:group 'find-file)
(defun find-buffer-visiting (filename &optional predicate)
"Return the buffer visiting file FILENAME (a string).
This is like `get-file-buffer', except that it checks for any buffer

View File

@ -1,3 +1,12 @@
2011-09-03 Lars Magne Ingebrigtsen <larsi@gnus.org>
* nnimap.el (nnimap-open-connection-1): Use the correct port number in
the error message.
2011-09-02 Eli Zaretskii <eliz@gnu.org>
* message.el (message-setup-1): Return t (Bug#9392).
2011-09-01 Andrew Cohen <cohen@andy.bu.edu>
* gnus-sum.el: When adding article headers to a summary buffer also

View File

@ -6530,7 +6530,9 @@ are not included."
(message-position-point)
;; Allow correct handling of `message-checksum' in `message-yank-original':
(set-buffer-modified-p nil)
(undo-boundary))
(undo-boundary)
;; rmail-start-mail expects message-mail to return t (Bug#9392)
t)
(defun message-set-auto-save-file-name ()
"Associate the message buffer with a file in the drafts directory."

View File

@ -350,7 +350,6 @@ textual parts.")
(with-current-buffer (nnimap-make-process-buffer buffer)
(let* ((coding-system-for-read 'binary)
(coding-system-for-write 'binary)
(port nil)
(ports
(cond
((memq nnimap-stream '(network plain starttls))
@ -395,7 +394,7 @@ textual parts.")
(if (not stream)
(progn
(nnheader-report 'nnimap "Unable to contact %s:%s via %s"
nnimap-address port nnimap-stream)
nnimap-address (car ports) nnimap-stream)
'no-connect)
(gnus-set-process-query-on-exit-flag stream nil)
(if (not (gnus-string-match-p "[*.] \\(OK\\|PREAUTH\\)" greeting))

View File

@ -132,7 +132,7 @@
"What to do to \"exit\" the help buffer.
This is a list
(WINDOW . t) delete the selected window (and possibly its frame,
see `quit-window' and `View-quit'), go to WINDOW.
see `quit-window'), go to WINDOW.
(WINDOW . quit-window) do quit-window, then select WINDOW.
(WINDOW BUF START POINT) display BUF at START, POINT, then select WINDOW.")

View File

@ -4482,7 +4482,7 @@ With prefix argument N moves forward N messages with these labels.
;;;***
;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "a7d3e7205efa4e20ca9038c9b260ce83")
;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "2c8675d7c069c68bc36a4003b15448d1")
;;; Generated autoloads from rmailmm.el
(autoload 'rmail-mime "rmailmm" "\

View File

@ -426,7 +426,7 @@ The value is a vector [ INDEX HEADER TAGLINE BODY END], where
"Insert a tag line for MIME-entity ENTITY.
ITEM-LIST is a list of strings or button-elements (list) to be added
to the tag line."
(insert "[")
(insert "\n[")
(let ((tag (aref (rmail-mime-entity-tagline entity) 0)))
(if (> (length tag) 0) (insert (substring tag 1) ":")))
(insert (car (rmail-mime-entity-type entity)) " ")
@ -439,7 +439,7 @@ to the tag line."
(if (stringp item)
(insert item)
(apply 'insert-button item))))
(insert "]\n"))
(insert "]\n\n"))
(defun rmail-mime-update-tagline (entity)
"Update the current tag line for MIME-entity ENTITY."

View File

@ -156,51 +156,6 @@ This is used by the default mail-sending commands. See also
:version "24.1"
:group 'sendmail)
(defvar sendmail-query-once-function 'query
"Either a function to send email, or the symbol `query'.")
;;;###autoload
(defun sendmail-query-once ()
"Send an email via `sendmail-query-once-function'.
If `sendmail-query-once-function' is `query', ask the user what
function to use, and then save that choice."
(when (equal sendmail-query-once-function 'query)
(let* ((mail-buffer (current-buffer))
(default
(cond
((or (and window-system (eq system-type 'darwin))
(eq system-type 'windows-nt))
'mailclient-send-it)
((and sendmail-program
(executable-find sendmail-program))
'sendmail-send-it)))
(function
(if (or (not default)
;; We have detected no OS-level mail senders, or we
;; have already configured smtpmail, so we use the
;; internal SMTP service.
(and (boundp 'smtpmail-smtp-server)
smtpmail-smtp-server))
'smtpmail-send-it
;; Query the user.
(unwind-protect
(progn
(pop-to-buffer "*Mail Help*")
(erase-buffer)
(insert "Sending mail from Emacs hasn't been set up yet.\n\n"
"Type `y' to configure outgoing SMTP, or `n' to use\n"
"the default mail sender on your system.\n\n"
"To change this again at a later date, customize the\n"
"`send-mail-function' variable.\n")
(goto-char (point-min))
(if (y-or-n-p "Configure outgoing SMTP in Emacs? ")
'smtpmail-send-it
default))
(kill-buffer (current-buffer))
(set-buffer mail-buffer)))))
(customize-save-variable 'sendmail-query-once-function function)))
(funcall sendmail-query-once-function))
;;;###autoload
(defcustom mail-header-separator (purecopy "--text follows this line--")
"Line used to separate headers from text in messages being composed."
@ -543,6 +498,51 @@ by Emacs.)")
"Additional expressions to highlight in Mail mode.")
;;;###autoload
(defun sendmail-query-once ()
"Query for `send-mail-function' and send mail with it.
This also saves the value of `send-mail-function' via Customize."
(let* ((mail-buffer (current-buffer))
;; Compute default mail sender, preferring smtpmail if it's
;; already configured.
(default (cond
((and (boundp 'smtpmail-smtp-server)
smtpmail-smtp-server)
'smtpmail-send-it)
((or (and window-system (eq system-type 'darwin))
(eq system-type 'windows-nt))
'mailclient-send-it)
((and sendmail-program
(executable-find sendmail-program))
'sendmail-send-it)))
(send-function (if (eq default 'smtpmail-send-it)
'smtpmail-send-it)))
(unless send-function
;; Query the user.
(with-temp-buffer
(rename-buffer "*Mail Help*" t)
(erase-buffer)
(insert "Emacs has not been set up for sending mail.\n
Type `y' to configure and use Emacs as a mail client,
or `n' to use your system's default mailer.\n
To change your decision later, customize `send-mail-function'.\n")
(goto-char (point-min))
(display-buffer (current-buffer))
(if (y-or-n-p "Set up Emacs for sending SMTP mail? ")
;; FIXME: We should check and correct the From: field too.
(setq send-function 'smtpmail-send-it)
(setq send-function default))))
(when send-function
(customize-save-variable 'send-mail-function send-function)
;; HACK: Message mode stupidly has `message-send-mail-function',
;; so we must update it too or sending again in the current
;; Emacs session will still call `sendmail-query-once'.
(and (boundp 'message-send-mail-function)
(eq message-send-mail-function 'sendmail-query-once)
(customize-set-variable 'message-send-mail-function
send-function))
(funcall send-function))))
(defun sendmail-sync-aliases ()
(when mail-personal-alias-file
(let ((modtime (nth 5 (file-attributes mail-personal-alias-file))))

View File

@ -490,7 +490,7 @@ The list is in preference order.")
(let* ((mechs (cdr-safe (assoc 'auth supported-extensions)))
(mech (car (smtpmail-intersection mechs smtpmail-auth-supported)))
(auth-source-creation-prompts
'((user . "SMTP user at %h: ")
'((user . "SMTP user name for %h: ")
(secret . "SMTP password for %u@%h: ")))
(auth-info (car
(auth-source-search

View File

@ -1076,12 +1076,15 @@ It also eliminates runs of equal strings."
(column 0)
(rows (/ (length strings) columns))
(row 0)
(first t)
(laststring nil))
;; The insertion should be "sensible" no matter what choices were made
;; for the parameters above.
(dolist (str strings)
(unless (equal laststring str) ; Remove (consecutive) duplicates.
(setq laststring str)
;; FIXME: `string-width' doesn't pay attention to
;; `display' properties.
(let ((length (if (consp str)
(+ (string-width (car str))
(string-width (cadr str)))
@ -1100,11 +1103,11 @@ It also eliminates runs of equal strings."
(forward-line 1)
(end-of-line)))
(insert " \t")
(set-text-properties (- (point) 1) (point)
(set-text-properties (1- (point)) (point)
`(display (space :align-to ,column)))))
(t
;; Horizontal format
(unless (bolp)
(unless first
(if (< wwidth (+ (max colwidth length) column))
;; No space for `str' at point, move to next line.
(progn (insert "\n") (setq column 0))
@ -1112,12 +1115,13 @@ It also eliminates runs of equal strings."
;; Leave the space unpropertized so that in the case we're
;; already past the goal column, there is still
;; a space displayed.
(set-text-properties (- (point) 1) (point)
(set-text-properties (1- (point)) (point)
;; We can't just set tab-width, because
;; completion-setup-function will kill
;; all local variables :-(
`(display (space :align-to ,column)))
nil))))
(setq first nil)
(if (not (consp str))
(put-text-property (point) (progn (insert str) (point))
'mouse-face 'highlight)

View File

@ -1556,18 +1556,16 @@ record activity."
;; keep window on bottom line if it was already there
(when rcirc-scroll-show-maximum-output
(walk-windows (lambda (w)
(when (eq (window-buffer w) (current-buffer))
(with-current-buffer (window-buffer w)
(when (eq major-mode 'rcirc-mode)
(with-selected-window w
(when (<= (- (window-height)
(count-screen-lines (window-point)
(window-start))
1)
0)
(recenter -1)))))))
nil t))
(let ((window (get-buffer-window)))
(when window
(with-selected-window window
(when (eq major-mode 'rcirc-mode)
(when (<= (- (window-height)
(count-screen-lines (window-point)
(window-start))
1)
0)
(recenter -1)))))))
;; flush undo (can we do something smarter here?)
(buffer-disable-undo)

View File

@ -28,7 +28,6 @@
(eval-when-compile (require 'cl)) ; ignore-errors
(require 'tramp)
(require 'shell)
;; Pacify byte-compiler. The function is needed on XEmacs only. I'm
;; not sure at all that this is the right way to do it, but let's hope
@ -91,7 +90,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
'("rcp"
(tramp-login-program "rsh")
(tramp-login-args (("%h") ("-l" "%u")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "rcp")
(tramp-copy-args (("-p" "%k") ("-r")))
(tramp-copy-keep-date t)
@ -101,7 +101,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
'("remcp"
(tramp-login-program "remsh")
(tramp-login-args (("%h") ("-l" "%u")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "rcp")
(tramp-copy-args (("-p" "%k")))
(tramp-copy-keep-date t)))
@ -111,7 +112,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
(tramp-login-program "ssh")
(tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "scp")
(tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r")))
(tramp-copy-keep-date t)
@ -127,7 +129,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
(tramp-login-args (("-l" "%u") ("-p" "%p")
("-1") ("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "scp")
(tramp-copy-args (("-1") ("-P" "%p") ("-p" "%k") ("-q") ("-r")))
(tramp-copy-keep-date t)
@ -143,7 +146,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
(tramp-login-args (("-l" "%u") ("-p" "%p")
("-2") ("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "scp")
(tramp-copy-args (("-2") ("-P" "%p") ("-p" "%k") ("-q") ("-r")))
(tramp-copy-keep-date t)
@ -161,7 +165,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
("-o" "ControlMaster=yes")
("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "scp")
(tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r")
("-o" "ControlPath=%t.%%r@%%h:%%p")
@ -180,7 +185,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
("-e" "none") ("-t" "-t")
("%h") ("/bin/sh")))
(tramp-async-args (("-q")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "scp")
(tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r")))
(tramp-copy-keep-date t)
@ -195,7 +201,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
(tramp-login-program "ssh")
(tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "sftp")))
;;;###tramp-autoload
(add-to-list 'tramp-methods
@ -203,7 +210,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
(tramp-login-program "ssh")
(tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "rsync")
(tramp-copy-args (("-e" "ssh") ("-t" "%k") ("-r")))
(tramp-copy-keep-date t)
@ -218,7 +226,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
("-o" "ControlMaster=yes")
("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "rsync")
(tramp-copy-args (("-t" "%k") ("-r")))
(tramp-copy-env (("RSYNC_RSH")
@ -234,20 +243,23 @@ detected as prompt when being sent on echoing hosts, therefore.")
'("rsh"
(tramp-login-program "rsh")
(tramp-login-args (("%h") ("-l" "%u")))
(tramp-remote-sh "/bin/sh")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))))
;;;###tramp-autoload
(add-to-list 'tramp-methods
'("remsh"
(tramp-login-program "remsh")
(tramp-login-args (("%h") ("-l" "%u")))
(tramp-remote-sh "/bin/sh")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))))
;;;###tramp-autoload
(add-to-list 'tramp-methods
'("ssh"
(tramp-login-program "ssh")
(tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
("-o" "UserKnownHostsFile=/dev/null")
("-o" "StrictHostKeyChecking=no")))
@ -259,7 +271,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
(tramp-login-args (("-l" "%u") ("-p" "%p")
("-1") ("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
("-o" "UserKnownHostsFile=/dev/null")
("-o" "StrictHostKeyChecking=no")))
@ -271,7 +284,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
(tramp-login-args (("-l" "%u") ("-p" "%p")
("-2") ("-e" "none") ("%h")))
(tramp-async-args (("-q")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
("-o" "UserKnownHostsFile=/dev/null")
("-o" "StrictHostKeyChecking=no")))
@ -284,7 +298,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
("-e" "none") ("-t" "-t")
("%h") ("/bin/sh")))
(tramp-async-args (("-q")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
("-o" "UserKnownHostsFile=/dev/null")
("-o" "StrictHostKeyChecking=no")))
@ -294,38 +309,44 @@ detected as prompt when being sent on echoing hosts, therefore.")
'("telnet"
(tramp-login-program "telnet")
(tramp-login-args (("%h") ("%p")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-default-port 23)))
;;;###tramp-autoload
(add-to-list 'tramp-methods
'("su"
(tramp-login-program "su")
(tramp-login-args (("-") ("%u")))
(tramp-remote-sh "/bin/sh")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))))
;;;###tramp-autoload
(add-to-list 'tramp-methods
'("sudo"
(tramp-login-program "sudo")
(tramp-login-args (("-u" "%u") ("-s") ("-H") ("-p" "Password:")))
(tramp-remote-sh "/bin/sh")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))))
;;;###tramp-autoload
(add-to-list 'tramp-methods
'("ksu"
(tramp-login-program "ksu")
(tramp-login-args (("%u") ("-q")))
(tramp-remote-sh "/bin/sh")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))))
;;;###tramp-autoload
(add-to-list 'tramp-methods
'("krlogin"
(tramp-login-program "krlogin")
(tramp-login-args (("%h") ("-l" "%u") ("-x")))
(tramp-remote-sh "/bin/sh")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))))
;;;###tramp-autoload
(add-to-list 'tramp-methods
'("plink"
(tramp-login-program "plink")
(tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%h")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-password-end-of-line "xy") ;see docstring for "xy"
(tramp-default-port 22)))
;;;###tramp-autoload
@ -333,7 +354,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
'("plink1"
(tramp-login-program "plink")
(tramp-login-args (("-l" "%u") ("-P" "%p") ("-1" "-ssh") ("%h")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-password-end-of-line "xy") ;see docstring for "xy"
(tramp-default-port 22)))
;;;###tramp-autoload
@ -348,13 +370,15 @@ detected as prompt when being sent on echoing hosts, therefore.")
tramp-terminal-type
tramp-initial-end-of-output))
("/bin/sh")))
(tramp-remote-sh "/bin/sh")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))))
;;;###tramp-autoload
(add-to-list 'tramp-methods
'("pscp"
(tramp-login-program "plink")
(tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%h")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "pscp")
(tramp-copy-args (("-P" "%p") ("-scp") ("-p" "%k")
("-q") ("-r")))
@ -367,7 +391,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
'("psftp"
(tramp-login-program "plink")
(tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%h")))
(tramp-remote-sh "/bin/sh")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "pscp")
(tramp-copy-args (("-P" "%p") ("-sftp") ("-p" "%k")
("-q") ("-r")))
@ -379,7 +404,8 @@ detected as prompt when being sent on echoing hosts, therefore.")
'("fcp"
(tramp-login-program "fsh")
(tramp-login-args (("%h") ("-l" "%u") ("sh" "-i")))
(tramp-remote-sh "/bin/sh -i")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-i") ("-c"))
(tramp-copy-program "fcp")
(tramp-copy-args (("-p" "%k")))
(tramp-copy-keep-date t)))
@ -942,7 +968,7 @@ This is used to map a mode number to a permission string.")
(executable-find . tramp-sh-handle-executable-find)
(start-file-process . tramp-sh-handle-start-file-process)
(process-file . tramp-sh-handle-process-file)
(shell-command . tramp-sh-handle-shell-command)
(shell-command . tramp-handle-shell-command)
(insert-directory . tramp-sh-handle-insert-directory)
(expand-file-name . tramp-sh-handle-expand-file-name)
(substitute-in-file-name . tramp-handle-substitute-in-file-name)
@ -2853,7 +2879,7 @@ the result will be a local, non-Tramp, filename."
;; `process-file-side-effects' has been introduced with GNU
;; Emacs 23.2. If set to `nil', no remote file will be changed
;; by `program'. If it doesn't exist, we assume its default
;; value 't'.
;; value `t'.
(unless (and (boundp 'process-file-side-effects)
(not (symbol-value 'process-file-side-effects)))
(tramp-flush-directory-property v ""))
@ -2873,87 +2899,6 @@ the result will be a local, non-Tramp, filename."
(apply 'call-process program tmpfile buffer display args)
(delete-file tmpfile))))
(defun tramp-sh-handle-shell-command
(command &optional output-buffer error-buffer)
"Like `shell-command' for Tramp files."
(let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command))
;; We cannot use `shell-file-name' and `shell-command-switch',
;; they are variables of the local host.
(args (list
(tramp-get-method-parameter
(tramp-file-name-method
(tramp-dissect-file-name default-directory))
'tramp-remote-sh)
"-c" (substring command 0 asynchronous)))
current-buffer-p
(output-buffer
(cond
((bufferp output-buffer) output-buffer)
((stringp output-buffer) (get-buffer-create output-buffer))
(output-buffer
(setq current-buffer-p t)
(current-buffer))
(t (get-buffer-create
(if asynchronous
"*Async Shell Command*"
"*Shell Command Output*")))))
(error-buffer
(cond
((bufferp error-buffer) error-buffer)
((stringp error-buffer) (get-buffer-create error-buffer))))
(buffer
(if (and (not asynchronous) error-buffer)
(with-parsed-tramp-file-name default-directory nil
(list output-buffer (tramp-make-tramp-temp-file v)))
output-buffer))
(p (get-buffer-process output-buffer)))
;; Check whether there is another process running. Tramp does not
;; support 2 (asynchronous) processes in parallel.
(when p
(if (yes-or-no-p "A command is running. Kill it? ")
(ignore-errors (kill-process p))
(error "Shell command in progress")))
(if current-buffer-p
(progn
(barf-if-buffer-read-only)
(push-mark nil t))
(with-current-buffer output-buffer
(setq buffer-read-only nil)
(erase-buffer)))
(if (and (not current-buffer-p) (integerp asynchronous))
(prog1
;; Run the process.
(apply 'start-file-process "*Async Shell*" buffer args)
;; Display output.
(pop-to-buffer output-buffer)
(setq mode-line-process '(":%s"))
(shell-mode))
(prog1
;; Run the process.
(apply 'process-file (car args) nil buffer nil (cdr args))
;; Insert error messages if they were separated.
(when (listp buffer)
(with-current-buffer error-buffer
(insert-file-contents (cadr buffer)))
(delete-file (cadr buffer)))
(if current-buffer-p
;; This is like exchange-point-and-mark, but doesn't
;; activate the mark. It is cleaner to avoid activation,
;; even though the command loop would deactivate the mark
;; because we inserted text.
(goto-char (prog1 (mark t)
(set-marker (mark-marker) (point)
(current-buffer))))
;; There's some output, display it.
(when (with-current-buffer output-buffer (> (point-max) (point-min)))
(if (functionp 'display-message-or-buffer)
(tramp-compat-funcall 'display-message-or-buffer output-buffer)
(pop-to-buffer output-buffer))))))))
(defun tramp-sh-handle-file-local-copy (filename)
"Like `file-local-copy' for Tramp files."
(with-parsed-tramp-file-name filename nil
@ -3680,7 +3625,7 @@ file exists and nonzero exit status otherwise."
(tramp-set-connection-property
vec "remote-shell"
(tramp-get-method-parameter
(tramp-file-name-method vec) 'tramp-remote-sh)))))))))
(tramp-file-name-method vec) 'tramp-remote-shell)))))))))
;; Utility functions.
@ -3716,7 +3661,8 @@ process to set up. VEC specifies the connection."
;; discarded as well.
(tramp-open-shell
vec
(tramp-get-method-parameter (tramp-file-name-method vec) 'tramp-remote-sh))
(tramp-get-method-parameter
(tramp-file-name-method vec) 'tramp-remote-shell))
;; Disable echo.
(tramp-message vec 5 "Setting up remote shell environment")

View File

@ -58,6 +58,7 @@
;;; Code:
(require 'tramp-compat)
(require 'shell)
;;; User Customizable Internal Variables:
@ -190,13 +191,16 @@ See the variable `tramp-encoding-shell' for more information."
This is a list of entries of the form (NAME PARAM1 PARAM2 ...).
Each NAME stands for a remote access method. Each PARAM is a
pair of the form (KEY VALUE). The following KEYs are defined:
* `tramp-remote-sh'
* `tramp-remote-shell'
This specifies the Bourne shell to use on the remote host. This
MUST be a Bourne-like shell. It is normally not necessary to set
this to any value other than \"/bin/sh\": Tramp wants to use a shell
which groks tilde expansion, but it can search for it. Also note
that \"/bin/sh\" exists on all Unixen, this might not be true for
the value that you decide to use. You Have Been Warned.
* `tramp-remote-shell-args'
For implementation of `shell-command', this specifies the
argument to let `tramp-remote-shell' run a command.
* `tramp-login-program'
This specifies the name of the program to use for logging in to the
remote host. This may be the name of rsh or a workalike program,
@ -2959,6 +2963,92 @@ User is always nil."
(delete-file local-copy)))))
t)))
(defun tramp-handle-shell-command
(command &optional output-buffer error-buffer)
"Like `shell-command' for Tramp files."
(let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command))
;; We cannot use `shell-file-name' and `shell-command-switch',
;; they are variables of the local host.
(args (append
(cons
(tramp-get-method-parameter
(tramp-file-name-method
(tramp-dissect-file-name default-directory))
'tramp-remote-shell)
(tramp-get-method-parameter
(tramp-file-name-method
(tramp-dissect-file-name default-directory))
'tramp-remote-shell-args))
(list (substring command 0 asynchronous))))
current-buffer-p
(output-buffer
(cond
((bufferp output-buffer) output-buffer)
((stringp output-buffer) (get-buffer-create output-buffer))
(output-buffer
(setq current-buffer-p t)
(current-buffer))
(t (get-buffer-create
(if asynchronous
"*Async Shell Command*"
"*Shell Command Output*")))))
(error-buffer
(cond
((bufferp error-buffer) error-buffer)
((stringp error-buffer) (get-buffer-create error-buffer))))
(buffer
(if (and (not asynchronous) error-buffer)
(with-parsed-tramp-file-name default-directory nil
(list output-buffer (tramp-make-tramp-temp-file v)))
output-buffer))
(p (get-buffer-process output-buffer)))
;; Check whether there is another process running. Tramp does not
;; support 2 (asynchronous) processes in parallel.
(when p
(if (yes-or-no-p "A command is running. Kill it? ")
(ignore-errors (kill-process p))
(error "Shell command in progress")))
(if current-buffer-p
(progn
(barf-if-buffer-read-only)
(push-mark nil t))
(with-current-buffer output-buffer
(setq buffer-read-only nil)
(erase-buffer)))
(if (and (not current-buffer-p) (integerp asynchronous))
(prog1
;; Run the process.
(apply 'start-file-process "*Async Shell*" buffer args)
;; Display output.
(pop-to-buffer output-buffer)
(setq mode-line-process '(":%s"))
(shell-mode))
(prog1
;; Run the process.
(apply 'process-file (car args) nil buffer nil (cdr args))
;; Insert error messages if they were separated.
(when (listp buffer)
(with-current-buffer error-buffer
(insert-file-contents (cadr buffer)))
(delete-file (cadr buffer)))
(if current-buffer-p
;; This is like exchange-point-and-mark, but doesn't
;; activate the mark. It is cleaner to avoid activation,
;; even though the command loop would deactivate the mark
;; because we inserted text.
(goto-char (prog1 (mark t)
(set-marker (mark-marker) (point)
(current-buffer))))
;; There's some output, display it.
(when (with-current-buffer output-buffer (> (point-max) (point-min)))
(if (functionp 'display-message-or-buffer)
(tramp-compat-funcall 'display-message-or-buffer output-buffer)
(pop-to-buffer output-buffer))))))))
(defun tramp-handle-substitute-in-file-name (filename)
"Like `substitute-in-file-name' for Tramp files.
\"//\" and \"/~\" substitute only in the local filename part.
@ -3477,7 +3567,7 @@ Return the local name of the temporary file."
(ignore-errors (delete-file tramp-temp-buffer-file-name))))
(add-hook 'kill-buffer-hook 'tramp-delete-temp-file-function)
(add-hook 'tramp-cache-unload-hook
(add-hook 'tramp-unload-hook
(lambda ()
(remove-hook 'kill-buffer-hook
'tramp-delete-temp-file-function)))

View File

@ -1,3 +1,29 @@
2011-09-02 Chong Yidong <cyd@stupidchicken.com>
* org-compat.el (org-pop-to-buffer-same-window): Deleted.
* ob-ref.el (org-babel-ref-goto-headline-id):
* org.el (org-get-location, org-tree-to-indirect-buffer)
(org-mark-ring-goto, org-refile, org-add-log-note)
(org-revert-all-org-buffers, org-switchb)
(org-cycle-agenda-files, org-submit-bug-report)
(org-goto-marker-or-bmk):
* org-agenda.el (org-prepare-agenda, org-agenda-switch-to):
* org-capture.el (org-capture-goto-target)
(org-capture-fill-template):
* org-clock.el (org-clock-goto):
* org-ctags.el (org-ctags-visit-buffer-or-file):
* org-exp.el (org-export-as-org):
* org-feed.el (org-feed-show-raw-feed):
* org-html.el (org-export-htmlize-generate-css):
* org-id.el (org-id-goto):
* org-irc.el (org-irc-visit-erc):
* org-mobile.el (org-mobile-apply):
* org-publish.el (org-publish-org-to, org-publish-find-date):
* org-remember.el (org-go-to-remember-target):
* org-src.el (org-src-switch-to-buffer)
(org-edit-fixed-width-region): Use switch-to-buffer.
2011-08-31 Martin Rudalics <rudalics@gmx.at>
* org-compat.el (org-pop-to-buffer-same-window): Remove LABEL

View File

@ -61,8 +61,6 @@
(declare-function org-narrow-to-subtree "org" ())
(declare-function org-id-find-id-in-file "org-id" (id file &optional markerp))
(declare-function org-show-context "org" (&optional key))
(declare-function org-pop-to-buffer-same-window
"org-compat" (&optional buffer-or-name norecord label))
(defvar org-babel-ref-split-regexp
"[ \f\t\n\r\v]*\\(.+?\\)[ \f\t\n\r\v]*=[ \f\t\n\r\v]*\\(.+\\)[ \f\t\n\r\v]*")
@ -96,7 +94,7 @@ the variable."
(m (when file (org-id-find-id-in-file id file 'marker))))
(when (and file m)
(message "file:%S" file)
(org-pop-to-buffer-same-window (marker-buffer m))
(switch-to-buffer (marker-buffer m))
(goto-char m)
(move-marker m nil)
(org-show-context)

View File

@ -60,8 +60,6 @@
(declare-function org-is-habit-p "org-habit" (&optional pom))
(declare-function org-habit-parse-todo "org-habit" (&optional pom))
(declare-function org-habit-get-priority "org-habit" (habit &optional moment))
(declare-function org-pop-to-buffer-same-window "org-compat"
(&optional buffer-or-name norecord label))
(defvar calendar-mode-map)
(defvar org-clock-current-task) ; defined in org-clock.el
@ -3067,7 +3065,7 @@ the global options and expect it to be applied to the entire view.")
(awin (select-window awin))
((not (setq org-pre-agenda-window-conf (current-window-configuration))))
((equal org-agenda-window-setup 'current-window)
(org-pop-to-buffer-same-window abuf))
(switch-to-buffer abuf))
((equal org-agenda-window-setup 'other-window)
(org-switch-to-buffer-other-window abuf))
((equal org-agenda-window-setup 'other-frame)
@ -3078,7 +3076,7 @@ the global options and expect it to be applied to the entire view.")
;; additional test in case agenda is invoked from within agenda
;; buffer via elisp link
(unless (equal (current-buffer) abuf)
(org-pop-to-buffer-same-window abuf)))
(switch-to-buffer abuf)))
(setq buffer-read-only nil)
(let ((inhibit-read-only t)) (erase-buffer))
(org-agenda-mode)
@ -6972,7 +6970,7 @@ at the text of the entry itself."
(org-agenda-error)))
(buffer (marker-buffer marker))
(pos (marker-position marker)))
(org-pop-to-buffer-same-window buffer)
(switch-to-buffer buffer)
(and delete-other-windows (delete-other-windows))
(widen)
(goto-char pos)

View File

@ -57,8 +57,6 @@
(date &optional keep-restriction))
(declare-function org-table-get-specials "org-table" ())
(declare-function org-table-goto-line "org-table" (N))
(declare-function org-pop-to-buffer-same-window "org-compat"
(&optional buffer-or-name norecord label))
(defvar org-remember-default-headline)
(defvar org-remember-templates)
@ -1201,7 +1199,7 @@ The user is queried for the template."
(error "No capture template selected"))
(org-capture-set-plist entry)
(org-capture-set-target-location)
(org-pop-to-buffer-same-window (org-capture-get :buffer))
(switch-to-buffer (org-capture-get :buffer))
(goto-char (org-capture-get :pos))))
(defun org-capture-get-indirect-buffer (&optional buffer prefix)
@ -1311,7 +1309,7 @@ The template may still contain \"%?\" for cursor positioning."
(sit-for 1))
(save-window-excursion
(delete-other-windows)
(org-pop-to-buffer-same-window (get-buffer-create "*Capture*"))
(switch-to-buffer (get-buffer-create "*Capture*"))
(erase-buffer)
(insert template)
(goto-char (point-min))

View File

@ -36,7 +36,6 @@
(declare-function calendar-absolute-from-iso "cal-iso" (&optional date))
(declare-function notifications-notify "notifications" (&rest params))
(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label))
(defvar org-time-stamp-formats)
(defvar org-ts-what)
@ -1498,7 +1497,7 @@ With prefix arg SELECT, offer recently clocked tasks for selection."
(setq recent t)
(car org-clock-history))
(t (error "No active or recent clock task")))))
(org-pop-to-buffer-same-window (marker-buffer m))
(switch-to-buffer (marker-buffer m))
(if (or (< m (point-min)) (> m (point-max))) (widen))
(goto-char m)
(org-show-entry)

View File

@ -432,15 +432,6 @@ With two arguments, return floor and remainder of their quotient."
(let ((q (floor x y)))
(list q (- x (if y (* y q) q)))))
;; `pop-to-buffer-same-window' has been introduced with Emacs 24.1.
(defun org-pop-to-buffer-same-window
(&optional buffer-or-name norecord label)
"Pop to buffer specified by BUFFER-OR-NAME in the selected window."
(if (fboundp 'pop-to-buffer-same-window)
(funcall
'pop-to-buffer-same-window buffer-or-name norecord)
(funcall 'switch-to-buffer buffer-or-name norecord)))
(provide 'org-compat)

View File

@ -140,8 +140,6 @@
(require 'org)
(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label))
(defgroup org-ctags nil
"Options concerning use of ctags within org mode."
:tag "Org-Ctags"
@ -387,7 +385,7 @@ the new file."
(cond
((get-buffer (concat name ".org"))
;; Buffer is already open
(org-pop-to-buffer-same-window (get-buffer (concat name ".org"))))
(switch-to-buffer (get-buffer (concat name ".org"))))
((file-exists-p filename)
;; File exists but is not open --> open it
(message "Opening existing org file `%S'..."

View File

@ -47,8 +47,6 @@
(declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
(declare-function org-table-cookie-line-p "org-table" (line))
(declare-function org-table-colgroup-line-p "org-table" (line))
(declare-function org-pop-to-buffer-same-window "org-compat"
(&optional buffer-or-name norecord label))
(autoload 'org-export-generic "org-export-generic" "Export using the generic exporter" t)
@ -2974,7 +2972,7 @@ directory."
(region (buffer-string))
str-ret)
(save-excursion
(org-pop-to-buffer-same-window buffer)
(switch-to-buffer buffer)
(erase-buffer)
(insert region)
(let ((org-inhibit-startup t)) (org-mode))

View File

@ -436,7 +436,7 @@ it can be a list structured like an entry in `org-feed-alist'."
(if (stringp feed) (setq feed (assoc feed org-feed-alist)))
(unless feed
(error "No such feed in `org-feed-alist"))
(org-pop-to-buffer-same-window
(switch-to-buffer
(org-feed-update feed 'retrieve-only))
(goto-char (point-min)))

View File

@ -34,8 +34,6 @@
(declare-function org-id-find-id-file "org-id" (id))
(declare-function htmlize-region "ext:htmlize" (beg end))
(declare-function org-pop-to-buffer-same-window
"org-compat" (&optional buffer-or-name norecord label))
(defgroup org-export-html nil
"Options specific for HTML export of Org-mode files."
@ -2265,7 +2263,7 @@ that uses these same face definitions."
(when (and (symbolp f) (or (not i) (not (listp i))))
(insert (org-add-props (copy-sequence "1") nil 'face f))))
(htmlize-region (point-min) (point-max))))
(org-pop-to-buffer-same-window "*html*")
(switch-to-buffer "*html*")
(goto-char (point-min))
(if (re-search-forward "<style" nil t)
(delete-region (point-min) (match-beginning 0)))

View File

@ -74,8 +74,6 @@
(require 'org)
(declare-function message-make-fqdn "message" ())
(declare-function org-pop-to-buffer-same-window
"org-compat" (&optional buffer-or-name norecord label))
;;; Customization
@ -255,7 +253,7 @@ Move the cursor to that entry in that buffer."
(let ((m (org-id-find id 'marker)))
(unless m
(error "Cannot find entry with ID \"%s\"" id))
(org-pop-to-buffer-same-window (marker-buffer m))
(switch-to-buffer (marker-buffer m))
(goto-char m)
(move-marker m nil)
(org-show-context)))

View File

@ -60,8 +60,6 @@
(declare-function erc-server-buffer "erc" ())
(declare-function erc-get-server-nickname-list "erc" ())
(declare-function erc-cmd-JOIN "erc" (channel &optional key))
(declare-function org-pop-to-buffer-same-window
"org-compat" (&optional buffer-or-name norecord label))
(defvar org-irc-client 'erc
"The IRC client to act on.")
@ -234,7 +232,7 @@ default."
(throw 'found x))))))
(if chan-buf
(progn
(org-pop-to-buffer-same-window chan-buf)
(switch-to-buffer chan-buf)
;; if we got a nick, and they're in the chan,
;; then start a chat with them
(let ((nick (pop link)))
@ -245,9 +243,9 @@ default."
(insert (concat nick ": ")))
(error "%s not found in %s" nick chan-name)))))
(progn
(org-pop-to-buffer-same-window server-buffer)
(switch-to-buffer server-buffer)
(erc-cmd-JOIN chan-name))))
(org-pop-to-buffer-same-window server-buffer)))
(switch-to-buffer server-buffer)))
;; no server match, make new connection
(erc-select :server server :port port))))

View File

@ -38,9 +38,6 @@
(eval-when-compile (require 'cl))
(declare-function org-pop-to-buffer-same-window
"org-compat" (&optional buffer-or-name norecord label))
(defgroup org-mobile nil
"Options concerning support for a viewer/editor on a mobile device."
:tag "Org Mobile"
@ -912,7 +909,7 @@ If BEG and END are given, only do this in that region."
(buffer-file-name (current-buffer))))))
(error (setq org-mobile-error msg))))
(when org-mobile-error
(org-pop-to-buffer-same-window (marker-buffer marker))
(switch-to-buffer (marker-buffer marker))
(goto-char marker)
(incf cnt-error)
(insert (if (stringp (nth 1 org-mobile-error))

View File

@ -369,8 +369,6 @@ This is a compatibility function for Emacsen without `delete-dups'."
(declare-function org-publish-delete-dups "org-publish" (list))
(declare-function find-lisp-find-files "find-lisp" (directory regexp))
(declare-function org-pop-to-buffer-same-window
"org-compat" (&optional buffer-or-name norecord label))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Getting project information out of org-publish-project-alist
@ -561,7 +559,7 @@ PUB-DIR is the publishing directory."
(make-directory pub-dir t))
(let ((visiting (find-buffer-visiting filename)))
(save-excursion
(org-pop-to-buffer-same-window (or visiting (find-file filename)))
(switch-to-buffer (or visiting (find-file filename)))
(let* ((plist (cons :buffer-will-be-killed (cons t plist)))
(init-buf (current-buffer))
(init-point (point))
@ -862,7 +860,7 @@ system's modification time.
It returns time in `current-time' format."
(let ((visiting (find-buffer-visiting file)))
(save-excursion
(org-pop-to-buffer-same-window (or visiting (find-file-noselect file nil t)))
(switch-to-buffer (or visiting (find-file-noselect file nil t)))
(let* ((plist (org-infile-export-plist))
(date (plist-get plist :date)))
(unless visiting

View File

@ -40,8 +40,6 @@
(declare-function remember "remember" (&optional initial))
(declare-function remember-buffer-desc "remember" ())
(declare-function remember-finalize "remember" ())
(declare-function org-pop-to-buffer-same-window
"org-compat" (&optional buffer-or-name norecord label))
(defvar remember-save-after-remembering)
(defvar remember-register)
@ -788,7 +786,7 @@ The user is queried for the template."
(setq heading org-remember-default-headline))
(setq visiting (org-find-base-buffer-visiting file))
(if (not visiting) (find-file-noselect file))
(org-pop-to-buffer-same-window (or visiting (get-file-buffer file)))
(switch-to-buffer (or visiting (get-file-buffer file)))
(widen)
(goto-char (point-min))
(if (re-search-forward

View File

@ -42,8 +42,6 @@
(declare-function org-at-table.el-p "org" ())
(declare-function org-get-indentation "org" (&optional line))
(declare-function org-switch-to-buffer-other-window "org" (&rest args))
(declare-function org-pop-to-buffer-same-window
"org-compat" (&optional buffer-or-name norecord label))
(defcustom org-edit-src-region-extra nil
"Additional regexps to identify regions for editing with `org-edit-src-code'.
@ -341,7 +339,7 @@ buffer."
(defun org-src-switch-to-buffer (buffer context)
(case org-src-window-setup
('current-window
(org-pop-to-buffer-same-window buffer))
(switch-to-buffer buffer))
('other-window
(switch-to-buffer-other-window buffer))
('other-frame
@ -352,7 +350,7 @@ buffer."
(delete-frame frame)))
('save
(kill-buffer (current-buffer))
(org-pop-to-buffer-same-window buffer))
(switch-to-buffer buffer))
(t
(switch-to-buffer-other-frame buffer))))
('reorganize-frame
@ -364,7 +362,7 @@ buffer."
(t
(message "Invalid value %s for org-src-window-setup"
(symbol-name org-src-window-setup))
(org-pop-to-buffer-same-window buffer))))
(switch-to-buffer buffer))))
(defun org-src-construct-edit-buffer-name (org-buffer-name lang)
"Construct the buffer name for a source editing buffer."
@ -424,7 +422,7 @@ the fragment in the Org-mode buffer."
begline (save-excursion (goto-char beg) (org-current-line)))
(if (and (setq buffer (org-edit-src-find-buffer beg end))
(y-or-n-p "Return to existing edit buffer? [n] will revert changes: "))
(org-pop-to-buffer-same-window buffer)
(switch-to-buffer buffer)
(when buffer
(with-current-buffer buffer
(if (boundp 'org-edit-src-overlay)
@ -444,7 +442,7 @@ the fragment in the Org-mode buffer."
(define-key map [mouse-1] 'org-edit-src-continue)
map))
(overlay-put ovl :read-only "Leave me alone")
(org-pop-to-buffer-same-window buffer)
(switch-to-buffer buffer)
(insert code)
(remove-text-properties (point-min) (point-max)
'(display nil invisible nil intangible nil))

View File

@ -105,7 +105,6 @@
(declare-function org-inlinetask-at-task-p "org-inlinetask" ())
(declare-function org-inlinetask-outline-regexp "org-inlinetask" ())
(declare-function org-inlinetask-toggle-visibility "org-inlinetask" ())
(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label))
(declare-function org-at-clock-log-p "org-clock" ())
(declare-function org-clock-timestamps-up "org-clock" ())
(declare-function org-clock-timestamps-down "org-clock" ())
@ -6651,7 +6650,7 @@ or nil."
(save-window-excursion
(delete-other-windows)
(and (get-buffer "*org-goto*") (kill-buffer "*org-goto*"))
(org-pop-to-buffer-same-window
(switch-to-buffer
(condition-case nil
(make-indirect-buffer (current-buffer) "*org-goto*")
(error (make-indirect-buffer (current-buffer) "*org-goto*"))))
@ -6789,7 +6788,7 @@ frame is not changed."
(and arg (eq org-indirect-buffer-display 'dedicated-frame)))
(select-frame (make-frame))
(delete-other-windows)
(org-pop-to-buffer-same-window ibuf)
(switch-to-buffer ibuf)
(org-set-frame-title heading))
((eq org-indirect-buffer-display 'dedicated-frame)
(raise-frame
@ -6798,10 +6797,10 @@ frame is not changed."
org-indirect-dedicated-frame)
(setq org-indirect-dedicated-frame (make-frame)))))
(delete-other-windows)
(org-pop-to-buffer-same-window ibuf)
(switch-to-buffer ibuf)
(org-set-frame-title (concat "Indirect: " heading)))
((eq org-indirect-buffer-display 'current-window)
(org-pop-to-buffer-same-window ibuf))
(switch-to-buffer ibuf))
((eq org-indirect-buffer-display 'other-window)
(pop-to-buffer ibuf))
(t (error "Invalid value")))
@ -9833,7 +9832,7 @@ onto the ring."
(setq p org-mark-ring))
(setq org-mark-ring-last-goto p)
(setq m (car p))
(org-pop-to-buffer-same-window (marker-buffer m))
(switch-to-buffer (marker-buffer m))
(goto-char m)
(if (or (outline-invisible-p) (org-invisible-p2)) (org-show-context 'mark-goto))))
@ -10429,7 +10428,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(find-file-noselect file)))
(if goto
(progn
(org-pop-to-buffer-same-window nbuf)
(switch-to-buffer nbuf)
(goto-char pos)
(org-show-context 'org-goto))
(if regionp
@ -12041,7 +12040,7 @@ EXTRA is additional text that will be inserted into the notes buffer."
(setq org-log-note-window-configuration (current-window-configuration))
(delete-other-windows)
(move-marker org-log-note-return-to (point))
(org-pop-to-buffer-same-window (marker-buffer org-log-note-marker))
(switch-to-buffer (marker-buffer org-log-note-marker))
(goto-char org-log-note-marker)
(org-switch-to-buffer-other-window "*Org Note*")
(erase-buffer)
@ -15883,7 +15882,7 @@ changes from another. I believe the procedure must be like this:
(lambda (b)
(when (and (with-current-buffer b (org-mode-p))
(with-current-buffer b buffer-file-name))
(org-pop-to-buffer-same-window b)
(switch-to-buffer b)
(revert-buffer t 'no-confirm)))
(buffer-list))
(when (and (featurep 'org-id) org-id-track-globally)
@ -15907,7 +15906,7 @@ Set `org-completion-use-ido' to make it use ido instead."
(org-completion-use-ido org-completion-use-ido))
(unless (or org-completion-use-ido org-completion-use-iswitchb)
(setq org-completion-use-iswitchb t))
(org-pop-to-buffer-same-window
(switch-to-buffer
(org-icompleting-read "Org buffer: "
(mapcar 'list (mapcar 'buffer-name blist))
nil t))))
@ -16074,7 +16073,7 @@ If the current buffer does not, find the first agenda file."
(find-file (car files))
(throw 'exit t))))
(find-file (car fs)))
(if (buffer-base-buffer) (org-pop-to-buffer-same-window (buffer-base-buffer)))))
(if (buffer-base-buffer) (switch-to-buffer (buffer-base-buffer)))))
(defun org-agenda-file-to-front (&optional to-end)
"Move/add the current file to the top of the agenda file list.
@ -18511,7 +18510,7 @@ information about your Org-mode version and configuration."
(org-version)
(let (list)
(save-window-excursion
(org-pop-to-buffer-same-window (get-buffer-create "*Warn about privacy*"))
(switch-to-buffer (get-buffer-create "*Warn about privacy*"))
(delete-other-windows)
(erase-buffer)
(insert "You are about to submit a bug report to the Org-mode mailing list.
@ -18708,7 +18707,7 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
(if (and marker (marker-buffer marker)
(buffer-live-p (marker-buffer marker)))
(progn
(org-pop-to-buffer-same-window (marker-buffer marker))
(switch-to-buffer (marker-buffer marker))
(if (or (> marker (point-max)) (< marker (point-min)))
(widen))
(goto-char marker)

View File

@ -2413,7 +2413,7 @@ and overlay is highlighted between MK and END-MK."
;; display the source in another window.
(let ((pop-up-windows t))
(pop-to-buffer (marker-buffer mk) 'other-window))
(pop-to-buffer-same-window (marker-buffer mk)))
(switch-to-buffer (marker-buffer mk)))
(unless (eq (goto-char mk) (point))
;; If narrowing gets in the way of going to the right place, widen.
(widen)

View File

@ -296,7 +296,7 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)."
:filter (lambda (&rest junk)
(abbrev-table-menu python-mode-abbrev-table)))
"-"
["Start interpreter" python-shell
["Start interpreter" run-python
:help "Run `inferior' Python in separate buffer"]
["Import/reload file" python-load-file
:help "Load into inferior Python session"]
@ -328,14 +328,6 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)."
;; eric has items including: (un)indent, (un)comment, restart script,
;; run script, debug script; also things for profiling, unit testing.
(defvar python-shell-map
(let ((map (copy-keymap comint-mode-map)))
(define-key map [tab] 'tab-to-tab-stop)
(define-key map "\C-c-" 'py-up-exception)
(define-key map "\C-c=" 'py-down-exception)
map)
"Keymap used in *Python* shell buffers.")
(defvar python-mode-syntax-table
(let ((table (make-syntax-table)))
;; Give punctuation syntax to ASCII that normally has symbol
@ -1345,7 +1337,7 @@ local value.")
(define-key map "\C-c\C-l" 'python-load-file)
(define-key map "\C-c\C-v" 'python-check)
;; Note that we _can_ still use these commands which send to the
;; Python process even at the prompt iff we have a normal prompt,
;; Python process even at the prompt if we have a normal prompt,
;; i.e. '>>> ' and not '... '. See the comment before
;; python-send-region. Fixme: uncomment these if we address that.

View File

@ -3060,7 +3060,7 @@ When called interactively, FORCE is t, CURRENT is t if current buffer uses
;; select BibTeX buffer
(if select
(if buffer-list
(pop-to-buffer-same-window
(switch-to-buffer
(completing-read "Switch to BibTeX buffer: "
(mapcar 'buffer-name buffer-list)
nil t

View File

@ -314,7 +314,10 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
(defun vc-rcs-responsible-p (file)
"Return non-nil if RCS thinks it would be responsible for registering FILE."
;; TODO: check for all the patterns in vc-rcs-master-templates
(file-directory-p (expand-file-name "RCS" (file-name-directory file))))
(file-directory-p (expand-file-name "RCS"
(if (file-directory-p file)
file
(file-name-directory file)))))
(defun vc-rcs-receive-file (file rev)
"Implementation of receive-file for RCS."

View File

@ -318,7 +318,7 @@ EXIT-ACTION to `kill-buffer-if-not-modified' avoids this."
(progn
(switch-to-buffer buffer)
(message "Not using View mode because the major mode is special"))
(pop-to-buffer-same-window buffer)
(switch-to-buffer buffer)
(view-mode-enter nil exit-action)))
;;;###autoload
@ -338,7 +338,8 @@ Optional argument EXIT-ACTION is either nil or a function with buffer as
argument. This function is called when finished viewing buffer. Use
this argument instead of explicitly setting `view-exit-action'."
(interactive "bIn other window view buffer:\nP")
(pop-to-buffer-other-window buffer)
(let ((pop-up-windows t))
(pop-to-buffer buffer t))
(view-mode-enter nil exit-action))
;;;###autoload
@ -358,7 +359,8 @@ Optional argument EXIT-ACTION is either nil or a function with buffer as
argument. This function is called when finished viewing buffer. Use
this argument instead of explicitly setting `view-exit-action'."
(interactive "bView buffer in other frame: \nP")
(pop-to-buffer-other-frame buffer)
(let ((pop-up-frames t))
(pop-to-buffer buffer t))
(view-mode-enter nil exit-action))
;;;###autoload

View File

@ -2259,10 +2259,10 @@ and no others."
;;; Deleting windows.
(defcustom frame-auto-delete 'automatic
"If non-nil, quitting a window can delete it's frame.
"If non-nil, quitting a window can delete its frame.
If this variable is nil, functions that quit a window never
delete the associated frame. If this variable equals the symbol
`automatic', a frame is deleted only if it the window is
delete the associated frame. If this variable's value is the
symbol `automatic', a frame is deleted only if the window is
dedicated or was created by `display-buffer'. If this variable
is t, a frame can be always deleted, even if it was created by
`make-frame-command'. Other values should not be used.
@ -2282,8 +2282,8 @@ variable are `switch-to-prev-buffer', `delete-windows-on',
(defun window-deletable-p (&optional window)
"Return t if WINDOW can be safely deleted from its frame.
Return `frame' if deleting WINDOW should delete its frame
instead."
Return `frame' if deleting WINDOW should also delete its
frame."
(setq window (window-normalize-any-window window))
(unless ignore-window-parameters
;; Handle atomicity.
@ -2291,29 +2291,45 @@ instead."
(setq window (window-atom-root window))))
(let ((parent (window-parent window))
(frame (window-frame window))
(buffer (window-buffer window))
(dedicated (and (window-buffer window) (window-dedicated-p window)))
(quit-restore (window-parameter window 'quit-restore)))
(cond
((frame-root-window-p window)
;; Don't delete FRAME if `frame-auto-delete' is nil.
(when (and (or (eq frame-auto-delete t)
(and (eq frame-auto-delete 'automatic)
;; Delete FRAME only if it's either dedicated
;; or quit-restore's car is `new-frame' and
;; WINDOW still displays the same buffer
(or dedicated
(and (eq (car-safe quit-restore) 'new-frame)
(eq (nth 1 quit-restore)
(window-buffer window))))))
;; Don't delete FRAME if we have another buffer in
;; WINDOW's previous buffers. Bug#9419.
(or (not (window-prev-buffers window))
(eq (caar (window-prev-buffers window)) buffer))
;; Don't try to delete FRAME when there are no other
;; visible frames left.
(other-visible-frames-p frame))
;; WINDOW is the root window of its frame. Return `frame' but
;; only if WINDOW is (1) either dedicated or quit-restore's car
;; is new-frame and the window still displays the same buffer
;; and (2) there are other frames left.
'frame))
((and (not ignore-window-parameters)
(eq (window-parameter window 'window-side) 'none)
(or (not parent)
(not (eq (window-parameter parent 'window-side) 'none))))
;; Can't delete last main window.
nil)
(t))))
;; Don't delete WINDOW if we find another buffer in WINDOW's
;; previous buffers.
((and (or (not (window-prev-buffers window))
(eq (caar (window-prev-buffers window)) buffer))
;; Delete WINDOW only if it's dedicated or quit-restore's car
;; is `new-frame' or `new-window' and it still displays the
;; same buffer.
(or dedicated
(and (memq (car-safe quit-restore) '(new-window new-frame))
(eq (nth 1 quit-restore) (window-buffer window))))
;; Don't delete the last main window.
(or ignore-window-parameters
(not (eq (window-parameter window 'window-side) 'none))
(and parent
(eq (window-parameter parent 'window-side) 'none))))
t))))
(defun window-or-subwindow-p (subwindow window)
"Return t if SUBWINDOW is either WINDOW or a subwindow of WINDOW."
@ -4478,155 +4494,6 @@ Return WINDOW."
The actual non-nil value of this variable will be copied to the
`window-dedicated-p' flag.")
(defun display-buffer-default (buffer-or-name &optional not-this-window frame)
"Make buffer BUFFER-OR-NAME appear in some window but don't select it.
BUFFER-OR-NAME must be a buffer or the name of an existing
buffer. Return the window chosen to display BUFFER-OR-NAME or
nil if no such window is found.
Optional argument NOT-THIS-WINDOW non-nil means display the
buffer in a window other than the selected one, even if it is
already displayed in the selected window.
Optional argument FRAME specifies which frames to investigate
when the specified buffer is already displayed. If the buffer is
already displayed in some window on one of these frames simply
return that window. Possible values of FRAME are:
`visible' - consider windows on all visible frames on the current
terminal.
0 - consider windows on all visible or iconified frames on the
current terminal.
t - consider windows on all frames.
A specific frame - consider windows on that frame only.
nil - consider windows on the selected frame \(actually the
last non-minibuffer frame\) only. If, however, either
`display-buffer-reuse-frames' or `pop-up-frames' is non-nil
\(non-nil and not graphic-only on a text-only terminal),
consider all visible or iconified frames on the current terminal."
(interactive "BDisplay buffer:\nP")
(let* ((can-use-selected-window
;; The selected window is usable unless either NOT-THIS-WINDOW
;; is non-nil, it is dedicated to its buffer, or it is the
;; `minibuffer-window'.
(not (or not-this-window
(window-dedicated-p (selected-window))
(window-minibuffer-p))))
(buffer (if (bufferp buffer-or-name)
buffer-or-name
(get-buffer buffer-or-name)))
(name-of-buffer (buffer-name buffer))
;; On text-only terminals do not pop up a new frame when
;; `pop-up-frames' equals graphic-only.
(use-pop-up-frames (if (eq pop-up-frames 'graphic-only)
(display-graphic-p)
pop-up-frames))
;; `frame-to-use' is the frame where to show `buffer' - either
;; the selected frame or the last nonminibuffer frame.
(frame-to-use
(or (window--frame-usable-p (selected-frame))
(window--frame-usable-p (last-nonminibuffer-frame))))
;; `window-to-use' is the window we use for showing `buffer'.
window-to-use popped-up-frame)
(cond
((not (buffer-live-p buffer))
(error "No such buffer %s" buffer))
(display-buffer-function
;; Let `display-buffer-function' do the job.
(funcall display-buffer-function buffer not-this-window))
((and (not not-this-window)
(eq (window-buffer (selected-window)) buffer))
;; The selected window already displays BUFFER and
;; `not-this-window' is nil, so use it.
(display-buffer-record-window 'reuse-window (selected-window) buffer)
(window--display-buffer-1 (selected-window)))
((and can-use-selected-window (same-window-p name-of-buffer))
;; If the buffer's name tells us to use the selected window do so.
(display-buffer-record-window 'reuse-window (selected-window) buffer)
(window--display-buffer-2 buffer (selected-window)))
((let ((frames (or frame
(and (or use-pop-up-frames
display-buffer-reuse-frames
(not (last-nonminibuffer-frame)))
0)
(last-nonminibuffer-frame))))
(setq window-to-use
(catch 'found
;; Search frames for a window displaying BUFFER. Return
;; the selected window only if we are allowed to do so.
(dolist (window (get-buffer-window-list buffer 'nomini frames))
(when (or can-use-selected-window
(not (eq (selected-window) window)))
(throw 'found window))))))
;; The buffer is already displayed in some window; use that.
(display-buffer-record-window 'reuse-window window-to-use buffer)
(window--display-buffer-1 window-to-use))
((and special-display-function
;; `special-display-p' returns either t or a list of frame
;; parameters to pass to `special-display-function'.
(let ((pars (special-display-p name-of-buffer)))
(when pars
(funcall special-display-function
buffer (if (listp pars) pars))))))
((or use-pop-up-frames (not frame-to-use))
;; We want or need a new frame.
(setq window-to-use
(frame-selected-window (funcall pop-up-frame-function)))
(display-buffer-record-window 'pop-up-frame window-to-use buffer)
(window--display-buffer-2 buffer window-to-use))
((and pop-up-windows
;; Make a new window.
(or (not (frame-parameter frame-to-use 'unsplittable))
;; If the selected frame cannot be split look at
;; `last-nonminibuffer-frame'.
(and (eq frame-to-use (selected-frame))
(setq frame-to-use (last-nonminibuffer-frame))
(window--frame-usable-p frame-to-use)
(not (frame-parameter frame-to-use 'unsplittable))))
;; Attempt to split largest or least recently used window.
(setq window-to-use
(or (window--try-to-split-window
(get-largest-window frame-to-use t))
(window--try-to-split-window
(get-lru-window frame-to-use t))))
(display-buffer-record-window 'pop-up-window window-to-use buffer)
(window--display-buffer-2 buffer window-to-use)))
((let ((window-to-undedicate
;; When NOT-THIS-WINDOW is non-nil, temporarily dedicate
;; the selected window to its buffer, to avoid that some of
;; the `get-' routines below choose it. (Bug#1415)
(and not-this-window (not (window-dedicated-p))
(set-window-dedicated-p (selected-window) t)
(selected-window))))
(unwind-protect
(setq window-to-use
;; Reuse an existing window.
(or (get-lru-window frame-to-use)
(let ((window (get-buffer-window buffer 'visible)))
(unless (and not-this-window
(eq window (selected-window)))
window))
(get-largest-window 'visible)
(let ((window (get-buffer-window buffer 0)))
(unless (and not-this-window
(eq window (selected-window)))
window))
(get-largest-window 0)
(prog1
(frame-selected-window (funcall pop-up-frame-function))
(setq popped-up-frame t))))
(when (window-live-p window-to-undedicate)
;; Restore dedicated status of selected window.
(set-window-dedicated-p window-to-undedicate nil))))
(display-buffer-record-window
(if popped-up-frame 'pop-up-frame 'reuse-window) window-to-use buffer)
(window--even-window-heights window-to-use)
(window--display-buffer-2 buffer window-to-use)))))
(defun window-normalize-buffer-to-display (buffer-or-name)
"Normalize BUFFER-OR-NAME argument for buffer display functions.
If BUFFER-OR-NAME is nil, return the curent buffer. Else, if a
@ -4641,24 +4508,52 @@ BUFFER-OR-NAME and return that buffer."
(current-buffer)))
(defvar display-buffer-alist nil
"Specifications of user preferences for `display-buffer'.
This is a list of elements of the form (CONDITION . ACTION) where
CONDITION is either a regexp matching buffer names, or a function
that takes a buffer and returns a boolean. ACTION is a list of
the form (FUNCTION . ALIST) where FUNCTION can be either a
function or a list of functions. Those functions will be called
with 2 arguments: the buffer to display and an ALIST built from
the various alists specified in the various ACTIONs. It should
either return the window used, or nil to fallback to the next
function.")
"Alist of conditional actions for `display-buffer'.
This is a list of elements (CONDITION . ACTION), where:
(defvar display-buffer-default-action (list #'display-buffer-default)
"Default action to perform to display a buffer.
This is an ACTION just like in `display-buffer-alist'.")
CONDITION is either a regexp matching buffer names, or a function
that takes a buffer and returns a boolean.
(defvar display-buffer-overriding-action '(nil)
ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is
either a function or a list of functions. Each such function
should accept 2 arguments: a buffer to display and an alist of
the same form as ALIST. It should return the window used, or
nil if it fails to display the window. See `display-buffer'
for more details.
Usable action functions include:
`display-buffer-reuse-selected-window'
`display-buffer-same-window'
`display-buffer-maybe-same-window'
`display-buffer-reuse-window'
`display-buffer-pop-up-frame'
`display-buffer-pop-up-window'
`display-buffer-reuse-or-pop-window'
`display-buffer-use-some-window'
The above functions recognize the following alist entries:
- `inhibit-same-window', if non-nil, prevents the same window
from being used for display.
- `reuse-frame' specifies the frames that can be searched for a
window displaying the buffer. Its values have the same
meaning as the ALL-FRAMES arg to `get-buffer-window-list'.")
(defvar display-buffer-default-action
'((display-buffer-reuse-selected-window
display-buffer-maybe-same-window
display-buffer-reuse-or-pop-window
display-buffer-use-some-window
;; If all else fails, pop up a new frame regardless of
;; restrictions.
display-buffer-pop-up-frame))
"List of default actions for `display-buffer'.
It should be a cons cell of the form (FUNCTION . ALIST), which
has the same meaning as in `display-buffer-alist'.")
(defvar display-buffer-overriding-action nil
"Overriding action to perform to display a buffer.
This is an ACTION just like in `display-buffer-alist'.")
If non-nil, it should be a cons cell (FUNCTION . ALIST), which
has the same meaning as in `display-buffer-alist'.")
(defun display-buffer-assq-regexp (buffer-name alist)
"Retrieve ALIST entry corresponding to BUFFER-NAME."
@ -4673,45 +4568,74 @@ This is an ACTION just like in `display-buffer-alist'.")
(throw 'match (cdr entry)))))))
(defun display-buffer (&optional buffer-or-name action frame)
"Display BUFFER in some window."
(let* ((buffer (window-normalize-buffer-to-display buffer-or-name))
(buffer-name (buffer-name buffer))
(user-action
(display-buffer-assq-regexp buffer-name display-buffer-alist))
(functions
(append
(list (car display-buffer-overriding-action))
(list (car user-action))
(and (listp action) (list (car action)))
(list (car display-buffer-default-action))))
(specifiers (append (cdr display-buffer-overriding-action)
(cdr user-action)
(and (listp action) (cdr action))
(cdr display-buffer-default-action)))
function window)
(while (and functions (not window))
(setq function (car functions))
(cond
((listp function)
(while (and function (not window))
(cond
((eq (car function) 'display-buffer-default)
(setq window
(display-buffer-default
buffer (memq action '(t other-window)) frame)))
((functionp (car function))
(setq window (funcall (car function) buffer specifiers))))
(setq function (cdr function))))
((eq function 'display-buffer-default)
(setq window
(display-buffer-default
buffer (memq action '(t other-window)) frame)))
((functionp function)
(setq window
(funcall function buffer specifiers))))
(setq functions (cdr functions)))
"Display BUFFER-OR-NAME in some window.
BUFFER-OR-NAME must be a buffer or the name of an existing
buffer. Return the window chosen for displaying BUFFER-OR-NAME,
or nil if no such window is found.
window))
Optional argument ACTION should have the form (FUNCTION . ALIST).
FUNCTION is either a function or a list of functions. Each such
function is called with 2 arguments: the buffer to display and an
alist. It should either display the buffer and return the
window, or return nil if it is unable to display the buffer.
`display-buffer' constructs a list of action functions and an
action alist by combining `display-buffer-overriding-action',
`display-buffer-alist', the ACTION argument, and
`display-buffer-default-action' (in that order). It calls each
action function in turn, passing the combined action alist as the
second argument, until one of the functions returns non-nil.
The ACTION argument to `display-buffer' can also have a non-nil
and non-list value. This means to display the buffer in a window
other than the selected one, even if it is already displayed in
the selected window. If called interactively with a prefix
argument, ACTION is t.
Optional argument FRAME specifies where to look for a window that
already displays the buffer. If nil, check only the selected
frame (actually the last non-minibuffer frame), except if
`display-buffer-reuse-frames' or `pop-up-frames' is non-nil
\(non-nil and not graphic-only on a text-only terminal), in which
case check all visible or iconified frames. Otherwise, FRAME can
be a specific frame, `visible' (all visible frames), 0 (all
frames on the current terminal), or t (all frames)."
(interactive (list (read-buffer "Display buffer: " (other-buffer))
(if current-prefix-arg t)))
(let ((buffer (window-normalize-buffer-to-display buffer-or-name))
;; Handle the old form of the first argument.
(inhibit-same-window (and action (not (listp action)))))
(unless (listp action) (setq action nil))
(if display-buffer-function
;; If `display-buffer-function' is defined, let it do the job.
(funcall display-buffer-function buffer inhibit-same-window)
;; Otherwise, use the defined actions.
(let* ((user-action
(display-buffer-assq-regexp (buffer-name buffer)
display-buffer-alist))
;; Extra actions from the arguments to this function:
(extra-action
(cons nil (append (if inhibit-same-window
'((inhibit-same-window . t)))
(if frame
`((reuse-frame . ,frame))))))
;; Construct action function list and action alist.
(actions (list display-buffer-overriding-action
user-action action extra-action
display-buffer-default-action))
(functions (apply 'append
(mapcar (lambda (x)
(setq x (car x))
(if (functionp x) (list x) x))
actions)))
(alist (apply 'append (mapcar 'cdr actions)))
window)
(unless (buffer-live-p buffer)
(error "Invalid buffer"))
(while (and functions (not window))
(setq window (funcall (car functions) buffer alist)
functions (cdr functions)))
window))))
(defun display-buffer-other-frame (buffer)
"Display buffer BUFFER in another frame.
@ -4736,86 +4660,228 @@ its documentation for additional customization information."
;;(make-frame-visible (window-frame old-window))
))
(defun pop-to-buffer (buffer-or-name &optional other-window norecord)
"Select buffer BUFFER-OR-NAME in some window, preferably a different one.
BUFFER-OR-NAME may be a buffer, a string \(a buffer name), or
nil. If BUFFER-OR-NAME is a string not naming an existent
buffer, create a buffer with that name. If BUFFER-OR-NAME is
nil, choose some other buffer.
;;; `display-buffer' action functions:
If `pop-up-windows' is non-nil, windows can be split to display
the buffer. If optional second arg OTHER-WINDOW is non-nil,
insist on finding another window even if the specified buffer is
already visible in the selected window, and ignore
`same-window-regexps' and `same-window-buffer-names'.
(defun display-buffer-reuse-selected-window (buffer alist)
"Try to display BUFFER in the selected window if it is already there.
If this succeeds, return the selected window.
If the window to show BUFFER-OR-NAME is not on the selected
This fails if BUFFER is not displayed in the selected window, or
if ALIST has a non-nil `inhibit-same-window' entry. In that
case, return nil."
(when (and (not (cdr (assq 'inhibit-same-window alist)))
(eq buffer (window-buffer)))
(display-buffer-record-window 'reuse-window (selected-window) buffer)
(window--display-buffer-1 (selected-window))))
(defun display-buffer-same-window (buffer alist)
"Try to display BUFFER in the selected window.
If this succeeds, return the selected window.
This fails if the selected window is a minibuffer window or is
dedicated to another buffer, or if ALIST has a non-nil
`inhibit-same-window' entry. In that case, return nil."
(unless (or (cdr (assq 'inhibit-same-window alist))
(window-minibuffer-p)
(window-dedicated-p))
(display-buffer-record-window 'reuse-window (selected-window) buffer)
(window--display-buffer-2 buffer (selected-window))))
(defun display-buffer-maybe-same-window (buffer alist)
"Try to display BUFFER in the selected window.
This acts like `display-buffer-same-window', except that it also
fails if `same-window-p' returns nil for this buffer."
(and (same-window-p (buffer-name buffer))
(display-buffer-same-window buffer alist)))
(defun display-buffer-reuse-window (buffer alist)
"Return a window that is already displaying BUFFER.
If no usable window is found, return nil.
If ALIST has a non-nil `inhibit-same-window' entry, the same
window cannot be reused.
If ALIST contains a `reuse-frame' entry, that determines the
frames to check for a window displaying the buffer. If the entry
is omitted or the value is nil, check only this frame. The value
can also be a specific frame, `visible' (all visible frames),
0 (all frames on the current terminal), or t (all frames)."
(let* ((can-use-selected-window
(not (cdr (assq 'inhibit-same-window alist))))
(frames (or (cdr (assq 'reuse-frame alist))
(last-nonminibuffer-frame)))
(window (catch 'found
(dolist (window (get-buffer-window-list
buffer 'nomini frames))
(when (or can-use-selected-window
(not (eq (selected-window) window)))
(throw 'found window))))))
(when window
(display-buffer-record-window 'reuse-window window buffer)
(window--display-buffer-1 window))))
(defun display-buffer-pop-up-frame (buffer alist)
"Display BUFFER in a new frame.
This works by calling `pop-up-frame-function'. If sucessful,
return the window on the new frame; otherwise return nil."
(let ((fun pop-up-frame-function)
frame window)
(when (and fun
(setq frame (funcall fun))
(setq window (frame-selected-window frame)))
(display-buffer-record-window 'pop-up-frame window buffer)
(window--display-buffer-2 buffer window)
;; Reset list of WINDOW's previous buffers to nil.
(set-window-prev-buffers window nil)
window)))
(defun display-buffer-pop-up-window (buffer alist)
"Display BUFFER by popping up a new window.
The new window is created on the selected frame, or in
`last-nonminibuffer-frame' if no windows can be created there.
If sucessful, return the new window; otherwise return nil."
(let ((frame (or (window--frame-usable-p (selected-frame))
(window--frame-usable-p (last-nonminibuffer-frame))))
window)
(when (and (or (not (frame-parameter frame 'unsplittable))
;; If the selected frame cannot be split, look at
;; `last-nonminibuffer-frame'.
(and (eq frame (selected-frame))
(setq frame (last-nonminibuffer-frame))
(window--frame-usable-p frame)
(not (frame-parameter frame 'unsplittable))))
;; Attempt to split largest or least recently used window.
(setq window (or (window--try-to-split-window
(get-largest-window frame t))
(window--try-to-split-window
(get-lru-window frame t)))))
(display-buffer-record-window 'pop-up-window window buffer)
(window--display-buffer-2 buffer window)
;; Reset list of WINDOW's previous buffers to nil.
(set-window-prev-buffers window nil)
window)))
;; This display action function groups together some lower-level ones:
(defun display-buffer-reuse-or-pop-window (buffer alist)
"Display BUFFER in some window other than the selected one.
This attempts to call the following functions (in order):
- `display-buffer-reuse-window', ensuring that it checks all
frames on this terminal if `display-buffer-reuse-frames' or
`pop-up-frames' is non-nil.
- `special-display-function', if it is available.
- `display-buffer-pop-up-frame', if specified by `pop-up-frames'.
- `display-buffer-pop-up-window', if specified by `pop-up-windows'.
If BUFFER is sucessfully display, return its window; otherwise
return nil."
(let ((use-pop-up-frames (if (eq pop-up-frames 'graphic-only)
(display-graphic-p)
pop-up-frames)))
(or (display-buffer-reuse-window
buffer
;; If `display-buffer-reuse-frames' or `pop-up-frames' is
;; non-nil, check all frames on this terminal.
(if (and (null (cdr (assq 'reuse-frame alist)))
(or use-pop-up-frames display-buffer-reuse-frames))
(cons '(reuse-frame . 0) alist)
alist))
;; Try with `special-display-function':
(and special-display-function
;; `special-display-p' returns either t or a list of frame
;; parameters to pass to `special-display-function'.
(let ((pars (special-display-p (buffer-name buffer))))
(when pars
(funcall special-display-function
buffer (if (listp pars) pars)))))
(and use-pop-up-frames
(display-buffer-pop-up-frame buffer alist))
(and pop-up-windows
(display-buffer-pop-up-window buffer alist)))))
(defun display-buffer-use-some-window (buffer alist)
"Display BUFFER in an existing window.
Search for a usable window, set that window to the buffer, and
return the window. If no suitable window is found, return nil."
(let* ((not-this-window (cdr (assq 'inhibit-same-window alist)))
(window-to-undedicate
;; When NOT-THIS-WINDOW is non-nil, temporarily dedicate the
;; selected window to its buffer, to prevent any of the
;; `get-' routines below from choosing it. (Bug#1415)
(and not-this-window (not (window-dedicated-p))
(set-window-dedicated-p (selected-window) t)
(selected-window)))
(frame (or (window--frame-usable-p (selected-frame))
(window--frame-usable-p (last-nonminibuffer-frame))))
(use-pop-up-frames (if (eq pop-up-frames 'graphic-only)
(display-graphic-p)
pop-up-frames))
window popped-up-frame)
(unwind-protect
(setq window
;; Reuse an existing window.
(or (get-lru-window frame)
(let ((window (get-buffer-window buffer 'visible)))
(unless (and not-this-window
(eq window (selected-window)))
window))
(get-largest-window 'visible)
(let ((window (get-buffer-window buffer 0)))
(unless (and not-this-window
(eq window (selected-window)))
window))
(get-largest-window 0)
(and use-pop-up-frames
(prog1
(frame-selected-window (funcall pop-up-frame-function))
(setq popped-up-frame t)))))
(when (window-live-p window-to-undedicate)
;; Restore dedicated status of selected window.
(set-window-dedicated-p window-to-undedicate nil)))
(when window
(display-buffer-record-window
(if popped-up-frame 'pop-up-frame 'reuse-window) window buffer)
(window--even-window-heights window)
(window--display-buffer-2 buffer window))))
;;; Display + selection commands:
(defun pop-to-buffer (buffer &optional action norecord)
"Select buffer BUFFER in some window, preferably a different one.
BUFFER may be a buffer, a string (a buffer name), or nil. If it
is a string not naming an existent buffer, create a buffer with
that name. If BUFFER is nil, choose some other buffer. Return
the buffer.
This uses `display-buffer' as a subroutine. The optional ACTION
argument is passed to `display-buffer' as its ACTION argument.
See `display-buffer' for more information. ACTION is t if called
interactively with a prefix argument, which means to pop to a
window other than the selected one even if the buffer is already
displayed in the selected window.
If the window to show BUFFER is not on the selected
frame, raise that window's frame and give it input focus.
This function returns the buffer it switched to. This uses the
function `display-buffer' as a subroutine; see the documentation
of `display-buffer' for additional customization information.
Optional third arg NORECORD non-nil means do not put this buffer
at the front of the list of recently selected ones."
(interactive "BPop to buffer:\nP")
(let ((buffer (window-normalize-buffer-to-display buffer-or-name))
(old-window (selected-window))
(old-frame (selected-frame))
new-window new-frame)
(set-buffer buffer)
(setq new-window (display-buffer buffer other-window))
(setq new-frame (window-frame new-window))
(if (eq old-frame new-frame)
;; Make sure new-window gets selected (Bug#8615), (Bug#6954).
(select-window new-window norecord)
;; `display-buffer' has chosen another frame, make sure it gets
;; input focus and is risen.
(select-frame-set-input-focus new-frame norecord))
(interactive (list (read-buffer "Pop to buffer: " (other-buffer))
(if current-prefix-arg t)))
(setq buffer (window-normalize-buffer-to-display
;; BUFFER nil means another buffer.
(or buffer (other-buffer))))
(set-buffer buffer)
(let* ((old-window (selected-window))
(old-frame (selected-frame))
(window (display-buffer (current-buffer) action))
(frame (window-frame window)))
(if (eq frame old-frame)
;; Make sure new window is selected (Bug#8615), (Bug#6954).
(select-window window norecord)
;; If `display-buffer' has chosen another frame, make sure it
;; gets input focus.
(select-frame-set-input-focus frame norecord))
buffer))
(defun pop-to-buffer-same-window (&optional buffer-or-name norecord)
"Pop to buffer specified by BUFFER-OR-NAME in the selected window.
Another window will be used only if the buffer can't be shown in
the selected window, usually because it is dedicated to another
buffer. Optional arguments BUFFER-OR-NAME and NORECORD are as
for `pop-to-buffer'."
(interactive "BPop to buffer in selected window:\nP")
(let ((buffer (window-normalize-buffer-to-display buffer-or-name)))
(cond
((eq buffer (window-buffer))
(unless norecord
(select-window (selected-window)))
(set-buffer buffer))
((or (window-minibuffer-p) (window-dedicated-p))
(pop-to-buffer buffer norecord))
(t
(set-window-buffer nil buffer)
(unless norecord
(select-window (selected-window)))
(set-buffer buffer)))))
(defun pop-to-buffer-other-window (&optional buffer-or-name norecord)
"Pop to buffer specified by BUFFER-OR-NAME in another window.
The selected window will be used only if there is no other
choice. Windows on the selected frame are preferred to windows
on other frames. Optional arguments BUFFER-OR-NAME and NORECORD
are as for `pop-to-buffer'."
(interactive "BPop to buffer in another window:\nP")
(let ((pop-up-windows t)
same-window-buffer-names same-window-regexps)
(pop-to-buffer buffer-or-name t norecord)))
(defun pop-to-buffer-other-frame (&optional buffer-or-name norecord)
"Pop to buffer specified by BUFFER-OR-NAME on another frame.
The selected frame will be used only if there's no other choice.
Optional arguments BUFFER-OR-NAME and NORECORD are as for
`pop-to-buffer'."
(interactive "BPop to buffer on another frame:\nP")
(let ((pop-up-frames t)
same-window-buffer-names same-window-regexps)
(pop-to-buffer buffer-or-name t norecord)))
(defun read-buffer-to-switch (prompt)
"Read the name of a buffer to switch to, prompting with PROMPT.
Return the neame of the buffer as a string.

View File

@ -1,4 +1,4 @@
2011-09-01 Paul Eggert <eggert@cs.ucla.edu>
2011-09-04 Paul Eggert <eggert@cs.ucla.edu>
sprintf-related integer and memory overflow issues (Bug#9412).
@ -105,6 +105,47 @@
* xterm.h (x_check_errors): Add ATTRIBUTE_FORMAT_PRINTF.
2011-09-04 Paul Eggert <eggert@cs.ucla.edu>
Integer overflow fixes for scrolling, etc.
Without these, Emacs silently mishandles large integers sometimes.
For example, "C-u 4294967297 M-x recenter" was treated as if
it were "C-u 1 M-x recenter" on a typical 64-bit host.
* xdisp.c (try_window_id): Check Emacs fixnum range before
converting to 'int'.
* window.c (window_scroll_line_based, Frecenter):
Check that an Emacs fixnum is in range before assigning it to 'int'.
(Frecenter, Fmove_to_window_line): Use EMACS_INT, not int, for
values converted from Emacs fixnums.
(Frecenter): Don't wrap around a line count if it is out of 'int'
range; instead, treat it as an extreme value.
(Fset_window_configuration, compare_window_configurations):
Use ptrdiff_t, not int, for index that might exceed 2 GiB.
* search.c (Freplace_match): Use ptrdiff_t, not int, for indexes
that can exceed INT_MAX. Check that EMACS_INT value is in range
before assigning it to the (possibly-narrower) index.
(match_limit): Don't assume that a fixnum can fit in 'int'.
* print.c (print_object): Use ptrdiff_t, not int, for index that can
exceed INT_MAX.
* indent.c (position_indentation): Now takes ptrdiff_t, not int.
(Fvertical_motion): Don't wrap around LINES values that don't fit
in 'int'. Instead, treat them as extreme values. This is good
enough for windows, which can't have more than INT_MAX lines anyway.
2011-09-03 Lars Magne Ingebrigtsen <larsi@gnus.org>
* Require libxml/parser.h to avoid compilation warning.
* emacs.c (shut_down_emacs): Call xmlCleanupParser on shutdown.
* xml.c (parse_region): Don't call xmlCleanupParser after parsing,
since this reportedly can destroy thread storage.
2011-08-30 Chong Yidong <cyd@stupidchicken.com>
* syntax.c (find_defun_start): Update all cache variables if

View File

@ -82,6 +82,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/personality.h>
#endif
#ifdef HAVE_LIBXML2
#include <libxml/parser.h>
#endif
#ifndef O_RDWR
#define O_RDWR 2
#endif
@ -2099,6 +2103,10 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
#ifdef HAVE_NS
ns_term_shutdown (sig);
#endif
#ifdef HAVE_LIBXML2
xmlCleanupParser ();
#endif
}

View File

@ -56,7 +56,7 @@ EMACS_INT last_known_column_point;
static int last_known_column_modified;
static EMACS_INT current_column_1 (void);
static EMACS_INT position_indentation (int);
static EMACS_INT position_indentation (ptrdiff_t);
/* Cache of beginning of line found by the last call of
current_column. */
@ -855,7 +855,7 @@ following any initial whitespace. */)
}
static EMACS_INT
position_indentation (register int pos_byte)
position_indentation (ptrdiff_t pos_byte)
{
register EMACS_INT column = 0;
int tab_width = SANE_TAB_WIDTH (current_buffer);
@ -2063,7 +2063,7 @@ whether or not it is currently displayed in some window. */)
/* Do this even if LINES is 0, so that we move back to the
beginning of the current line as we ought. */
if (XINT (lines) == 0 || IT_CHARPOS (it) > 0)
move_it_by_lines (&it, XINT (lines));
move_it_by_lines (&it, max (INT_MIN, XINT (lines)));
}
else
{
@ -2083,7 +2083,7 @@ whether or not it is currently displayed in some window. */)
&& it.c == '\n'))
move_it_by_lines (&it, -1);
it.vpos = 0;
move_it_by_lines (&it, XINT (lines));
move_it_by_lines (&it, min (INT_MAX, XINT (lines)));
}
else
{
@ -2099,12 +2099,12 @@ whether or not it is currently displayed in some window. */)
move_it_by_lines (&it, 1);
}
if (XINT (lines) > 1)
move_it_by_lines (&it, XINT (lines) - 1);
move_it_by_lines (&it, min (INT_MAX, XINT (lines) - 1));
}
else
{
it.vpos = 0;
move_it_by_lines (&it, XINT (lines));
move_it_by_lines (&it, min (INT_MAX, XINT (lines)));
}
}
}

View File

@ -1702,7 +1702,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
}
else if (BOOL_VECTOR_P (obj))
{
register int i;
ptrdiff_t i;
register unsigned char c;
struct gcpro gcpro1;
EMACS_INT size_in_chars

View File

@ -2404,7 +2404,7 @@ since only regular expressions have distinguished subexpressions. */)
int some_uppercase;
int some_nonuppercase_initial;
register int c, prevc;
int sub;
ptrdiff_t sub;
EMACS_INT opoint, newpoint;
CHECK_STRING (newtext);
@ -2423,9 +2423,9 @@ since only regular expressions have distinguished subexpressions. */)
else
{
CHECK_NUMBER (subexp);
sub = XINT (subexp);
if (sub < 0 || sub >= search_regs.num_regs)
if (! (0 <= XINT (subexp) && XINT (subexp) < search_regs.num_regs))
args_out_of_range (subexp, make_number (search_regs.num_regs));
sub = XINT (subexp);
}
if (NILP (string))
@ -2662,7 +2662,7 @@ since only regular expressions have distinguished subexpressions. */)
unsigned char str[MAX_MULTIBYTE_LENGTH];
const unsigned char *add_stuff = NULL;
ptrdiff_t add_len = 0;
int idx = -1;
ptrdiff_t idx = -1;
if (str_multibyte)
{
@ -2813,7 +2813,7 @@ since only regular expressions have distinguished subexpressions. */)
static Lisp_Object
match_limit (Lisp_Object num, int beginningp)
{
register int n;
EMACS_INT n;
CHECK_NUMBER (num);
n = XINT (num);

View File

@ -4662,14 +4662,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
if (pos < ZV)
{
int this_scroll_margin = scroll_margin;
/* Don't use a scroll margin that is negative or too large. */
if (this_scroll_margin < 0)
this_scroll_margin = 0;
if (XINT (w->total_lines) < 4 * scroll_margin)
this_scroll_margin = XINT (w->total_lines) / 4;
int this_scroll_margin =
max (0, min (scroll_margin, XINT (w->total_lines) / 4));
set_marker_restricted_both (w->start, w->buffer, pos, pos_byte);
w->start_at_line_beg = bolp;
@ -5057,7 +5052,7 @@ and redisplay normally--don't erase and redraw the frame. */)
struct buffer *obuf = current_buffer;
int center_p = 0;
EMACS_INT charpos, bytepos;
int iarg IF_LINT (= 0);
EMACS_INT iarg IF_LINT (= 0);
int this_scroll_margin;
/* If redisplay is suppressed due to an error, try again. */
@ -5096,9 +5091,8 @@ and redisplay normally--don't erase and redraw the frame. */)
/* Do this after making BUF current
in case scroll_margin is buffer-local. */
this_scroll_margin = max (0, scroll_margin);
this_scroll_margin = min (this_scroll_margin,
XFASTINT (w->total_lines) / 4);
this_scroll_margin =
max (0, min (scroll_margin, XFASTINT (w->total_lines) / 4));
/* Handle centering on a graphical frame specially. Such frames can
have variable-height lines and centering point on the basis of
@ -5122,7 +5116,7 @@ and redisplay normally--don't erase and redraw the frame. */)
{
struct it it;
struct text_pos pt;
int nlines = -iarg;
int nlines = min (INT_MAX, -iarg);
int extra_line_spacing;
int h = window_box_height (w);
void *itdata = bidi_shelve_cache ();
@ -5288,15 +5282,14 @@ zero means top of window, negative means relative to bottom of window. */)
lines = displayed_window_lines (w);
#if 0
this_scroll_margin = max (0, scroll_margin);
this_scroll_margin = min (this_scroll_margin, lines / 4);
this_scroll_margin = max (0, min (scroll_margin, lines / 4));
#endif
if (NILP (arg))
XSETFASTINT (arg, lines / 2);
else
{
int iarg = XINT (Fprefix_numeric_value (arg));
EMACS_INT iarg = XINT (Fprefix_numeric_value (arg));
if (iarg < 0)
iarg = iarg + lines;
@ -5468,7 +5461,8 @@ the return value is nil. Otherwise the value is t. */)
struct window *root_window;
struct window **leaf_windows;
int n_leaf_windows;
int k, i, n;
ptrdiff_t k;
int i, n;
/* If the frame has been resized since this window configuration was
made, we change the frame to the size specified in the
@ -6344,7 +6338,7 @@ compare_window_configurations (Lisp_Object configuration1, Lisp_Object configura
{
register struct save_window_data *d1, *d2;
struct Lisp_Vector *sws1, *sws2;
int i;
ptrdiff_t i;
CHECK_WINDOW_CONFIGURATION (configuration1);
CHECK_WINDOW_CONFIGURATION (configuration2);

View File

@ -16919,8 +16919,8 @@ try_window_id (struct window *w)
{
int this_scroll_margin, cursor_height;
this_scroll_margin = max (0, scroll_margin);
this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
this_scroll_margin =
max (0, min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4));
this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height;

View File

@ -141,7 +141,6 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
Fcons (Qnil, Fnreverse (Fcons (r, result))));
xmlFreeDoc (doc);
xmlCleanupParser ();
}
return result;