Move functions from file-manip.el to the Org config
This commit is contained in:
parent
d52a110acb
commit
372df13155
@ -311,6 +311,46 @@ Esentially it visits the file again."
|
||||
(setq gpolonkai/last-killed-buffer-file-name nil))
|
||||
(message "The buffer last killed didn’t visit a file.")))
|
||||
#+END_SRC
|
||||
|
||||
*** Open this file as another user
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun open-this-file-as-other-user (user)
|
||||
"Edit current file as USER, using `tramp' and `sudo'.
|
||||
|
||||
If the current buffer is not visiting a file, prompt for a file
|
||||
name."
|
||||
(interactive "sEdit as user (default: root): ")
|
||||
(when (string= "" user)
|
||||
(setq user "root"))
|
||||
(let* ((filename (or buffer-file-name
|
||||
(read-file-name (format "Find file (as %s): "
|
||||
user))))
|
||||
(tramp-path (concat (format "/sudo:%s@localhost:" user) filename)))
|
||||
(if buffer-file-name
|
||||
(find-alternate-file tramp-path)
|
||||
(find-file tramp-path))))
|
||||
#+END_SRC
|
||||
|
||||
*** Open my own ~init.el~
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun gpolonkai/visit-init-file ()
|
||||
"Open the init file."
|
||||
(interactive)
|
||||
(find-file-other-window user-init-file))
|
||||
#+END_SRC
|
||||
|
||||
*** Open my Org-mode index file
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun gpolonkai/visit-org-index ()
|
||||
"Visit the root of Org-mode notes."
|
||||
(interactive)
|
||||
(find-file-other-window (concat (file-name-as-directory org-directory)
|
||||
"index.org")))
|
||||
#+END_SRC
|
||||
|
||||
** ~c-mode~ related
|
||||
|
||||
*** Copy the prototype of the current function
|
||||
|
1
init.el
1
init.el
@ -31,7 +31,6 @@
|
||||
(load "zim")
|
||||
(load "text-manip")
|
||||
(load "frame-manip")
|
||||
(load "file-manip")
|
||||
(load "window-manip")
|
||||
(load "xdg-paths")
|
||||
(load "utils")
|
||||
|
@ -1,35 +0,0 @@
|
||||
;;; file-manip --- Summary
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
(defun open-this-file-as-other-user (user)
|
||||
"Edit current file as USER, using `tramp' and `sudo'.
|
||||
|
||||
If the current buffer is not visiting a file, prompt for a file
|
||||
name."
|
||||
(interactive "sEdit as user (default: root): ")
|
||||
(when (string= "" user)
|
||||
(setq user "root"))
|
||||
(let* ((filename (or buffer-file-name
|
||||
(read-file-name (format "Find file (as %s): "
|
||||
user))))
|
||||
(tramp-path (concat (format "/sudo:%s@localhost:" user) filename)))
|
||||
(if buffer-file-name
|
||||
(find-alternate-file tramp-path)
|
||||
(find-file tramp-path))))
|
||||
|
||||
(defun gpolonkai/visit-init-file ()
|
||||
"Open the init file."
|
||||
(interactive)
|
||||
(find-file-other-window user-init-file))
|
||||
|
||||
(defun gpolonkai/visit-org-index ()
|
||||
"Visit the root of Org-mode notes."
|
||||
(interactive)
|
||||
(find-file-other-window (concat (file-name-as-directory org-directory)
|
||||
"index.org")))
|
||||
|
||||
(provide 'file-manip)
|
||||
|
||||
;;; file-manip.el ends here
|
Loading…
Reference in New Issue
Block a user