Emacs: Add functions for ascii/digit conv and full month calendar
This commit is contained in:
		
							parent
							
								
									285f2e92cc
								
							
						
					
					
						commit
						eadf75cbe8
					
				| @ -491,6 +491,23 @@ Ligatures... are they that useful? | ||||
| (require 'ligature) | ||||
| (global-ligature-mode) | ||||
| #+end_src | ||||
| ** Random Functions | ||||
| #+begin_src emacs-lisp | ||||
| 
 | ||||
| (defun joe/print-digit-as-ascii (digit) | ||||
|   (string-match-p "^\\(?:0\\|[1-9][0-9]*\\)$" digit)) | ||||
| 
 | ||||
| (defun joe/get-ascii-in-region (beg end) | ||||
|   (interactive "r") | ||||
|   (if (use-region-p) | ||||
|       (message "%s" | ||||
|        (concat | ||||
|         (mapcar 'string-to-number | ||||
|                 (split-string (buffer-substring-no-properties beg end) " ")))) | ||||
|     (message "No region selected"))) | ||||
| 
 | ||||
| (define-key ctl-x-x-map (kbd "a") #'joe/get-ascii-in-region) | ||||
| #+end_src | ||||
| ** Text | ||||
| 
 | ||||
| #+begin_src emacs-lisp | ||||
| @ -922,6 +939,7 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun | ||||
| 
 | ||||
| (defun joe/qtile-move-dir (dir) | ||||
|   (start-process "qtile-dir" nil "qtile" "cmd-obj" "-o" "layout" "-f" dir)) | ||||
|   ;; (start-process "qtile-dir" nil "qtile" "cmd-obj" "-o" "layout" "-f" "right")) | ||||
| 
 | ||||
| (defun joe/windmove-left () | ||||
|   (interactive) | ||||
| @ -947,10 +965,15 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun | ||||
|       (windmove-down) | ||||
|     (joe/qtile-move-dir "down"))) | ||||
| 
 | ||||
| (global-set-key (kbd "s-h") #'joe/windmove-left) | ||||
| (global-set-key (kbd "s-l") #'joe/windmove-right) | ||||
| (global-set-key (kbd "s-k") #'joe/windmove-up) | ||||
| (global-set-key (kbd "s-j") #'joe/windmove-down) | ||||
| ;; (global-set-key (kbd "s-h") #'joe/windmove-left) | ||||
| ;; (global-set-key (kbd "s-l") #'joe/windmove-right) | ||||
| ;; (global-set-key (kbd "s-k") #'joe/windmove-up) | ||||
| ;; (global-set-key (kbd "s-j") #'joe/windmove-down) | ||||
| 
 | ||||
| (global-set-key (kbd "s-h") #'windmove-left) | ||||
| (global-set-key (kbd "s-l") #'windmove-right) | ||||
| (global-set-key (kbd "s-k") #'windmove-up) | ||||
| (global-set-key (kbd "s-j") #'windmove-down) | ||||
| 
 | ||||
| ;; There's a bug in Gnome where frames are resized to the wrong dimensions | ||||
| (defun joe/resize-frames () | ||||
| @ -2255,14 +2278,13 @@ it doesn't close it. | ||||
|   (c-toggle-comment-style -1)) | ||||
| (add-hook 'c-mode-hook #'joe/c-mode-hook) | ||||
| #+end_src | ||||
| *** COMMENT Haskell | ||||
| *** Haskell | ||||
| #+begin_src emacs-lisp | ||||
|   (require 'haskell-mode) | ||||
|   (setq haskell-interactive-popup-errors nil) | ||||
|   (when (boundp 'evil-mode) | ||||
| 
 | ||||
|   (evil-define-key 'insert haskell-interactive-mode-map (kbd "C-n") #'haskell-interactive-mode-history-next) | ||||
|   (evil-define-key 'insert haskell-interactive-mode-map (kbd "C-p") #'haskell-interactive-mode-history-previous)) | ||||
|   (evil-define-key 'insert haskell-interactive-mode-map (kbd "C-p") #'haskell-interactive-mode-history-previous) | ||||
| 
 | ||||
| #+end_src | ||||
| *** COMMENT Clojure | ||||
| @ -2554,6 +2576,27 @@ with the cursor you hit TAB and you complete the following; | ||||
| #+begin_src emacs-lisp | ||||
| (require 'org-kanban) | ||||
| #+end_src | ||||
| ** Calendar | ||||
| #+begin_src emacs-lisp | ||||
| (require 'cl) | ||||
| (require 'calendar) | ||||
| 
 | ||||
| (defun twelve-month-calendar () | ||||
|   (interactive) | ||||
|   (let ((calendar-buffer (get-buffer-create "12-month calendar")) | ||||
|         (month 12) | ||||
|         (year 2012)) | ||||
|     (set-buffer calendar-buffer) | ||||
|     (setq calendar-frame (make-frame)) | ||||
|     (make-variable-buffer-local 'font-lock-face) | ||||
|     (set-face-attribute 'default calendar-frame :height 70) | ||||
|     (set-frame-width calendar-frame 300) | ||||
|     (erase-buffer) | ||||
|     (dotimes (i 12) | ||||
|       (calendar-generate-month month year 0) | ||||
|       (calendar-increment-month month year -1)) | ||||
|     (calendar-mode))) | ||||
| #+end_src | ||||
| ** Magit | ||||
| 
 | ||||
| The best git porcelain/client I've ever used. Also kill stray magit buffers left | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user