summaryrefslogtreecommitdiff
path: root/.emacs
diff options
context:
space:
mode:
Diffstat (limited to '.emacs')
-rw-r--r--.emacs80
1 files changed, 40 insertions, 40 deletions
diff --git a/.emacs b/.emacs
index 3ea852e..dcc0a7d 100644
--- a/.emacs
+++ b/.emacs
@@ -58,6 +58,8 @@
;; Pictograms
'("/!\\" ?⚠)))
+;; C-c [[:alpha:]] is reserved for users - let's make good use of it.
+
(defun my/make-toggle-input-method (input-method)
(lambda ()
(:documentation (format "Toggle `%s' input method." input-method))
@@ -68,7 +70,36 @@
(deactivate-input-method)
(set-input-method input-method t))))
-;; C-c [[:alpha:]] is reserved for users - let's make good use of it.
+(defun my/set-tab-width (&optional arg)
+ (interactive "P")
+ (let ((new-width (cond (arg (prefix-numeric-value arg))
+ ((= tab-width 4) 8)
+ (4)))
+ (old-width tab-width))
+ ;; TODO: for some reason, set-variable takes effect immediately,
+ ;; but setq(-local)? do not: I need to move the cursor before tabs
+ ;; are re-drawn.
+ (set-variable 'tab-width new-width)
+ (message "changed from %s to %s" old-width new-width)))
+
+(defun my/kill-ring-filename ()
+ (interactive)
+ (kill-new (or (buffer-file-name) default-directory)))
+
+(defun my/kill-ring-pipe-region (command)
+ (interactive (list (read-shell-command "Shell command on region: ")))
+ (let ((input (funcall region-extract-function nil)))
+ (with-temp-buffer
+ (insert input)
+ (call-process-region (point-min) (point-max) shell-file-name
+ t t nil shell-command-switch command)
+ (kill-new (buffer-string)))))
+
+(defun my/kill-ring-shell (command)
+ (interactive (list (read-shell-command "Shell command: ")))
+ (with-temp-buffer
+ (call-process-shell-command command nil t)
+ (kill-new (buffer-string))))
(global-set-key (kbd "C-c c") 'compile)
(global-set-key (kbd "C-c e f") 'auto-fill-mode)
@@ -177,6 +208,14 @@
(add-to-list 'compilation-finish-functions 'my/compilation-notify)
+(defun my/make-tabless (f)
+ "Make a function which will run F with `indent-tabs-mode' disabled."
+ (lambda ()
+ (:documentation (format "Run `%s' with `indent-tabs-mode' set to nil." f))
+ (interactive)
+ (let ((indent-tabs-mode nil))
+ (call-interactively f))))
+
(defun my/makefile-hook ()
;; I would rather align backslashes with spaces rather than tabs;
;; however, I would also like indent-tabs-mode to remain non-nil.
@@ -251,45 +290,6 @@
;; Helper functions and miscellaneous settings.
-(defun my/make-tabless (f)
- "Make a function which will run F with `indent-tabs-mode' disabled."
- (lambda ()
- (:documentation (format "Run `%s' with `indent-tabs-mode' set to nil." f))
- (interactive)
- (let ((indent-tabs-mode nil))
- (call-interactively f))))
-
-(defun my/set-tab-width (&optional arg)
- (interactive "P")
- (let ((new-width (cond (arg (prefix-numeric-value arg))
- ((= tab-width 4) 8)
- (4)))
- (old-width tab-width))
- ;; TODO: for some reason, set-variable takes effect immediately,
- ;; but setq(-local)? do not: I need to move the cursor before tabs
- ;; are re-drawn.
- (set-variable 'tab-width new-width)
- (message "changed from %s to %s" old-width new-width)))
-
-(defun my/kill-ring-filename ()
- (interactive)
- (kill-new (or (buffer-file-name) default-directory)))
-
-(defun my/kill-ring-pipe-region (command)
- (interactive (list (read-shell-command "Shell command on region: ")))
- (let ((input (funcall region-extract-function nil)))
- (with-temp-buffer
- (insert input)
- (call-process-region (point-min) (point-max) shell-file-name
- t t nil shell-command-switch command)
- (kill-new (buffer-string)))))
-
-(defun my/kill-ring-shell (command)
- (interactive (list (read-shell-command "Shell command: ")))
- (with-temp-buffer
- (call-process-shell-command command nil t)
- (kill-new (buffer-string))))
-
(defun my/froggify ()
(ispell-change-dictionary "fr")
(setq-local colon-double-space nil)