Extract prelude-start-or-switch-to
This commit is contained in:
parent
b09eaf8e0e
commit
0a56b3ffb5
1 changed files with 10 additions and 7 deletions
|
@ -268,13 +268,16 @@ buffer is not visiting a file."
|
|||
(file-writable-p buffer-file-name))
|
||||
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
|
||||
|
||||
(defun prelude-switch-or-start (function buffer)
|
||||
"If BUFFER is current, bury it, otherwise invoke FUNCTION."
|
||||
(if (equal (buffer-name (current-buffer)) buffer)
|
||||
(bury-buffer)
|
||||
(if (get-buffer buffer)
|
||||
(switch-to-buffer buffer)
|
||||
(funcall function))))
|
||||
(defun prelude-start-or-switch-to (function buffer-name)
|
||||
"Invoke FUNCTION if there is no buffer with BUFFER-NAME.
|
||||
Otherwise switch to the buffer named BUFFER-NAME. Don't clobber
|
||||
the current buffer."
|
||||
(if (not (get-buffer buffer-name))
|
||||
(progn
|
||||
(split-window-sensibly (selected-window))
|
||||
(other-window 1)
|
||||
(funcall function))
|
||||
(switch-to-buffer-other-window buffer-name)))
|
||||
|
||||
(defun prelude-insert-date ()
|
||||
"Insert a timestamp according to locale's date and time format."
|
||||
|
|
Loading…
Reference in a new issue