EXPRESIONES DE GRATITUD
Creé una solución de las cosas que encontré en las siguientes páginas:
NOTAS
No especificó qué sistema operativo está utilizando. Asumiré que es un poco de sabor de * nix. Corrígeme si me equivoco. Si está utilizando Windows, aún puede usar los .emacsajustes que sugiero, pero no puede usar la solución (ver más abajo).
Mi solución se carga emacscon 4 ventanas abiertas, que w3mmuestran google en la parte superior izquierda, un shell de python en la parte superior derecha, el último archivo abierto en la parte inferior izquierda y un scratchbúfer vacío en la parte inferior derecha. Esto funciona bien si inicia emacssin argumentos, pero rompe el diseño si abre un archivo directamente desde la línea de comandos:
emacs foo.txt
Por lo tanto, también sugiero una solución alternativa para cargar el diseño solo si no se ha proporcionado un nombre de archivo. Si siempre desea cargar el diseño de 4 ventanas, simplemente agregue las líneas lisp a continuación directamente en ~/.emacslugar de crear un nuevo archivo .
Si decide agregar las líneas directamente a su ~/.emacsarchivo, tenga cuidado con estos comandos:
;; Set the max number of recent files kept
(custom-set-variables
'(recentf-max-saved-items 10)
'(inhibit-startup-screen t))
Solo puede haber una custom-set-variablessección en un .emacsarchivo, así que en lugar de agregar esas líneas al archivo, busque la custom-set-variablessección existente y simplemente agregue la variable:
'(recentf-max-saved-items 10)
RESPONDER
Cree un archivo en su $HOMEllamada que .my_emacs_layoutcontenga estas líneas (o agréguelos a su ~/.emacsarchivo, consulte las notas anteriores):
;; Activate recentf mode to get the list of
;; recent files
(recentf-mode 1)
;; Load the w3m browser, change this to the location of your `w3m` install.
;; You should be able to copy the relevant lines from your `~/.emacs`.
(add-to-list 'load-path "~/.emacs-lisp/emacs-w3m")
(require 'w3m-load)
;; Set the max number of recent files kept
(custom-set-variables
'(recentf-max-saved-items 10)
'(inhibit-startup-screen t))
;; Set up initial window layout.
(split-window-horizontally)
;; Open w3m in the main window, this
;; will be the top left
(w3m-goto-url "www.superuser.com")
;; Split the left window vertically
(split-window-vertically)
;; switch to the bottom left window
(other-window 1)
;; and load the most recent file
(recentf-open-most-recent-file 1)
;; I am sure there is a better way of doing this
;; but for some reason opening the python shell screws
;; around with the window focus and this ugly hack is
;; the best I could come up with.
(other-window 1)
(split-window-vertically)
(other-window 1)
(other-window 1)
(other-window 1)
;; open the python shell in what will be
;; the top right window
(py-shell)
Eso es todo, ahora puede cargar su nuevo emacsdiseño iniciando
emacs -l ~/.my_emacs_layout
Solución
Si desea cargar una emacssesión normal al abrir explícitamente un archivo y cargar el diseño de 4 ventanas cuando simplemente se ejecuta emacs, agregue estas líneas al archivo de configuración de su shell ( ~/.bashrcsi está usando bash):
function emacs(){
if [ $# -eq 0 ]
then
/usr/bin/emacs -l ~/.my_emacs_layout
else
/usr/bin/emacs "$@"
fi
}