branch: externals/a68-mode commit 9b01bd636d05803ff587135d7bb696e0b9b91ab0 Author: Jose E. Marchesi <jose.march...@oracle.com> Commit: Jose E. Marchesi <jose.march...@oracle.com>
Support smart # ... # comment typing --- a68-mode.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/a68-mode.el b/a68-mode.el index 41ee72656b..deb1fbb72b 100644 --- a/a68-mode.el +++ b/a68-mode.el @@ -71,6 +71,7 @@ (defvar a68-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-j") #'newline-and-indent) + (define-key map (kbd "#") #'a68-comment-hash) ;; (define-key map (kbd "RET") #'a68-electric-terminate-line) map) "Keymap for Algol 68 major mode.") @@ -228,6 +229,15 @@ (define-abbrev-table 'a68-mode-abbrev-table '()) +(defun a68-comment-hash () + "Smart insert a # ... # style comment." + (interactive) + (if (a68-within-comment) + (insert "#") + (save-excursion + (insert "# #")) + (goto-char (+ (point) 2)))) + ;;;###autoload (define-derived-mode a68-mode prog-mode "Algol68" "Major mode for editing Alogl68 files."