Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bbatsov/prelude
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed May 22, 2015
2 parents 2b66153 + 8bd317e commit fe7997b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,13 @@ Or you can use another theme altogether by adding something in `personal/preload
install it from MELPA first (`M-x package-install RET
solarized-theme`).

Finally, if you don't want any theme at all, you can add this to your
`personal/preload`:

```lisp
(setq prelude-theme nil)
```

### Personalizing

Fork the official Prelude repo and add your own touch to it. You're advised to avoid changing stuff outside of the
Expand Down
25 changes: 21 additions & 4 deletions core/prelude-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,21 @@ there's a region, all lines that region covers will be duplicated."
(interactive)
(byte-recompile-directory prelude-dir 0))

(defun prelude-file-owner-uid (filename)
"Return the UID of the FILENAME as an integer.
See `file-attributes' for more info."
(nth 2 (file-attributes filename 'integer)))

(defun prelude-file-owned-by-user-p (filename)
"Return t if file FILENAME is owned by the currently logged in user."
(equal (prelude-file-owner-uid filename)
(user-uid)))

(defun prelude-find-alternate-file-as-root (filename)
"Wraps `find-alternate-file' with opening a file as root."
(find-alternate-file (concat "/sudo:root@localhost:" filename)))

(require 'ido)
(defun prelude-sudo-edit (&optional arg)
"Edit currently visited file as root.
Expand All @@ -296,15 +311,17 @@ buffer is not visiting a file."
(if (or arg (not buffer-file-name))
(find-file (concat "/sudo:root@localhost:"
(ido-read-file-name "Find file(as root): ")))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
(prelude-find-alternate-file-as-root buffer-file-name)))

(defadvice ido-find-file (after find-file-sudo activate)
(defun prelude-reopen-as-root ()
"Find file as root if necessary."
(unless (or (tramp-tramp-file-p buffer-file-name)
(equal major-mode 'dired-mode)
(not (file-exists-p (file-name-directory buffer-file-name)))
(file-writable-p buffer-file-name))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
(file-writable-p buffer-file-name)
(prelude-file-owned-by-user-p buffer-file-name))
(prelude-find-alternate-file-as-root buffer-file-name)))
(add-hook 'find-file-hook 'prelude-reopen-as-root)

(defun prelude-start-or-switch-to (function buffer-name)
"Invoke FUNCTION if there is no buffer with BUFFER-NAME.
Expand Down
3 changes: 2 additions & 1 deletion core/prelude-ui.el
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"%b"))))

;; use zenburn as the default theme
(load-theme prelude-theme t)
(when prelude-theme
(load-theme prelude-theme t))

(provide 'prelude-ui)
;;; prelude-ui.el ends here
1 change: 0 additions & 1 deletion modules/prelude-python.el
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
(subword-mode +1)
(anaconda-mode 1)
(eldoc-mode 1)
(which-function-mode -1)
(setq-local electric-layout-rules
'((?: . (lambda ()
(and (zerop (first (syntax-ppss)))
Expand Down

0 comments on commit fe7997b

Please sign in to comment.