X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/b89a6b600b0f0acac4466bef69c9820b51574c4f..0b5c5d8291f82556c149013f10372234b0df9bc2:/lisp/progmodes/vera-mode.el diff --git a/lisp/progmodes/vera-mode.el b/lisp/progmodes/vera-mode.el index c70ec7eab6..b80f60f524 100644 --- a/lisp/progmodes/vera-mode.el +++ b/lisp/progmodes/vera-mode.el @@ -1,7 +1,7 @@ ;;; vera-mode.el --- major mode for editing Vera files. ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -;; 2006, 2007 Free Software Foundation, Inc. +;; 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. ;; Author: Reto Zimmermann ;; Maintainer: Reto Zimmermann @@ -9,6 +9,11 @@ ;; Keywords: languages vera ;; WWW: http://www.iis.ee.ethz.ch/~zimmi/emacs/vera-mode.html +;; Yoni Rabkin contacted the maintainer of this +;; file on 18/3/2008, and the maintainer agreed that when a bug is +;; filed in the Emacs bug reporting system against this file, a copy +;; of the bug report be sent to the maintainer's email address. + (defconst vera-version "2.18" "Vera Mode version number.") @@ -17,10 +22,10 @@ ;; This file is part of GNU Emacs. -;; GNU Emacs is free software; you can redistribute it and/or modify +;; 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 2, or (at your option) -;; any later version. +;; 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 @@ -28,9 +33,7 @@ ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see . ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Commentary: @@ -77,10 +80,6 @@ ;;; Code: -;; XEmacs handling -(defconst vera-xemacs (string-match "XEmacs" emacs-version) - "Non-nil if XEmacs is used.") - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -231,7 +230,7 @@ If nil, TAB always indents current line." (modify-syntax-entry ?\{ "(}" syntax-table) (modify-syntax-entry ?\} "){" syntax-table) ;; comment - (if vera-xemacs + (if (featurep 'xemacs) (modify-syntax-entry ?\/ ". 1456" syntax-table) ; XEmacs (modify-syntax-entry ?\/ ". 124b" syntax-table)) ; Emacs (modify-syntax-entry ?\* ". 23" syntax-table) @@ -251,10 +250,10 @@ If nil, TAB always indents current line." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Mode definition -;;;###autoload (add-to-list 'auto-mode-alist '("\\.vr[hi]?\\'" . vera-mode)) +;;;###autoload (add-to-list 'auto-mode-alist (cons (purecopy "\\.vr[hi]?\\'") 'vera-mode)) ;;;###autoload -(defun vera-mode () +(define-derived-mode vera-mode prog-mode "Vera" "Major mode for editing Vera code. Usage: @@ -292,7 +291,7 @@ Add a description of the problem and include a reproducible test case. Feel free to send questions and enhancement requests to . Official distribution is at -. +URL `http://www.iis.ee.ethz.ch/~zimmi/emacs/vera-mode.html' The Vera Mode Maintainer @@ -302,13 +301,6 @@ Key bindings: ------------- \\{vera-mode-map}" - (interactive) - (kill-all-local-variables) - (setq major-mode 'vera-mode) - (setq mode-name "Vera") - ;; set maps and tables - (use-local-map vera-mode-map) - (set-syntax-table vera-mode-syntax-table) ;; set local variables (require 'cc-cmds) (set (make-local-variable 'comment-start) "//") @@ -329,9 +321,7 @@ Key bindings: ;; add menu (XEmacs) (easy-menu-add vera-mode-menu) ;; miscellaneous - (message "Vera Mode %s. Type C-c C-h for documentation." vera-version) - ;; run hooks - (run-hooks 'vera-mode-hook)) + (message "Vera Mode %s. Type C-c C-h for documentation." vera-version)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -600,7 +590,7 @@ Key bindings: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; XEmacs compatibility -(when vera-xemacs +(when (featurep 'xemacs) (require 'font-lock) (copy-face 'font-lock-reference-face 'font-lock-constant-face) (copy-face 'font-lock-preprocessor-face 'font-lock-builtin-face)) @@ -771,7 +761,7 @@ the offset is simply returned." relpos 0) (setq offset (vera-evaluate-offset offset langelem symbol))) (+ (if (and relpos - (< relpos (save-excursion (beginning-of-line) (point)))) + (< relpos (line-beginning-position))) (save-excursion (goto-char relpos) (current-column)) @@ -1262,7 +1252,9 @@ If `vera-intelligent-tab' is nil, always indent line." (interactive "*P") (if vera-intelligent-tab (progn - (cond ((memq (char-syntax (preceding-char)) '(?w ?_)) + (cond ((and (not (featurep 'xemacs)) (use-region-p)) + (vera-indent-region (region-beginning) (region-end) nil)) + ((memq (char-syntax (preceding-char)) '(?w ?_)) (let ((case-fold-search t) (case-replace nil) (hippie-expand-only-buffers @@ -1339,7 +1331,7 @@ If `vera-intelligent-tab' is nil, always indent line." (interactive "*P") (let* ((ch (char-before)) (indentp (and (not arg) - (eq last-command-char ?/) + (eq last-command-event ?/) (or (and (eq ch ?/) (not (vera-in-literal))) (and (eq ch ?*) @@ -1481,5 +1473,4 @@ If `vera-intelligent-tab' is nil, always indent line." (provide 'vera-mode) -;; arch-tag: 22eae722-7ac5-47ac-a713-c4db1cf623a9 ;;; vera-mode.el ends here