aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2017-10-23 09:53:41 +0200
committerMartin Rudalics2017-10-23 09:53:41 +0200
commit46cdc01daae6972aaa53e6db16a52fdc2a4b7cac (patch)
treeeb4b6573384d344d65bb659f5b9c1ad0d0720a4e
parent6360611457a39292e11980bb522a14a5c9a58716 (diff)
downloademacs-46cdc01daae6972aaa53e6db16a52fdc2a4b7cac.tar.gz
emacs-46cdc01daae6972aaa53e6db16a52fdc2a4b7cac.zip
Fix some ‘window-normalize-’ prefixed functions (Bug#28947)
* lisp/window.el (window-normalize-buffer): Fix case where BUFFER-OR-NAME is a string specifying a dead buffer. Fix doc-string (Bug#28947). (window-normalize-frame, window-normalize-window): Fix doc-strings (Bug#28947).
-rw-r--r--lisp/window.el46
1 files changed, 31 insertions, 15 deletions
diff --git a/lisp/window.el b/lisp/window.el
index 5ba9a305f96..c0a9ecd093c 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -320,22 +320,34 @@ WINDOW can be any window."
320 320
321(defun window-normalize-buffer (buffer-or-name) 321(defun window-normalize-buffer (buffer-or-name)
322 "Return buffer specified by BUFFER-OR-NAME. 322 "Return buffer specified by BUFFER-OR-NAME.
323BUFFER-OR-NAME must be either a buffer or a string naming a live 323BUFFER-OR-NAME must be a live buffer, a string naming a live
324buffer and defaults to the current buffer." 324buffer or nil which means to return the current buffer.
325 (cond 325
326 ((not buffer-or-name) 326This function is commonly used to process the (usually optional)
327 (current-buffer)) 327\"BUFFER-OR-NAME\" argument of window related functions where nil
328 ((bufferp buffer-or-name) 328stands for the current buffer."
329 (if (buffer-live-p buffer-or-name) 329 (let ((buffer
330 buffer-or-name 330 (cond
331 (error "Buffer %s is not a live buffer" buffer-or-name))) 331 ((not buffer-or-name)
332 ((get-buffer buffer-or-name)) 332 (current-buffer))
333 (t 333 ((bufferp buffer-or-name)
334 (error "No such buffer %s" buffer-or-name)))) 334 buffer-or-name)
335 ((stringp buffer-or-name)
336 (get-buffer buffer-or-name))
337 (t
338 (error "No such buffer %s" buffer-or-name)))))
339 (if (buffer-live-p buffer)
340 buffer
341 (error "No such live buffer %s" buffer-or-name))))
335 342
336(defun window-normalize-frame (frame) 343(defun window-normalize-frame (frame)
337 "Return frame specified by FRAME. 344 "Return frame specified by FRAME.
338FRAME must be a live frame and defaults to the selected frame." 345FRAME must be a live frame or nil which means to return the
346selected frame.
347
348This function is commonly used to process the (usually optional)
349\"FRAME\" argument of window and frame related functions where
350nil stands for the selected frame."
339 (if frame 351 (if frame
340 (if (frame-live-p frame) 352 (if (frame-live-p frame)
341 frame 353 frame
@@ -343,11 +355,15 @@ FRAME must be a live frame and defaults to the selected frame."
343 (selected-frame))) 355 (selected-frame)))
344 356
345(defun window-normalize-window (window &optional live-only) 357(defun window-normalize-window (window &optional live-only)
346 "Return the window specified by WINDOW. 358 "Return window specified by WINDOW.
347If WINDOW is nil, return the selected window. Otherwise, if 359If WINDOW is nil, return the selected window. Otherwise, if
348WINDOW is a live or an internal window, return WINDOW; if 360WINDOW is a live or an internal window, return WINDOW; if
349LIVE-ONLY is non-nil, return WINDOW for a live window only. 361LIVE-ONLY is non-nil, return WINDOW for a live window only.
350Otherwise, signal an error." 362Otherwise, signal an error.
363
364This function is commonly used to process the (usually optional)
365\"WINDOW\" argument of window related functions where nil stands
366for the selected window."
351 (cond 367 (cond
352 ((null window) 368 ((null window)
353 (selected-window)) 369 (selected-window))