Open BlameTroi opened 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.
Colon can also trigger electric behavior.
The proper comment delimiters for Pascal are curly braces { } but they are not handled as well as the older digraph ( ) comments.