0Oo 1iIl {}{}()()[[]] a_b__c 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 const xah_range = ( min, max, step = 1, ) => (Array(Math.floor((max - min) / step) + 1).fill(min).map(( x, i, ) => (x + i * step))); /* return the hexadecimal string of the char's utf16 encoding. string is separated by space for each char */ const f_charID_to_utf16_hexStr = (CharID: number): string => { const xCharStr = String.fromCodePoint(CharID) if (CharID < 2 ** 16) { return xCharStr.charCodeAt(0).toString(16).toUpperCase() } else { const xLen = String.fromCodePoint(CharID).length const xResultArray = [] for (let i = 0; i < xLen; i++) { xResultArray.push(xCharStr.charCodeAt(i).toString(16).toUpperCase()) } return xResultArray.join(" ") } } (defun xah-upcase-sentence () "Upcase first letters of sentences of current block or selection. URL `http://xahlee.info/emacs/emacs/emacs_upcase_sentence.html' Created: 2020-12-08 Version: 2025-03-25" (interactive) (let (xbeg xend) (seq-setq (xbeg xend) (if (region-active-p) (list (region-beginning) (region-end)) (list (save-excursion (if (re-search-backward "\n[ \t]*\n" nil 1) (match-end 0) (point))) (save-excursion (if (re-search-forward "\n[ \t]*\n" nil 1) (match-beginning 0) (point)))))) (save-restriction (narrow-to-region xbeg xend) (let ((case-fold-search nil)) ;; after period or question mark or exclamation (goto-char (point-min)) (while (re-search-forward "\\(\\.\\|\\?\\|!\\)[ \n]+ *\\([a-z]\\)" nil 1) (upcase-region (match-beginning 2) (match-end 2)) (overlay-put (make-overlay (match-beginning 2) (match-end 2)) 'face 'highlight)) ;; after a blank line, after a bullet, or beginning of buffer (goto-char (point-min)) (while (re-search-forward "\\(\\`\\|• \\|\n\n\\)\\([a-z]\\)" nil 1) (upcase-region (match-beginning 2) (match-end 2)) (overlay-put (make-overlay (match-beginning 2) (match-end 2)) 'face 'highlight)) ;; for HTML. first letter after tag (when (or (eq major-mode 'xah-html-mode) (eq major-mode 'html-mode) (eq major-mode 'sgml-mode) (eq major-mode 'nxml-mode) (eq major-mode 'xml-mode) (eq major-mode 'mhtml-mode)) (goto-char (point-min)) (while (re-search-forward "\\([ \n]?\\|<h[1-6]>[ \n]?\\|<p>[ \n]?\\|<li>[ \n]?\\|<dd>[ \n]?\\|<td>[ \n]?\\|<br ?/?>[ \n]?\\|<figcaption>[ \n]?\\)\\([a-z]\\)" nil 1) (upcase-region (match-beginning 2) (match-end 2)) (overlay-put (make-overlay (match-beginning 2) (match-end 2)) 'face 'highlight)))) (goto-char (point-max))) (skip-chars-forward " \n\t")))