branch: elpa/scala-mode commit 0af3b0766e8ee852f2b9451c295c61c8af9e2146 Author: Heikki Vesalainen <heikkivesalai...@yahoo.com> Commit: Heikki Vesalainen <heikkivesalai...@yahoo.com>
Added Makefile and fixed compilation warnings --- Makefile | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ scala-mode-constants.el | 8 ---- scala-mode-fontlock.el | 6 +-- scala-mode-lib.el | 4 ++ scala-mode-syntax.el | 50 ++++--------------------- scala-mode.el | 5 +-- 6 files changed, 115 insertions(+), 57 deletions(-) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..21c2d87 --- /dev/null +++ b/Makefile @@ -0,0 +1,99 @@ +############################################################-*-Makefile-*-#### +# Makefile for compiling the major mode of Emacs +############################################################################## + +## This Makefile has been copied from the scala project. +## See the LICENSE at the bottom of this file. + +############################################################################## +# Configuration + +ROOT = . + +SOURCE_DIR = $(ROOT) + +############################################################################## +# Variables + +# Emacs Lisp +ELISP_COMMAND ?= emacs +ELISP_OPTIONS += -batch -no-site-file +ELISP_OPTIONS += -L $(ROOT) +ELISP_OPTIONS += -f batch-byte-compile + + +ELISP_FILES += scala-mode-lib +ELISP_FILES += scala-mode +ELISP_FILES += scala-mode-syntax +ELISP_FILES += scala-mode-indent +ELISP_FILES += scala-mode-paragraph +ELISP_FILES += scala-mode-fontlock +ELISP_FILES += scala-mode-map + +ELISP_SOURCES += $(ELISP_FILES:%=$(SOURCE_DIR)/%.el) + +############################################################################## + +RM ?= rm -f +TOUCH ?= touch + +############################################################################## +# Commands + +all: .latest-build + +clean: + $(RM) *.elc .latest-* autoloads.el + +.PHONY: all +.PHONY: clean + +############################################################################## +# Rules + +.latest-build: $(ELISP_SOURCES) + $(ELISP_COMMAND) $(ELISP_OPTIONS) $(ELISP_SOURCES) + @$(TOUCH) $@ + +############################################################################## + +autoloads: $(ELISP_SOURCES) + emacs -batch -q --no-site-file --eval "(setq make-backup-files nil)" --eval "(setq generated-autoload-file (expand-file-name \"autoloads.el\"))" -f batch-update-autoloads `pwd` + + + +## SCALA LICENSE +## +## Copyright (c) 2002-2011 EPFL, Lausanne, unless otherwise specified. +## All rights reserved. +## +## This software was developed by the Programming Methods Laboratory of the +## Swiss Federal Institute of Technology (EPFL), Lausanne, Switzerland. +## +## Permission to use, copy, modify, and distribute this software in source +## or binary form for any purpose with or without fee is hereby granted, +## provided that the following conditions are met: +## +## 1. Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## +## 2. Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## +## 3. Neither the name of the EPFL nor the names of its contributors +## may be used to endorse or promote products derived from this +## software without specific prior written permission. +## +## +## THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +## SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +## CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. diff --git a/scala-mode-constants.el b/scala-mode-constants.el deleted file mode 100644 index 2c7507d..0000000 --- a/scala-mode-constants.el +++ /dev/null @@ -1,8 +0,0 @@ -;;; scala-mode-constants.el - Major mode for editing scala, constants -;;; Copyright (c) 2012 Heikki Vesalainen -;;; For information on the License, see the LICENSE file - -;;; Based on Scala Language Specification (SLS) Version 2.9 - -(provide 'scala-mode-constants) - diff --git a/scala-mode-fontlock.el b/scala-mode-fontlock.el index 588692d..010e12a 100644 --- a/scala-mode-fontlock.el +++ b/scala-mode-fontlock.el @@ -5,7 +5,6 @@ (provide 'scala-mode-fontlock) (require 'scala-mode-syntax) -(require 'scala-mode-constants) (defcustom scala-font-lock:constant-list '() "A list of strigs that should be fontified in constant @@ -49,13 +48,14 @@ scala-mode has been reloaded." (goto-char (match-end 0))) ((or (scala-syntax:looking-at-reserved-symbol nil) (looking-at scala-syntax:other-keywords-unsafe-re)) -; (messssage "saw reserved symbol or keyword")) +; (messssage "saw reserved symbol or keyword") + nil) ((looking-at scala-syntax:id-re) ; (message "saw id-re %d" (match-beginning 0)) (goto-char (match-end 0))) ; (t ; (message "nothing special here %s" (point))) - ))) + )) (scala-syntax:skip-forward-ignorable))) ; (message "limit at %s" (point)) (point))) diff --git a/scala-mode-lib.el b/scala-mode-lib.el index 8f8a2c6..2035cd4 100644 --- a/scala-mode-lib.el +++ b/scala-mode-lib.el @@ -4,6 +4,10 @@ (provide 'scala-mode-lib) +(defvar scala-mode:debug-messages + "If true, some debug messages may be printed printed." + nil) + (defmacro scala-lib:column-after (&rest body) `(save-excursion ,@body diff --git a/scala-mode-syntax.el b/scala-mode-syntax.el index 4691434..2fd9741 100644 --- a/scala-mode-syntax.el +++ b/scala-mode-syntax.el @@ -6,8 +6,6 @@ (provide 'scala-mode-syntax) -(require 'scala-mode-constants) - ;;;; ;;;; Scala syntax regular expressions ;;;; @@ -295,28 +293,6 @@ "\\(" scala-syntax:after-reserved-symbol-re "\\)")) -;; (defconst scala-syntax:colon-looking-at-re -;; ;; reserved symbol ':'. The regexp is safe for use with -;; ;; 'looking-at' function, if the point before is not opchar -;; (concat "\\(:\\)\\(" scala-syntax:after-reserved-symbol-re "\\)")) - -;; (defconst scala-syntax:bar-looking-at-re -;; ;; reserved symbol '|'. The regexp is safe for use with -;; ;; 'looking-at' function, if the point before is not opchar -;; (concat "\\(|\\)\\(" scala-syntax:after-reserved-symbol-re "\\)")) - -;; (defconst scala-syntax:reserved-symbols-looking-at-re -;; ;; reserved symbols. The regexp is safe for use with -;; ;; 'looking-at' function, if the point before is not opchar -;; (concat scala-syntax:reserved-symbols-unsafe-re -;; "\\(" scala-syntax:after-reserved-symbol-re "\\)")) - -;; TODO: remove -;; (defconst scala-syntax:reserved-re -;; (concat scala-syntax:keywords-re -;; "\\|" scala-syntax:reserved-symbols-re -;; "\\|" scala-syntax:reserved-symbol-underscore-re)) - (defconst scala-syntax:modifiers-re (regexp-opt '("override" "abstract" "final" "sealed" "implicit" "lazy" "private" "protected") 'words)) @@ -324,13 +300,6 @@ (defconst scala-syntax:body-start-re (concat "=" scala-syntax:end-of-code-line-re) "A regexp for detecting if a line ends with '='") -; "\\(=>?\\|\u21D2\\)\\([ ]\\|$\\)" -; "A regexp for detecting if a line ends with '=', '=>' or the -; unicode symbol 'double arrow'") - -;;(defconst scala-syntax:continue-body-keywords-re -;; (regexp-opt '("catch" "else" "finally" "forSome" "match" "yield") 'words) -;; "Keywords which continue a statement, but have their own body") (defconst scala-syntax:list-keywords-re (regexp-opt '("var" "val" "import") 'words) @@ -351,9 +320,6 @@ (defconst scala-syntax:class-or-object-re (regexp-opt '("class" "object") 'words)) -;; (defconst scala-syntax:case-end-unsafe-re -;; (concat scala-syntax:double-arrow-unsafe-re -;; "\\(" scala-syntax:after-reserved-symbol-re "\\)")) ;;;; ;;;; Character syntax table and related syntax-propertize functions @@ -649,15 +615,13 @@ further than max-chars starting after skipping any ignorable." (let ((end (point)) (limit (when max-chars (- (point) max-chars)))) ;; skip back punctuation or ids (words and related symbols and delimiters) - (or (/= 0 (skip-chars-backward scala-syntax:delimiter-group limit)) - (/= 0 (skip-syntax-backward "." limit)) - (/= 0 (skip-syntax-backward "(" limit)) - (/= 0 (skip-syntax-backward ")" limit)) - (/= 0 (skip-syntax-backward "w_'$" limit))) - ;; if we didn't move, then we didn't find anything - (if (= (point) end) - nil - (if (looking-at re) (point) nil))))) + (if (or (/= 0 (skip-chars-backward scala-syntax:delimiter-group limit)) + (/= 0 (skip-syntax-backward "." limit)) + (/= 0 (skip-syntax-backward "(" limit)) + (/= 0 (skip-syntax-backward ")" limit)) + (/= 0 (skip-syntax-backward "w_'$" limit))) + (if (looking-at re) (point) nil) + nil)))) (defun scala-syntax:backward-parameter-groups () "Move back over all parameter groups to the start of the first diff --git a/scala-mode.el b/scala-mode.el index 3e28f00..8731d38 100644 --- a/scala-mode.el +++ b/scala-mode.el @@ -6,11 +6,11 @@ (provide 'scala-mode) -(require 'scala-mode-constants) +(require 'scala-mode-lib) (require 'scala-mode-syntax) (require 'scala-mode-paragraph) -(require 'scala-mode-fontlock) (require 'scala-mode-indent) +(require 'scala-mode-fontlock) (require 'scala-mode-map) ;; Tested only for emacs 24 @@ -47,7 +47,6 @@ When started, runs `scala-mode-hook'. ; :abbrev (scala-mode:make-local-variables - 'scala-mode:debug-messages 'post-self-insert-hook 'syntax-propertize-function 'font-lock-syntactic-face-function