Change cp/ prefix to my-
This commit is contained in:
parent
d14d465446
commit
e12093d610
42
init.org
42
init.org
|
@ -1518,11 +1518,11 @@ according to the mode."
|
||||||
;; Chris Done (god-mode) recommends this, but Emacs' repeat command is almost useless...
|
;; Chris Done (god-mode) recommends this, but Emacs' repeat command is almost useless...
|
||||||
;; (global-set-key (kbd "C-.") 'repeat)
|
;; (global-set-key (kbd "C-.") 'repeat)
|
||||||
|
|
||||||
(defun cp/delete-trailing-whitespace ()
|
(defun my-delete-trailing-whitespace ()
|
||||||
(unless (derived-mode-p 'markdown-mode)
|
(unless (derived-mode-p 'markdown-mode)
|
||||||
(delete-trailing-whitespace)))
|
(delete-trailing-whitespace)))
|
||||||
|
|
||||||
(add-hook 'before-save-hook 'cp/delete-trailing-whitespace)
|
(add-hook 'before-save-hook 'my-delete-trailing-whitespace)
|
||||||
|
|
||||||
;; BUG - (dired-get-marked-files) returns file name at point if none are marked
|
;; BUG - (dired-get-marked-files) returns file name at point if none are marked
|
||||||
;; BUG - (dired-get-marked-files) always returns an alphabetically-sorted list, even when the Dired buffer is sorted by date
|
;; BUG - (dired-get-marked-files) always returns an alphabetically-sorted list, even when the Dired buffer is sorted by date
|
||||||
|
@ -2727,7 +2727,7 @@ PR ideas
|
||||||
;; after learning that this copies whole paths with null
|
;; after learning that this copies whole paths with null
|
||||||
;; argument, this became a whole lot more useful
|
;; argument, this became a whole lot more useful
|
||||||
("C-w" . dired-copy-filename-as-kill)
|
("C-w" . dired-copy-filename-as-kill)
|
||||||
("C-c C-f" . cp/corresponding-text-file)
|
("C-c C-f" . my-corresponding-text-file)
|
||||||
("h" . dired-hide-dotfiles-mode)
|
("h" . dired-hide-dotfiles-mode)
|
||||||
([mouse-2] . cp/dired-launch-or-open)
|
([mouse-2] . cp/dired-launch-or-open)
|
||||||
("C-j" . launch-files-dired)
|
("C-j" . launch-files-dired)
|
||||||
|
@ -2764,8 +2764,12 @@ PR ideas
|
||||||
:bind ("s-l" . launch-file))
|
:bind ("s-l" . launch-file))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
*** my-open-random-file :command:
|
||||||
|
:PROPERTIES:
|
||||||
|
:CUSTOM_ID: my-open-random-file
|
||||||
|
:END:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defun cp/open-random-file (&optional find-args dir cmd)
|
(defun my-open-random-file (&optional find-args dir cmd)
|
||||||
"Open a random file in DIR, prompting the user for it if not supplied."
|
"Open a random file in DIR, prompting the user for it if not supplied."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((find-args (if find-args find-args " -type f "))
|
(let* ((find-args (if find-args find-args " -type f "))
|
||||||
|
@ -2834,7 +2838,7 @@ PR ideas
|
||||||
;; (define-key archive-mode-map (kbd "j") 'cp/launch-file-archive)
|
;; (define-key archive-mode-map (kbd "j") 'cp/launch-file-archive)
|
||||||
|
|
||||||
;; 2018-02-28T21:00:57+0530
|
;; 2018-02-28T21:00:57+0530
|
||||||
(defun cp/corresponding-text-file ()
|
(defun my-corresponding-text-file ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(end-of-line)
|
(end-of-line)
|
||||||
|
@ -2856,7 +2860,8 @@ PR ideas
|
||||||
(dired-find-file)
|
(dired-find-file)
|
||||||
(launch-files-dired nil (dired-get-marked-files))))
|
(launch-files-dired nil (dired-get-marked-files))))
|
||||||
|
|
||||||
(defun contrapunctus-delete-file-at-point (&optional prefix)
|
(defun my-delete-file-at-point (&optional prefix)
|
||||||
|
"In text buffers, delete the file corresponding to the path on the current line."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(let ((file (buffer-substring (point-at-bol) (point-at-eol))))
|
(let ((file (buffer-substring (point-at-bol) (point-at-eol))))
|
||||||
(if (file-exists-p file)
|
(if (file-exists-p file)
|
||||||
|
@ -2873,7 +2878,8 @@ PR ideas
|
||||||
(message "Deleted %s" file))
|
(message "Deleted %s" file))
|
||||||
(error "File %s does not exist!" file))))
|
(error "File %s does not exist!" file))))
|
||||||
|
|
||||||
(defun contrapunctus-file-at-point-exists-p ()
|
(defun my-file-at-point-exists-p ()
|
||||||
|
"In text buffers, check if the file corresponding to the path on the current line exists."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((file (buffer-substring (point-at-bol)
|
(let ((file (buffer-substring (point-at-bol)
|
||||||
(point-at-eol))))
|
(point-at-eol))))
|
||||||
|
@ -2898,8 +2904,12 @@ PR ideas
|
||||||
(dired-mode . peep-dired))
|
(dired-mode . peep-dired))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
*** my-rename-this-file :command:
|
||||||
|
:PROPERTIES:
|
||||||
|
:CUSTOM_ID: my-rename-this-file
|
||||||
|
:END:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defun contrapunctus-rename-this-file ()
|
(defun my-rename-this-file ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(rename-file ;; message "will rename %s to %s"
|
(rename-file ;; message "will rename %s to %s"
|
||||||
(buffer-file-name (current-buffer))
|
(buffer-file-name (current-buffer))
|
||||||
|
@ -2908,6 +2918,19 @@ PR ideas
|
||||||
(buffer-file-name (current-buffer)))))
|
(buffer-file-name (current-buffer)))))
|
||||||
;; (rename-file (buffer-file-name (current-buffer)) new-name)
|
;; (rename-file (buffer-file-name (current-buffer)) new-name)
|
||||||
)
|
)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** my-delete-this-file :command:
|
||||||
|
:PROPERTIES:
|
||||||
|
:CUSTOM_ID: my-delete-this-file
|
||||||
|
:END:
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun my-delete-this-file ()
|
||||||
|
(interactive)
|
||||||
|
(when (y-or-n-p "Delete this file?")
|
||||||
|
(delete-file (buffer-file-name))
|
||||||
|
(image-next-file)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
@ -3225,7 +3248,8 @@ Even the patched version of =mu4e-alert= I'm using is not completely bug-free -
|
||||||
("W" . image-transform-fit-to-width)
|
("W" . image-transform-fit-to-width)
|
||||||
("H" . image-transform-fit-to-height)
|
("H" . image-transform-fit-to-height)
|
||||||
("o" . nil)
|
("o" . nil)
|
||||||
("R" . contrapunctus-rename-this-file)))
|
("R" . my-rename-this-file)
|
||||||
|
("D" . my-delete-this-file)))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** TODO magit [0%] :vc:
|
** TODO magit [0%] :vc:
|
||||||
|
|
Loading…
Reference in New Issue