BlameTroi / progmodes

working on pascal-mode for emacs
GNU General Public License v3.0
0 stars 0 forks source link

handle comment braces correctly #2

Open BlameTroi opened 8 months ago

BlameTroi commented 8 months ago

The proper comment delimiters for Pascal are curly braces { } but they are not handled as well as the older digraph ( ) comments.

BlameTroi commented 8 months ago

Indenting is still not right, but I was able to fix the electric-pascal-semi-or-dot function so that it would not fire an electric indent off if the point was in a comment.

still more to do, but here's the pertinent function:

;; txb: this expression is the recommended way to detect if comment, see doc for parse-partial-sexp in pascal-within-string ;;(nth 4 (syntax-ppss)) (defun electric-pascal-semi-or-dot () "Insert ;' or.' character and reindent the line." (interactive) (insert last-command-event) (if (nth 4 (syntax-ppss)) ;; within comment? () (save-excursion (beginning-of-line) (pascal-indent-line)) (if pascal-auto-newline (electric-pascal-terminate-line))))

work is ongoing in my conflagration repository. the above was part of commit 30fe05d there but the diff is too large to be much use. I had an old ca 2013 copy of pascal.el in my site-lisp, and overlaid it with the 2023 copy and started changing it. I'll pull that change back over here but work in progress will be done in that repo.

BlameTroi commented 8 months ago

Colon can also trigger electric behavior.