X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/279dffd67603744c98614b2cb906a1fc7a5008f6..73b0cd50031a714347109169ceb8bacae338612a:/lisp/progmodes/icon.el diff --git a/lisp/progmodes/icon.el b/lisp/progmodes/icon.el index 694eea1285..9a8b8064be 100644 --- a/lisp/progmodes/icon.el +++ b/lisp/progmodes/icon.el @@ -1,6 +1,6 @@ ;;; icon.el --- mode for editing Icon code -;; Copyright (C) 1989 Free Software Foundation, Inc. +;; Copyright (C) 1989, 2001-2011 Free Software Foundation, Inc. ;; Author: Chris Smith ;; Created: 15 Feb 89 @@ -8,10 +8,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 @@ -19,9 +19,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., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: @@ -83,6 +81,7 @@ (defgroup icon nil "Mode for editing Icon code." + :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) :group 'languages) (defcustom icon-indent-level 4 @@ -131,7 +130,7 @@ when the TAB command is used." ;;;###autoload -(defun icon-mode () +(define-derived-mode icon-mode prog-mode "Icon" "Major mode for editing Icon code. Expression and list commands understand all Icon brackets. Tab indents for Icon code. @@ -163,49 +162,33 @@ Variables controlling indentation style: Turning on Icon mode calls the value of the variable `icon-mode-hook' with no args, if that value is non-nil." - (interactive) - (kill-all-local-variables) - (use-local-map icon-mode-map) - (setq major-mode 'icon-mode) - (setq mode-name "Icon") - (setq local-abbrev-table icon-mode-abbrev-table) - (set-syntax-table icon-mode-syntax-table) - (make-local-variable 'paragraph-start) - (setq paragraph-start (concat "$\\|" page-delimiter)) - (make-local-variable 'paragraph-separate) - (setq paragraph-separate paragraph-start) - (make-local-variable 'indent-line-function) - (setq indent-line-function 'icon-indent-line) - (make-local-variable 'require-final-newline) - (setq require-final-newline t) - (make-local-variable 'comment-start) - (setq comment-start "# ") - (make-local-variable 'comment-end) - (setq comment-end "") - (make-local-variable 'comment-start-skip) - (setq comment-start-skip "# *") - (make-local-variable 'comment-indent-function) - (setq comment-indent-function 'icon-comment-indent) + :abbrev-table icon-mode-abbrev-table + (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter)) + (set (make-local-variable 'paragraph-separate) paragraph-start) + (set (make-local-variable 'indent-line-function) #'icon-indent-line) + (set (make-local-variable 'comment-start) "# ") + (set (make-local-variable 'comment-end) "") + (set (make-local-variable 'comment-start-skip) "# *") + (set (make-local-variable 'comment-indent-function) 'icon-comment-indent) (set (make-local-variable 'indent-line-function) 'icon-indent-line) ;; font-lock support - (setq font-lock-defaults - '((icon-font-lock-keywords - icon-font-lock-keywords-1 icon-font-lock-keywords-2) - nil nil ((?_ . "w")) beginning-of-defun - ;; Obsoleted by Emacs 19.35 parse-partial-sexp's COMMENTSTOP. - ;(font-lock-comment-start-regexp . "#") - (font-lock-mark-block-function . mark-defun))) + (set (make-local-variable 'font-lock-defaults) + '((icon-font-lock-keywords + icon-font-lock-keywords-1 icon-font-lock-keywords-2) + nil nil ((?_ . "w")) beginning-of-defun + ;; Obsoleted by Emacs 19.35 parse-partial-sexp's COMMENTSTOP. + ;;(font-lock-comment-start-regexp . "#") + (font-lock-mark-block-function . mark-defun))) ;; imenu support - (make-local-variable 'imenu-generic-expression) - (setq imenu-generic-expression icon-imenu-generic-expression) + (set (make-local-variable 'imenu-generic-expression) + icon-imenu-generic-expression) ;; hideshow support ;; we start from the assertion that `hs-special-modes-alist' is autoloaded. (unless (assq 'icon-mode hs-special-modes-alist) (setq hs-special-modes-alist (cons '(icon-mode "\\" "\\" nil icon-forward-sexp-function) - hs-special-modes-alist))) - (run-hooks 'icon-mode-hook)) + hs-special-modes-alist)))) ;; This is used by indent-for-comment to decide how much to ;; indent a comment in Icon code based on its context. @@ -225,7 +208,7 @@ with no args, if that value is non-nil." (progn (icon-indent-line) (newline) t) nil))) (progn - (insert last-command-char) + (insert last-command-event) (icon-indent-line) (if icon-auto-newline (progn @@ -601,7 +584,7 @@ Returns nil if line starts inside a string, t if in a comment." (indent-to this-indent))) ;; Indent any comment following the text. (or (looking-at comment-start-skip) - (if (re-search-forward comment-start-skip (save-excursion (end-of-line) (point)) t) + (if (re-search-forward comment-start-skip (line-end-position) t) (progn (indent-for-comment) (beginning-of-line)))))))))) (defconst icon-font-lock-keywords-1 @@ -687,5 +670,4 @@ Returns nil if line starts inside a string, t if in a comment." (provide 'icon) -;;; arch-tag: 8abf8c99-e7df-44af-a58f-ef5ed2ee52cb ;;; icon.el ends here