]> code.delx.au - gnu-emacs/commitdiff
Shut up python-mode's indentation guesser
authorDaniel Colascione <dancol@dancol.org>
Thu, 26 Mar 2015 20:44:45 +0000 (13:44 -0700)
committerDaniel Colascione <dancol@dancol.org>
Thu, 26 Mar 2015 20:46:06 +0000 (13:46 -0700)
* lisp/progmodes/python.el
(python-indent-guess-indent-offset-verbose): New defcustom.
(python-indent-guess-indent-offset): Use it.

lisp/ChangeLog
lisp/progmodes/python.el

index 294bcfe7fb6fac6009d97d129582e7331090abc8..0cc7bc6f7025f44e531e97cf768f28027ca94e94 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-26  Daniel Colascione  <dancol@dancol.org>
+       * progmodes/python.el
+       (python-indent-guess-indent-offset-verbose): New defcustom.
+       (python-indent-guess-indent-offset): Use it.
+
 2015-03-26  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * emacs-lisp/eieio.el (defclass): Change internal name so as to make
index 42272a9d55833038e22c66b58389186014ca5f32..67b44aa1bbe67dd63935cef1f292d388c3aece85 100644 (file)
@@ -696,6 +696,12 @@ It makes underscores and dots word constituent chars.")
   :group 'python
   :safe 'booleanp)
 
+(defcustom python-indent-guess-indent-offset-verbose t
+  "Non-nil means to emit a warning when indentation guessing fails."
+  :type 'boolean
+  :group 'python
+  :safe' booleanp)
+
 (defcustom python-indent-trigger-commands
   '(indent-for-tab-command yas-expand yas/expand)
   "Commands that might trigger a `python-indent-line' call."
@@ -766,8 +772,9 @@ work on `python-indent-calculate-indentation' instead."
                  (current-indentation))))
           (if (and indentation (not (zerop indentation)))
               (set (make-local-variable 'python-indent-offset) indentation)
-            (message "Can't guess python-indent-offset, using defaults: %s"
-                     python-indent-offset)))))))
+            (when python-indent-guess-indent-offset-verbose
+              (message "Can't guess python-indent-offset, using defaults: %s"
+                       python-indent-offset))))))))
 
 (defun python-indent-context ()
   "Get information about the current indentation context.