From: Bruno Haible Date: Wed, 19 Apr 2017 10:01:45 +0000 (+0200) Subject: PO mode: Fix recognition of C and C++ modes. X-Git-Tag: v0.20~472 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99c9002cb1fb89189ca21b98ee74091d67122a58;p=thirdparty%2Fgettext.git PO mode: Fix recognition of C and C++ modes. The variable 'mode-name' can contain a suffix, see https://www.gnu.org/software/emacs/manual/html_node/ccmode/Minor-Modes.html https://www.gnu.org/software/emacs/manual/html_node/emacs/Electric-C.html Therefore use 'major-mode' instead of 'mode-name'. * gettext-tools/misc/po-mode.el (po-preset-string-functions): Test major-mode, not mode-name. (po-mode-version-string): Bump to 2.25. Reported at by Peter Hull . --- diff --git a/gettext-tools/misc/po-mode.el b/gettext-tools/misc/po-mode.el index 07a5014c3..7d3659812 100644 --- a/gettext-tools/misc/po-mode.el +++ b/gettext-tools/misc/po-mode.el @@ -1,6 +1,6 @@ ;;; po-mode.el --- major mode for GNU gettext PO files -;; Copyright (C) 1995-2002, 2005-2008, 2010, 2015-2016 Free Software +;; Copyright (C) 1995-2002, 2005-2008, 2010, 2015-2017 Free Software ;; Foundation, Inc. ;; Authors: François Pinard @@ -63,7 +63,7 @@ ;;; Code: -(defconst po-mode-version-string "2.24" "\ +(defconst po-mode-version-string "2.25" "\ Version number of this version of po-mode.el.") ;;; Emacs portability matters - part I. @@ -2930,15 +2930,15 @@ keyword for subsequent commands, also added to possible completions." (defun po-preset-string-functions () "Preset FIND-STRING-FUNCTION and MARK-STRING-FUNCTION according to mode. These variables are locally set in source buffer only when not already bound." - (let ((pair (cond ((string-equal mode-name "AWK") + (let ((pair (cond ((equal major-mode 'awk-mode) '(po-find-awk-string . po-mark-awk-string)) - ((member mode-name '("C" "C++")) + ((member major-mode '(c-mode c++-mode)) '(po-find-c-string . po-mark-c-string)) - ((string-equal mode-name "Emacs-Lisp") + ((equal major-mode 'emacs-lisp-mode) '(po-find-emacs-lisp-string . po-mark-emacs-lisp-string)) - ((string-equal mode-name "Python") + ((equal major-mode 'python-mode) '(po-find-python-string . po-mark-python-string)) - ((and (string-equal mode-name "Shell-script") + ((and (equal major-mode 'sh-mode) (string-equal mode-line-process "[bash]")) '(po-find-bash-string . po-mark-bash-string)) (t '(po-find-unknown-string . po-mark-unknown-string)))))