My init currently has the following:

(defun font-lock-width-keyword (width)                                                                                                                                                                                           
  "Return a font-lock style keyword for a string beyond width WIDTH."                                                                                                                                                            
  `((,(format "^%s\\(.+\\)" (make-string width ?.))                                                                                                                                                                              
     (1 font-lock-warning-face t))))                                                                                                                                                                                             

(font-lock-add-keywords 'c++-mode (font-lock-width-keyword 80))                                                                                                                                                                  
(font-lock-add-keywords 'python-mode (font-lock-width-keyword 79))   

Is there any way to change the line font-lock-add-keywords to be dynamically called with the python mode hook, but to try to locate the dominating .pylintrc file, check if it has a line with max-line-length=x, and set the width to x, with a fallback of 79? I'm unfamiliar with elisp config-parsing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.