summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/emacs/modules/mm-abbrev.el4
-rw-r--r--.config/emacs/modules/mm-keybindings.el4
-rw-r--r--.config/emacs/site-lisp/gh.el4
-rw-r--r--.config/emacs/site-lisp/html-escape.el55
4 files changed, 63 insertions, 4 deletions
diff --git a/.config/emacs/modules/mm-abbrev.el b/.config/emacs/modules/mm-abbrev.el
index 0f37cda..d32ec0d 100644
--- a/.config/emacs/modules/mm-abbrev.el
+++ b/.config/emacs/modules/mm-abbrev.el
@@ -79,7 +79,7 @@ case-sensitive to avoid unexpected abbreviation expansions."
"sr" "save-restriction")
(when mm-humanwave-p
- (with-eval-after-load 'python-ts-mode
+ (with-eval-after-load 'python
(mm-define-abbreviations python-ts-mode-abbrev-table
"empb" "with emphasize.Block():"
"empf" "@emphasize.func"
@@ -107,4 +107,4 @@ case-sensitive to avoid unexpected abbreviation expansions."
#'tempel-complete -10 :local))))
(add-to-list 'auto-mode-alist (cons tempel-path #'lisp-data-mode)))
-(provide 'mm-abbrev) \ No newline at end of file
+(provide 'mm-abbrev)
diff --git a/.config/emacs/modules/mm-keybindings.el b/.config/emacs/modules/mm-keybindings.el
index a5919de..3aa548e 100644
--- a/.config/emacs/modules/mm-keybindings.el
+++ b/.config/emacs/modules/mm-keybindings.el
@@ -124,6 +124,8 @@ the first command is remapped to the second command."
"C-M-@" #'mm-add-cursor-to-next-word
+ "C-c c a" #'mc/vertical-align-with-space
+ "C-c c i" #'mc/insert-numbers
"C-c c t" #'mm-transpose-cursor-regions
"C-c d" #'duplicate-dwim
"C-c t a" #'e/align-regexp
@@ -153,4 +155,4 @@ the first command is remapped to the second command."
(which-key-ellipsis "…")
(wihch-key-idle-delay .5))
-(provide 'mm-keybindings) \ No newline at end of file
+(provide 'mm-keybindings)
diff --git a/.config/emacs/site-lisp/gh.el b/.config/emacs/site-lisp/gh.el
index 23086e5..9f7d348 100644
--- a/.config/emacs/site-lisp/gh.el
+++ b/.config/emacs/site-lisp/gh.el
@@ -26,7 +26,9 @@ via `gh-get-labels'."
(label-string (mapconcat #'identity labels ",")))
;; TODO: Remove this
(when (string= project "blixem")
- (setq title (format "%s %s" (car (vc-git-branches)) title)))
+ (setq title (format "%s %s" (car (vc-git-branches)) title))
+ (when (member "Patch" labels)
+ (setq flags (append flags '("--base" "release")))))
(setq flags (append flags `("--title" ,title)))
(when draftp
(setq flags (append flags '("--draft"))))
diff --git a/.config/emacs/site-lisp/html-escape.el b/.config/emacs/site-lisp/html-escape.el
new file mode 100644
index 0000000..afdbb4d
--- /dev/null
+++ b/.config/emacs/site-lisp/html-escape.el
@@ -0,0 +1,55 @@
+;;; html-escape.el --- HTML escaping functions -*- lexical-binding: t; -*-
+
+(defgroup html-escape nil
+ "Customization group for `html-escape'."
+ :group 'convenience)
+
+(defvar html-escape-table
+ (let ((table (make-hash-table :test #'eq)))
+ (puthash ?& "&" table)
+ (puthash ?< "&lt;" table)
+ (puthash ?> "&gt;" table)
+ (puthash ?\" "&quot;" table)
+ (puthash ?' "&#39;" table)
+ table)
+ "Hash table mapping character codes to their HTML entity equivalents.")
+
+;;;###autoload
+(defun html-escape ()
+ "HTML escape text in the current buffer.
+
+Perform HTML escaping on the text in the current buffer. If the region
+is active then only escape the contents of the active region."
+ (declare (interactive-only t))
+ (interactive)
+ (if (use-region-p)
+ (html-escape-region (region-bounds))
+ (html-escape-region-1 (pos-bol) (pos-eol)))
+ (when (region-active-p)
+ (deactivate-mark)))
+
+(defun html-escape-region (bounds)
+ "HTML escape text in the current buffer within BOUNDS.
+
+BOUNDS takes the same form as the return value of `region-bounds'. This
+function is prefered as it supports noncontiguous regions, but there also
+exists `html-escape-region-1' with a simpler bounds interface."
+ (dolist (x bounds) (html-escape-region-1 (car x) (cdr x))))
+
+(defun html-escape-region-1 (beg end)
+ "HTML escape text in the current buffer within BEG and END.
+
+This function is the same as the prefered `html-escape-region', but takes
+BEG and END parameters instead of a BOUNDS parameter. For noncontiguous
+region support use `html-escape-region'."
+ (save-restriction
+ (narrow-to-region beg end)
+ (save-excursion
+ (goto-char (point-min))
+ (save-match-data
+ (while (re-search-forward "[&<>\"']" nil :noerror)
+ (let* ((char (char-after (match-beginning 0)))
+ (replacement (gethash char html-escape-table)))
+ (replace-match replacement)))))))
+
+(provide 'html-escape)