문제

some times i have comments to my code at different structure levels, for example the following python code:

# level one comment
for i in list:
    # level two comment
    if mod(i, 2):
        # level three comment
        print 'odd number'
    else:
        print 'even number

i want to have different font size (or slightly different color) for different level of comments, is there such a package to do something like this? also, for example for elisp code, i usually add comments to different levels with different number of heading chars ;, for example:

;;; level 1 comments
(sexp level 1
  ;; level 2 comments
  (sexp level 2
     ; level 3 and >3 coments 
       (sexp level 3)))

if i can display the comments of different levels using different faces, that can greatly help to review and understand the structures of my code. thanks!

도움이 되었습니까?

해결책

The face used to display comments and strings is decided by the function set in font-lock-syntactic-face-function. So you can just set that variable to a function of your own which can take the number of semi-colons, or the indentation as a cue to choose different faces.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top