help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: desktop-save


From: Peter Dyballa
Subject: Re: desktop-save
Date: Sat, 15 Sep 2012 10:34:09 +0200

Am 15.09.2012 um 08:12 schrieb drain:

> Have any of you customized how Emacs saves / loads your sessions? If so, how
> so?
> 
> Looking for ideas. 
> 

(defconst mEV (emacs-version)
  "Keep the Emacs version string,
   which is needed a few times.")

(defconst mWS (symbol-value 'window-system)
  "Running as some windowing system's client,
   or as slave of a terminal emulator?")

(setq ETyp emacs-major-version)
  (message "Zeile  47 .emacs, ETyp ist %d" ETyp)

(if (not (symbolp 'user-emacs-directory))
  (defconst user-emacs-directory
    (if (eq system-type 'ms-dos)
        ;; MS-DOS cannot have initial dot.
        "~/_emacs.d/"
      "~/.emacs.d/")
    "Directory beneath which additional per-user Emacs-specific files are 
placed.
Various programs in Emacs store information in this directory.
Note that this should end with a directory separator."))
;; 1/4
(unless (string= "XEmacs" mEV)
;---   (desktop-load-default)
      (setq history-length 250)
      (setq desktop-globals-to-save '(desktop-missing-file-warning))
      (add-hook 'dired-mode-hook 'auto-revert-mode)
      (setq desktop-dirname (format "%sPDesktop-%d" user-emacs-directory ETyp))
      (setq desktop-base-lock-name (format ".emacs.desktop-%s.lock" 
window-system))
      (setq desktop-base-file-name (format "emacs.desktop-%s" window-system))
      (add-hook 'shell-mode-hook
          (lambda ()
            (setq histfile (format "history_%s" window-system))
            (setq comint-input-ring-file-name
                  (expand-file-name histfile desktop-dirname))
            (setq histfile (format "echo \"set histfile = %s\" > 
~/.emacs_tcsh-init"
                                   comint-input-ring-file-name))
            (shell-command histfile)
            (kill-buffer "*Shell Command Output*")
            ))
      (require 'session)
      (add-hook 'after-init-hook 'session-initialize)
      (when (< 21 ETyp)
        (unless buffer-read-only
          (delete-trailing-whitespace)
        )
        (desktop-save-mode 1)
        (setq session-save-file-coding-system 'utf-8-unix))
      (setq session-save-file (format "%s/Psession-%s" desktop-dirname 
window-system))
      (setq custom-file (format "~/.emacs-Abrichtung-%d.el" ETyp))
      (setq desktop-path (list desktop-dirname))
      (load custom-file)
      (load (format "~/.emacs_%s" mWS))
      (add-hook 'before-save-hook 'time-stamp)
      (setq search-whitespace-regexp nil)
)

It is kind of practical for me, allowing me to have Emacsen of different 
versions and windowing systems, and each with its own "setup" (via different 
customisation files). I think the shell history is quite the same in all. My 
own variables are probably useless. I started to use them for other purposes 
first, but I think it should work without them.

--
Greetings

  Pete

The best way to accelerate a PC is 9.8 m/s²




reply via email to

[Prev in Thread] Current Thread [Next in Thread]