Permalink
Browse files

initial import

  • Loading branch information...
1 parent f258594 commit dce31c8a0857142eececf2150676c08707ab5d2e @tavisrudd committed Jun 3, 2011
Showing with 45 additions and 0 deletions.
  1. +45 −0 dss-desktop.el
View
@@ -0,0 +1,45 @@
+(require 'dss-paths)
+
+(defadvice desktop-owner (after pry-from-cold-dead-hands activate)
+ "Don't allow dead emacsen to own the desktop file.
+
+This function comes from the anonymous code on
+http://www.emacswiki.org/emacs/DeskTop"
+ (when (not (dss/emacs-process-p ad-return-value))
+ (setq ad-return-value nil)))
+
+
+(defun dss/emacs-process-p (pid)
+ "If pid is the process ID of an emacs process, return t, else nil.
+Also returns nil if pid is nil.
+
+This function comes from the anonymous code on
+http://www.emacswiki.org/emacs/DeskTop
+"
+ (when pid
+ (let ((attributes (process-attributes pid)) (cmd))
+ (dolist (attr attributes)
+ (if (string= "comm" (car attr))
+ (setq cmd (cdr attr))))
+ (if (and cmd (or (string= "emacs" cmd) (string= "emacs.exe" cmd))) t))))
+(require 'desktop-recover)
+
+
+(defun dss/desktop-reset ()
+ (interactive)
+ (desktop-remove)
+ (desktop-recover-do-saves-automatically))
+
+(desktop-save-mode 1)
+
+;;(setq history-length 250)
+;;(add-to-list 'desktop-globals-to-save 'file-name-history)
+;; (setq desktop-buffers-not-to-save
+;; (concat "\\("
+;; "^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\|^tags\\|^TAGS"
+;; "\\|\\.emacs.*\\|\\.diary\\|\\.newsrc-dribble\\|\\.bbdb"
+;; "\\)$"))
+;; (add-to-list 'desktop-modes-not-to-save 'dired-mode)
+;; (add-to-list 'desktop-modes-not-to-save 'Info-mode)
+
+(provide 'dss-desktop)

0 comments on commit dce31c8

Please sign in to comment.