Merged.

Pascal J. Bourguignon [2018-03-31 21:36]
Merged.
Filename
pjb-emacs.el
pjb-erc.el
diff --git a/pjb-emacs.el b/pjb-emacs.el
index 750336a..38c5868 100644
--- a/pjb-emacs.el
+++ b/pjb-emacs.el
@@ -137,6 +137,7 @@


 (defun recover-this-file ()
+  "Recovers the file of the current buffer, if any."
   (interactive)
   (let ((file-path  (buffer-file-name)))
     (if (and file-path (file-exists-p file-path) (file-regular-p file-path))
@@ -144,6 +145,19 @@
         (message "This buffer has no associated file."))))


+(defun delete-this-file (kill-buffer)
+  "Deletes the file of the current buffer, if any.
+When KILL-BUFFER is true (command prefix), also kills the buffer."
+  (interactive "P")
+  (let ((file-path  (buffer-file-name)))
+    (if (and file-path (file-exists-p file-path) (file-regular-p file-path))
+        (progn
+          (delete-file file-path)
+          (when kill-buffer
+            (kill-buffer)))
+        (message "This buffer has no associated file."))))
+
+
 (defvar buffer-name-map   nil)
 (defvar buffer-list-cache nil)

diff --git a/pjb-erc.el b/pjb-erc.el
index 575258a..2fdef8b 100644
--- a/pjb-erc.el
+++ b/pjb-erc.el
@@ -1124,8 +1124,10 @@ command).
                (("#emacs")
                 . el-eval-last-expression)
                (("#scheme")
-                . scheme-eval-last-expression))
-        when (member* current-channel channels :test (function string=))
+                . scheme-eval-last-expression)
+               (t . cl-eval-last-expression))
+        when (or (eql channels t)
+                 (member* current-channel channels :test (function string=)))
           do (local-set-key (kbd "C-x C-e") eval-function)))

 (add-hook 'erc-join-hook 'pjb/erc-join-meat)
ViewGit