~a-roehler/python-mode/XEmacs-compat-test

« back to all changes in this revision

Viewing changes to highlight-indentation.el

  • Committer: Andreas Roehler
  • Date: 2011-09-27 15:55:50 UTC
  • Revision ID: andreas.roehler@online.de-20110927155550-e4zaqebdz0bzxxij
Portability of python-mode-tests.sh, fixes lp:858710 

This script tests python-mode with non-installed Emacsen in a Bash.

It assumes being in directory "test" below python-mode.el and relies on source-code directories as delivered by bzr branch.

Edit $EMACS_SOURCE_DIR to specify an Emacs or put "PATH-TO-EMACS-SOURCES" as shell argument.

To run tests with installed Emacs, load available test-files like "py-bug-numbered-tests.el" and do "M-x py-run-bug-numbered-tests" for example.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
  (let ((re (format "\\( \\) \\{%s\\}" (- highlight-indent-offset 1))))
71
71
    (if (not highlight-indent-active)
72
72
        (progn ;; Toggle on
73
 
    (set (make-local-variable 'highlight-indent-offset)
74
 
         (if indent-width
75
 
             indent-width
76
 
           ;; Set indentation offset according to major mode
77
 
           (cond ((eq major-mode 'python-mode)
78
 
                  (if (boundp 'python-indent)
79
 
                      python-indent
80
 
                    py-indent-offset))
81
 
                 ((eq major-mode 'ruby-mode)
82
 
                  ruby-indent-level)
83
 
                 ((eq major-mode 'nxml-mode)
84
 
                  nxml-child-indent)
85
 
                 ((local-variable-p 'c-basic-offset)
86
 
                  c-basic-offset)
87
 
                 (t
 
73
          (set (make-local-variable 'highlight-indent-offset)
 
74
               (if indent-width
 
75
                   indent-width
 
76
                 ;; Set indentation offset according to major mode
 
77
                 (cond ((eq major-mode 'python-mode)
 
78
                        (if (boundp 'python-indent)
 
79
                            python-indent
 
80
                          py-indent-offset))
 
81
                       ((eq major-mode 'ruby-mode)
 
82
                        ruby-indent-level)
 
83
                       ((eq major-mode 'nxml-mode)
 
84
                        nxml-child-indent)
 
85
                       ((local-variable-p 'c-basic-offset)
 
86
                        c-basic-offset)
 
87
                       (t
88
88
                        (default-value 'highlight-indent-offset)))))
89
 
        (set (make-local-variable 'highlight-indent-active) t)
 
89
          (set (make-local-variable 'highlight-indent-active) t)
90
90
          (if (featurep 'xemacs)
91
 
        (font-lock-add-keywords nil `((,re (1 'paren-face-match))))
 
91
              (font-lock-add-keywords nil `((,re (1 'paren-face-match))))
92
92
            (font-lock-add-keywords nil `((,re (1 'highlight-indent-face)))))
93
 
        (message (format "highlight-indentation with indent-width %s"
 
93
          (message (format "highlight-indentation with indent-width %s"
94
94
                           highlight-indent-offset)))
95
95
      ;; Toggle off
96
96
      (set (make-local-variable 'highlight-indent-active) nil)