From 89468837dbba9ae8c1bb662ade79670eeb97e65c Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 25 Mar 2013 11:53:46 +0800 Subject: [PATCH 1/6] * iswitchb.el (iswitchb-read-buffer): Fix typo. --- lisp/ChangeLog | 4 ++++ lisp/iswitchb.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8102cb56a97..bd4f0494123 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-03-25 Chong Yidong + + * iswitchb.el (iswitchb-read-buffer): Fix typo. + 2013-03-16 Leo Liu * progmodes/scheme.el: Add indentation and font-locking for λ. diff --git a/lisp/iswitchb.el b/lisp/iswitchb.el index 93d589c7706..e141a771c52 100644 --- a/lisp/iswitchb.el +++ b/lisp/iswitchb.el @@ -595,7 +595,7 @@ the selection process begins. Used by isearchb.el." ;; The map is generated every time so that it can inherit new ;; functions. (let ((map (copy-keymap minibuffer-local-map)) - buf-sel iswitchb-final-text map + buf-sel iswitchb-final-text icomplete-mode) ; prevent icomplete starting up (define-key map "?" 'iswitchb-completion-help) (define-key map "\C-s" 'iswitchb-next-match) From 4430bd53998ea752ce99b1c25384cf7cfabcef88 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 25 Mar 2013 10:16:31 +0100 Subject: [PATCH 2/6] * net/tramp.el (tramp-drop-volume-letter): Make it an ordinary defun. Defining it as defalias could introduce too eager byte-compiler optimization. (Bug#14030) --- lisp/ChangeLog | 6 ++++++ lisp/net/tramp.el | 19 ++++++------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bd4f0494123..d843e0fa703 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-03-25 Michael Albinus + + * net/tramp.el (tramp-drop-volume-letter): Make it an ordinary + defun. Defining it as defalias could introduce too eager + byte-compiler optimization. (Bug#14030) + 2013-03-25 Chong Yidong * iswitchb.el (iswitchb-read-buffer): Fix typo. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e392116d157..c4c8efcbfe8 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1565,23 +1565,16 @@ FILE must be a local file name on a connection identified via VEC." (tramp-compat-font-lock-add-keywords 'emacs-lisp-mode '("\\")) -(defalias 'tramp-drop-volume-letter - (if (memq system-type '(cygwin windows-nt)) - (lambda (name) - "Cut off unnecessary drive letter from file NAME. +(defun tramp-drop-volume-letter (name) + "Cut off unnecessary drive letter from file NAME. The functions `tramp-*-handle-expand-file-name' call `expand-file-name' locally on a remote file name. When the local system is a W32 system but the remote system is Unix, this introduces a superfluous drive letter into the file name. This function removes it." - (save-match-data - (if (string-match "\\`[a-zA-Z]:/" name) - (replace-match "/" nil t name) - name))) - - 'identity)) - -(if (featurep 'xemacs) - (defalias 'tramp-drop-volume-letter 'identity)) + (save-match-data + (if (string-match "\\`[a-zA-Z]:/" name) + (replace-match "/" nil t name) + name))) (defun tramp-cleanup (vec) "Cleanup connection VEC, but keep the debug buffer." From c9886b39eb33e444662f79d9eb649603fda6839a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Mon, 25 Mar 2013 22:55:11 -0300 Subject: [PATCH 3/6] Un-indent after "pass" and "return" statements * lisp/progmodes/python.el (python-indent-block-enders): New var. (python-indent-calculate-indentation): Use it. * test/automated/python-tests.el (python-indent-block-enders): New test. (python-info-current-defun-2): Fix test. Fixes: debbugs:13888 --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/python.el | 16 +++++++++++++--- test/ChangeLog | 6 ++++++ test/automated/python-tests.el | 30 ++++++++++++++++++++++++++---- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d843e0fa703..5783761a0b4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-03-26 Fabián Ezequiel Gallina + + Un-indent after "pass" and "return" statements (Bug#13888) + * progmodes/python.el (python-indent-block-enders): New var. + (python-indent-calculate-indentation): Use it. + 2013-03-25 Michael Albinus * net/tramp.el (tramp-drop-volume-letter): Make it an ordinary diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index c2739ce80a1..266d193cdda 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -628,6 +628,12 @@ It makes underscores and dots word constituent chars.") These make `python-indent-calculate-indentation' subtract the value of `python-indent-offset'.") +(defvar python-indent-block-enders '("return" "pass") + "List of words that mark the end of a block. +These make `python-indent-calculate-indentation' subtract the +value of `python-indent-offset' when `python-indent-context' is +AFTER-LINE.") + (defun python-indent-guess-indent-offset () "Guess and set `python-indent-offset' for the current buffer." (interactive) @@ -753,9 +759,13 @@ START is the buffer position where the sexp starts." (save-excursion (goto-char context-start) (current-indentation)) - (if (progn - (back-to-indentation) - (looking-at (regexp-opt python-indent-dedenters))) + (if (or (save-excursion + (back-to-indentation) + (looking-at (regexp-opt python-indent-dedenters))) + (save-excursion + (python-util-forward-comment -1) + (python-nav-beginning-of-statement) + (member (current-word) python-indent-block-enders))) python-indent-offset 0))) ;; When inside of a string, do nothing. just use the current diff --git a/test/ChangeLog b/test/ChangeLog index a2d657f57b5..d8b8fb661b5 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,9 @@ +2013-03-26 Fabián Ezequiel Gallina + + * automated/python-tests.el + (python-indent-block-enders): New test. + (python-info-current-defun-2): Fix test. + 2013-03-11 Glenn Morris * Version 24.3 released. diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el index 6b380e75257..c90393ab8bb 100644 --- a/test/automated/python-tests.el +++ b/test/automated/python-tests.el @@ -444,6 +444,28 @@ objects = Thing.objects.all() \\\\ (should (eq (car (python-indent-context)) 'after-line)) (should (= (python-indent-calculate-indentation) 0)))) +(ert-deftest python-indent-block-enders () + "Test `python-indent-block-enders' value honouring." + (python-tests-with-temp-buffer + " +Class foo(object): + + def bar(self): + if self.baz: + return (1, + 2, + 3) + + else: + pass +" + (python-tests-look-at "3)") + (forward-line 1) + (= (python-indent-calculate-indentation) 12) + (python-tests-look-at "pass") + (forward-line 1) + (= (python-indent-calculate-indentation) 8))) + ;;; Navigation @@ -1546,13 +1568,13 @@ class C(object): return [] def b(): - pass + do_b() def a(): - pass + do_a() def c(self): - pass + do_c() " (forward-line 1) (should (string= "C" (python-info-current-defun))) @@ -1582,7 +1604,7 @@ class C(object): (python-tests-look-at "def c(self):") (should (string= "C.c" (python-info-current-defun))) (should (string= "def C.c" (python-info-current-defun t))) - (python-tests-look-at "pass") + (python-tests-look-at "do_c()") (should (string= "C.c" (python-info-current-defun))) (should (string= "def C.c" (python-info-current-defun t))))) From ca54aaa2853dab4961a93e5e4a32faa7dabbcb66 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 30 Mar 2013 09:37:47 -0700 Subject: [PATCH 4/6] Backport copyright fix from trunk --- etc/srecode/ede-autoconf.srt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/srecode/ede-autoconf.srt b/etc/srecode/ede-autoconf.srt index d2ec61a0a93..1cf53256026 100644 --- a/etc/srecode/ede-autoconf.srt +++ b/etc/srecode/ede-autoconf.srt @@ -1,6 +1,6 @@ ;; ede/templates/autoconf.srt --- Templates for autoconf used by EDE. ;; -;; Copyright (C) 2010 Eric M. Ludlam +;; Copyright (C) 2010, 2012-2013 Free Software Foundation, Inc. ;; ;; Author: Eric M. Ludlam ;; From 4d73ec07d482503843f5919cb179628413e2b9b4 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 30 Mar 2013 09:42:17 -0700 Subject: [PATCH 5/6] Relicense under GPLv3 or later --- etc/srecode/ede-autoconf.srt | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/etc/srecode/ede-autoconf.srt b/etc/srecode/ede-autoconf.srt index 1cf53256026..ce7ac024b4f 100644 --- a/etc/srecode/ede-autoconf.srt +++ b/etc/srecode/ede-autoconf.srt @@ -1,21 +1,23 @@ -;; ede/templates/autoconf.srt --- Templates for autoconf used by EDE. -;; -;; Copyright (C) 2010, 2012-2013 Free Software Foundation, Inc. -;; -;; Author: Eric M. Ludlam -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 2, or (at -;; your option) any later version. +;;; ede/templates/autoconf.srt --- Templates for autoconf used by EDE -;; This program is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. +;; Copyright (C) 2010, 2012-2013 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . set mode "autoconf-mode" set escape_start "{{" From b011a6e8011c51e09f28d528a541509c17d4eed0 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 30 Mar 2013 09:52:28 -0700 Subject: [PATCH 6/6] Standardize license notice --- lisp/profiler.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/profiler.el b/lisp/profiler.el index 04a171a6cb2..25309ecceda 100644 --- a/lisp/profiler.el +++ b/lisp/profiler.el @@ -5,18 +5,20 @@ ;; Author: Tomohiro Matsuyama ;; Keywords: lisp -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: