s#a#b# # comment #### (defun my-indent-for-comment (arg) "DWIM indent-for-comment v0.04" (interactive "p") (cperl-update-syntaxification (point) (point)) (if (and (not (memq (preceding-char) '(?$) )) ;; (memq (preceding-char) '( ?\; ?{ ?\( ?\[ ) ) (memq (get-text-property (point) 'face) '(cperl-my-trailing-spaces-face nil)) (not (get-text-property (point) 'syntax-type)) (looking-at "[[:space:]]*$") ) (cperl-indent-for-comment) (insert "#")) )