wok-6.x rev 14086

Up: emacs-pkg-lua-mode: tidy receipt
author Dominique Corbex <domcox@slitaz.org>
date Fri Feb 22 21:14:47 2013 +0100 (2013-02-22)
parents 2d7ca3af31c4
children e439deff3a85
files emacs-pkg-lua-mode/receipt emacs-pkg-lua-mode/stuff/lua-mode.el
line diff
     1.1 --- a/emacs-pkg-lua-mode/receipt	Fri Feb 22 19:51:05 2013 +0000
     1.2 +++ b/emacs-pkg-lua-mode/receipt	Fri Feb 22 21:14:47 2013 +0100
     1.3 @@ -6,48 +6,36 @@
     1.4  SHORT_DESC="An Emacs major mode for editing Lua code."
     1.5  MAINTAINER="domcox@slitaz.org"
     1.6  DEPENDS="emacs"
     1.7 -WEB_SITE="http://lua-mode.luaforge.net"
     1.8 +WEB_SITE="http://immerrr.github.com/lua-mode/"
     1.9  TAGS="emacs lua"
    1.10  
    1.11  
    1.12  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.13  genpkg_rules()
    1.14  {
    1.15 +	echo -n "Installing start file"
    1.16 +	mkdir -p $fs/usr/share/emacs/site-lisp/site-start.d && \
    1.17 +	cp -a $stuff/90-lua-mode.el $fs/usr/share/emacs/site-lisp/site-start.d
    1.18 +	status
    1.19 +
    1.20  	echo -n "Installing lua-mode"
    1.21  	mkdir -p $fs/usr/share/emacs/site-lisp/lua-mode && \
    1.22 -	cp $stuff/lua-mode.el $fs/usr/share/emacs/site-lisp/lua-mode
    1.23 +	cp -a $stuff/lua-mode.el $fs/usr/share/emacs/site-lisp/lua-mode
    1.24  	status
    1.25  
    1.26 -	echo -n "Installing start file"
    1.27 -	mkdir -p $fs/usr/share/emacs/site-lisp/site-start.d && \
    1.28 -	cp $stuff/90-lua-mode.el $fs/usr/share/emacs/site-lisp/site-start.d
    1.29 -	status
    1.30 -}
    1.31 -
    1.32 -post_install()
    1.33 -{
    1.34  	# byte-compile files, remove src
    1.35 -	cd /usr/share/emacs/site-lisp/lua-mode/
    1.36 +	cd $fs/usr/share/emacs/site-lisp/lua-mode
    1.37  	for file in *.el ; do
    1.38  		echo -n "Byte-compiling $file"
    1.39  		emacs -batch -f batch-byte-compile $file 2> /dev/null
    1.40  		status
    1.41  		rm -f $file
    1.42  	done
    1.43 -	tazpkg reconfigure emacs
    1.44  }
    1.45  
    1.46 -pre_remove()
    1.47 +post_install()
    1.48  {
    1.49 -	# remove byte-compiled files,
    1.50 -	# created by post_install()
    1.51 -	cd /usr/share/emacs/site-lisp/lua-mode/
    1.52 -	for file in *.elc ; do
    1.53 -		echo -n "Deleting byte-compiled code $file"
    1.54 -		touch "$file" "`basename $file .elc`.el"
    1.55 -		rm -f $file
    1.56 -		status
    1.57 -	done
    1.58 +	tazpkg reconfigure emacs
    1.59  }
    1.60  
    1.61  post_remove()
     2.1 --- a/emacs-pkg-lua-mode/stuff/lua-mode.el	Fri Feb 22 19:51:05 2013 +0000
     2.2 +++ b/emacs-pkg-lua-mode/stuff/lua-mode.el	Fri Feb 22 21:14:47 2013 +0100
     2.3 @@ -1,2144 +1,1665 @@
     2.4 -  
     2.5 +;;; lua-mode.el --- a major-mode for editing Lua scripts
     2.6  
     2.7 +;; Copyright (C) 1997, 2001, 2004, 2006, 2007, 2010, 2011 Free Software Foundation, Inc.
     2.8  
     2.9 -<!DOCTYPE html>
    2.10 -<html>
    2.11 -  <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
    2.12 -    <meta charset='utf-8'>
    2.13 -    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    2.14 -        <title>lua-mode/lua-mode.el at master · immerrr/lua-mode · GitHub</title>
    2.15 -    <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
    2.16 -    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
    2.17 -    <link rel="apple-touch-icon-precomposed" sizes="57x57" href="apple-touch-icon-114.png" />
    2.18 -    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114.png" />
    2.19 -    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-144.png" />
    2.20 -    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="apple-touch-icon-144.png" />
    2.21 -    <link rel="logo" type="image/svg" href="http://github-media-downloads.s3.amazonaws.com/github-logo.svg" />
    2.22 -    <meta name="msapplication-TileImage" content="/windows-tile.png">
    2.23 -    <meta name="msapplication-TileColor" content="#ffffff">
    2.24 +;; Author: 2011 immerrr <immerrr+lua@gmail.com>
    2.25 +;;         2010-2011 Reuben Thomas <rrt@sc3d.org>
    2.26 +;;         2006 Juergen Hoetzel <juergen@hoetzel.info>
    2.27 +;;         2004 various (support for Lua 5 and byte compilation)
    2.28 +;;         2001 Christian Vogler <cvogler@gradient.cis.upenn.edu>
    2.29 +;;         1997 Bret Mogilefsky <mogul-lua@gelatinous.com> starting from
    2.30 +;;              tcl-mode by Gregor Schmid <schmid@fb3-s7.math.tu-berlin.de>
    2.31 +;;              with tons of assistance from
    2.32 +;;              Paul Du Bois <pld-lua@gelatinous.com> and
    2.33 +;;              Aaron Smith <aaron-lua@gelatinous.com>.
    2.34 +;;
    2.35 +;; URL:         http://immerrr.github.com/lua-mode
    2.36 +;; Version:     20111107
    2.37 +;;
    2.38 +;; This file is NOT part of Emacs.
    2.39 +;;
    2.40 +;; This program is free software; you can redistribute it and/or
    2.41 +;; modify it under the terms of the GNU General Public License
    2.42 +;; as published by the Free Software Foundation; either version 2
    2.43 +;; of the License, or (at your option) any later version.
    2.44 +;;
    2.45 +;; This program is distributed in the hope that it will be useful,
    2.46 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.47 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.48 +;; GNU General Public License for more details.
    2.49 +;;
    2.50 +;; You should have received a copy of the GNU General Public License
    2.51 +;; along with this program; if not, write to the Free Software
    2.52 +;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    2.53 +;; MA 02110-1301, USA.
    2.54  
    2.55 -    
    2.56 -    
    2.57 -    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
    2.58 +;; Keywords: languages, processes, tools
    2.59  
    2.60 -    <meta content="authenticity_token" name="csrf-param" />
    2.61 -<meta content="7Opte9ezTrv4wfZYtQD35eRTvcYWwtxcMFX9BhJ0Xs4=" name="csrf-token" />
    2.62  
    2.63 -    <link href="https://a248.e.akamai.net/assets.github.com/assets/github-43b1cfcfbe53a62c7ab76e1da7f0ff83b28c9c92.css" media="screen" rel="stylesheet" type="text/css" />
    2.64 -    <link href="https://a248.e.akamai.net/assets.github.com/assets/github2-7c17a1ea38e88d72787a5a2bd336f7d8aa428037.css" media="screen" rel="stylesheet" type="text/css" />
    2.65 -    
    2.66 +;;; Commentary:
    2.67  
    2.68 +;; Thanks to d87 <github.com/d87> for an idea of highlighting lua
    2.69 +;; builtins/numbers
    2.70  
    2.71 -      <script src="https://a248.e.akamai.net/assets.github.com/assets/frameworks-5dcdaf734c8092261f37e6534c8f114696d913a9.js" type="text/javascript"></script>
    2.72 -      <script src="https://a248.e.akamai.net/assets.github.com/assets/github-47a3a09fdb39a3cc73da291f394b4c33a2695b7b.js" type="text/javascript"></script>
    2.73 -      
    2.74 +;; Thanks to Vedat Hallac <github.com/vhallac> for sharing some of
    2.75 +;; his fixes and updates to core indentation logics
    2.76  
    2.77 -        <link rel='permalink' href='/immerrr/lua-mode/blob/e6a46ee34362b5090748643d4b2bef1f849ea0a8/lua-mode.el'>
    2.78 -    <meta property="og:title" content="lua-mode"/>
    2.79 -    <meta property="og:type" content="githubog:gitrepository"/>
    2.80 -    <meta property="og:url" content="https://github.com/immerrr/lua-mode"/>
    2.81 -    <meta property="og:image" content="https://secure.gravatar.com/avatar/fbdd052b3c14b23477b6630f1c8e0700?s=420&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"/>
    2.82 -    <meta property="og:site_name" content="GitHub"/>
    2.83 -    <meta property="og:description" content="Emacs major mode for editing Lua. Contribute to lua-mode development by creating an account on GitHub."/>
    2.84 -    <meta property="twitter:card" content="summary"/>
    2.85 -    <meta property="twitter:site" content="@GitHub">
    2.86 -    <meta property="twitter:title" content="immerrr/lua-mode"/>
    2.87 +;; Thanks to Rafael Sanchez <rafael@cornerdimension.com> for patch
    2.88 +;; adding lua-mode to interpreter-mode-alist
    2.89  
    2.90 -    <meta name="description" content="Emacs major mode for editing Lua. Contribute to lua-mode development by creating an account on GitHub." />
    2.91 +;; Thanks to Leonardo Etcheverry <leo@kalio.net> for enabling
    2.92 +;; narrow-to-defun functionality
    2.93  
    2.94 -  <link href="https://github.com/immerrr/lua-mode/commits/master.atom" rel="alternate" title="Recent Commits to lua-mode:master" type="application/atom+xml" />
    2.95 +;; Thanks to Tobias Polzin <polzin@gmx.de> for function indenting
    2.96 +;; patch: Indent "(" like "{"
    2.97  
    2.98 -  </head>
    2.99 +;; Thanks to Fabien <fleutot@gmail.com> for imenu patches.
   2.100  
   2.101 +;; Thanks to Simon Marshall <simonm@mail.esrin.esa.it> and Olivier
   2.102 +;; Andrieu <oandrieu@gmail.com> for font-lock patches.
   2.103  
   2.104 -  <body class="logged_out page-blob  vis-public env-production  ">
   2.105 -    <div id="wrapper">
   2.106 +;; Additional font-lock highlighting and indentation tweaks by
   2.107 +;; Adam D. Moss <adam@gimp.org>.
   2.108  
   2.109 -      
   2.110 +;; INSTALLATION:
   2.111  
   2.112 -      
   2.113 +;; To install, just copy this file into a directory on your load-path
   2.114 +;; (and byte-compile it). To set up Emacs to automatically edit files
   2.115 +;; ending in ".lua" or with a lua hash-bang line using lua-mode add
   2.116 +;; the following to your init file:
   2.117 +;;
   2.118 +;; (autoload 'lua-mode "lua-mode" "Lua editing mode." t)
   2.119 +;; (add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
   2.120 +;; (add-to-list 'interpreter-mode-alist '("lua" . lua-mode))
   2.121  
   2.122 -      
   2.123 +;; Usage
   2.124  
   2.125 -      
   2.126 +;; Lua-mode supports c-mode style formatting and sending of
   2.127 +;; lines/regions/files to a Lua interpreter. An interpreter (see
   2.128 +;; variable `lua-default-application') will be started if you try to
   2.129 +;; send some code and none is running. You can use the process-buffer
   2.130 +;; (named after the application you chose) as if it were an
   2.131 +;; interactive shell. See the documentation for `comint.el' for
   2.132 +;; details.
   2.133  
   2.134 +;; Lua-mode works with Hide Show minor mode (see ``hs-minor-mode``).
   2.135  
   2.136 -        <div class="header header-logged-out">
   2.137 -          <div class="container clearfix">
   2.138 +;; Key-bindings
   2.139  
   2.140 -            <a class="header-logo-wordmark" href="https://github.com/">
   2.141 -              <img alt="GitHub" class="github-logo-4x" height="30" src="https://a248.e.akamai.net/assets.github.com/images/modules/header/logov7@4x.png?1359500886" />
   2.142 -              <img alt="GitHub" class="github-logo-4x-hover" height="30" src="https://a248.e.akamai.net/assets.github.com/images/modules/header/logov7@4x-hover.png?1359500886" />
   2.143 -            </a>
   2.144 +;; To see all the keybindings for Lua mode, look at `lua-setup-keymap'
   2.145 +;; or start `lua-mode' and type `\C-h m'.
   2.146 +;; The keybindings may seem strange, since I prefer to use them with
   2.147 +;; lua-prefix-key set to nil, but since those keybindings are already used
   2.148 +;; the default for `lua-prefix-key' is `\C-c', which is the conventional
   2.149 +;; prefix for major-mode commands.
   2.150  
   2.151 -              
   2.152 -<ul class="top-nav">
   2.153 -    <li class="explore"><a href="https://github.com/explore">Explore GitHub</a></li>
   2.154 -  <li class="search"><a href="https://github.com/search">Search</a></li>
   2.155 -  <li class="features"><a href="https://github.com/features">Features</a></li>
   2.156 -    <li class="blog"><a href="https://github.com/blog">Blog</a></li>
   2.157 -</ul>
   2.158 +;; You can customise the keybindings either by setting `lua-prefix-key'
   2.159 +;; or by putting the following in your .emacs
   2.160 +;;      (define-key lua-mode-map <your-key> <function>)
   2.161 +;; for all the functions you need.
   2.162  
   2.163  
   2.164 -            <div class="header-actions">
   2.165 -                <a class="button primary" href="https://github.com/signup">Sign up for free</a>
   2.166 -              <a class="button" href="https://github.com/login?return_to=%2Fimmerrr%2Flua-mode%2Fblob%2Fmaster%2Flua-mode.el">Sign in</a>
   2.167 -            </div>
   2.168 +;;; Code:
   2.169 +(eval-when-compile
   2.170 +  (require 'cl))
   2.171  
   2.172 -          </div>
   2.173 -        </div>
   2.174 +(require 'comint)
   2.175  
   2.176 +(eval-and-compile
   2.177 +  ;; Backward compatibility for Emacsen < 24.1
   2.178 +  (defalias 'lua--prog-mode
   2.179 +    (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
   2.180  
   2.181 -      
   2.182 +  (defalias 'lua--cl-assert
   2.183 +    (if (fboundp 'cl-assert) 'cl-assert 'assert))
   2.184  
   2.185 -      
   2.186 +  (defalias 'lua--cl-labels
   2.187 +    (if (fboundp 'cl-labels) 'cl-labels 'flet))
   2.188  
   2.189 +  ;; for Emacsen < 22.1
   2.190 +  (defalias 'lua--with-no-warnings
   2.191 +    (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn))
   2.192  
   2.193 -            <div class="site hfeed" itemscope itemtype="http://schema.org/WebPage">
   2.194 -      <div class="hentry">
   2.195 -        
   2.196 -        <div class="pagehead repohead instapaper_ignore readability-menu">
   2.197 -          <div class="container">
   2.198 -            <div class="title-actions-bar">
   2.199 -              
   2.200 +  ;; provide backward compatibility for Emacs < 23.2
   2.201 +  ;; called-interactively-p receives an argument starting from Emacs 23.2
   2.202 +  ;; In Emacs 22 & Emacs 23.1 it didn't expect an argument
   2.203 +  ;; In Emacs 21 it was called interactively-p
   2.204 +  (condition-case nil
   2.205 +      (progn (called-interactively-p nil)
   2.206 +             ;; if first call succeeds, make lua-called-interactively-p an alias
   2.207 +             (defalias 'lua--called-interactively-p 'called-interactively-p))
   2.208  
   2.209 +    (wrong-number-of-arguments
   2.210 +     ;; wrong number of arguments means it's 22.1 <= Emacs < 23.2
   2.211 +     ;;
   2.212 +     ;; Newer and smarter Emacsen will warn about obsolete functions
   2.213 +     ;; and/or wrong number of arguments. Turning these warnings off,
   2.214 +     ;; since it's backward-compatibility-oriented code anyway.
   2.215 +     (lua--with-no-warnings
   2.216 +       (defun lua--called-interactively-p (kind)
   2.217 +         "Return t if containing function was called interactively.
   2.218  
   2.219 -<ul class="pagehead-actions">
   2.220 +This function provides lua-mode backward compatibility for
   2.221 +pre-23.2 Emacsen."
   2.222 +         (if (eq kind 'interactive)
   2.223 +             (interactive-p)
   2.224 +           (called-interactively-p)))))
   2.225  
   2.226 +    ;; if not, it's probably < 22.1, provide partial compatibility
   2.227 +    ;;
   2.228 +    ;; Once again, turning obsolete-function warnings off (see above).
   2.229 +    (error
   2.230 +     (lua--with-no-warnings
   2.231 +       (defun lua--called-interactively-p (&rest opts)
   2.232 +         "Return t if containing function was called interactively.
   2.233  
   2.234 +This function provides lua-mode backward compatibility for pre-22
   2.235 +Emacsen."
   2.236 +         (interactive-p)))))
   2.237  
   2.238 -    <li>
   2.239 -      <a href="/login?return_to=%2Fimmerrr%2Flua-mode"
   2.240 -        class="minibutton js-toggler-target star-button entice tooltipped upwards"
   2.241 -        title="You must be signed in to use this feature" rel="nofollow">
   2.242 -        <span class="mini-icon mini-icon-star"></span>Star
   2.243 -      </a>
   2.244 -      <a class="social-count js-social-count" href="/immerrr/lua-mode/stargazers">
   2.245 -        68
   2.246 -      </a>
   2.247 -    </li>
   2.248 -    <li>
   2.249 -      <a href="/login?return_to=%2Fimmerrr%2Flua-mode"
   2.250 -        class="minibutton js-toggler-target fork-button entice tooltipped upwards"
   2.251 -        title="You must be signed in to fork a repository" rel="nofollow">
   2.252 -        <span class="mini-icon mini-icon-fork"></span>Fork
   2.253 -      </a>
   2.254 -      <a href="/immerrr/lua-mode/network" class="social-count">
   2.255 -        19
   2.256 -      </a>
   2.257 -    </li>
   2.258 -</ul>
   2.259 +  ;; backward compatibility for Emacsen < 23.3
   2.260 +  ;; Emacs 23.3 introduced with-silent-modifications macro
   2.261 +  (if (fboundp 'with-silent-modifications)
   2.262 +      (defalias 'lua--with-silent-modifications 'with-silent-modifications)
   2.263  
   2.264 -              <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
   2.265 -                <span class="repo-label"><span>public</span></span>
   2.266 -                <span class="mega-icon mega-icon-public-repo"></span>
   2.267 -                <span class="author vcard">
   2.268 -                  <a href="/immerrr" class="url fn" itemprop="url" rel="author">
   2.269 -                  <span itemprop="title">immerrr</span>
   2.270 -                  </a></span> /
   2.271 -                <strong><a href="/immerrr/lua-mode" class="js-current-repository">lua-mode</a></strong>
   2.272 -              </h1>
   2.273 -            </div>
   2.274 +    (defmacro lua--with-silent-modifications (&rest body)
   2.275 +      "Execute BODY, pretending it does not modifies the buffer.
   2.276  
   2.277 -            
   2.278 +This is a reimplementation of macro `with-silent-modifications'
   2.279 +for Emacsen that doesn't contain one (pre-23.3)."
   2.280 +      `(let ((old-modified-p (buffer-modified-p))
   2.281 +            (inhibit-modification-hooks t)
   2.282 +            (buffer-undo-list t))
   2.283  
   2.284 -  <ul class="tabs">
   2.285 -    <li><a href="/immerrr/lua-mode" class="selected" highlight="repo_sourcerepo_downloadsrepo_commitsrepo_tagsrepo_branches">Code</a></li>
   2.286 -    <li><a href="/immerrr/lua-mode/network" highlight="repo_network">Network</a></li>
   2.287 -    <li><a href="/immerrr/lua-mode/pulls" highlight="repo_pulls">Pull Requests <span class='counter'>3</span></a></li>
   2.288 +        (unwind-protect
   2.289 +            ,@body
   2.290 +          (set-buffer-modified-p old-modified-p))))))
   2.291  
   2.292 -      <li><a href="/immerrr/lua-mode/issues" highlight="repo_issues">Issues <span class='counter'>19</span></a></li>
   2.293 +;; Local variables
   2.294 +(defgroup lua nil
   2.295 +  "Major mode for editing lua code."
   2.296 +  :prefix "lua-"
   2.297 +  :group 'languages)
   2.298  
   2.299 -      <li><a href="/immerrr/lua-mode/wiki" highlight="repo_wiki">Wiki</a></li>
   2.300 +(defcustom lua-indent-level 3
   2.301 +  "Amount by which Lua subexpressions are indented."
   2.302 +  :type 'integer
   2.303 +  :group 'lua)
   2.304  
   2.305 +(defcustom lua-comment-start "-- "
   2.306 +  "Default value of `comment-start'."
   2.307 +  :type 'string
   2.308 +  :group 'lua)
   2.309  
   2.310 -    <li><a href="/immerrr/lua-mode/graphs" highlight="repo_graphsrepo_contributors">Graphs</a></li>
   2.311 +(defcustom lua-comment-start-skip "-- "
   2.312 +  "Default value of `comment-start-skip'."
   2.313 +  :type 'string
   2.314 +  :group 'lua)
   2.315  
   2.316 +(defcustom lua-default-application "lua"
   2.317 +  "Default application to run in lua subprocess."
   2.318 +  :type 'string
   2.319 +  :group 'lua)
   2.320  
   2.321 -  </ul>
   2.322 -  
   2.323 -<div class="tabnav">
   2.324 +(defcustom lua-default-command-switches (list "-i")
   2.325 +  "Command switches for `lua-default-application'.
   2.326 +Should be a list of strings."
   2.327 +  :type '(repeat string)
   2.328 +  :group 'lua)
   2.329  
   2.330 -  <span class="tabnav-right">
   2.331 -    <ul class="tabnav-tabs">
   2.332 -          <li><a href="/immerrr/lua-mode/tags" class="tabnav-tab" highlight="repo_tags">Tags <span class="counter ">3</span></a></li>
   2.333 -    </ul>
   2.334 -    
   2.335 -  </span>
   2.336 +(defcustom lua-always-show t
   2.337 +  "*Non-nil means display lua-process-buffer after sending a command."
   2.338 +  :type 'boolean
   2.339 +  :group 'lua)
   2.340  
   2.341 -  <div class="tabnav-widget scope">
   2.342 +(defcustom lua-search-url-prefix "http://www.lua.org/manual/5.1/manual.html#pdf-"
   2.343 +  "*URL at which to search for documentation on a word"
   2.344 +  :type 'string
   2.345 +  :group 'lua)
   2.346  
   2.347 +(defvar lua-process nil
   2.348 +  "The active Lua subprocess")
   2.349  
   2.350 -    <div class="select-menu js-menu-container js-select-menu js-branch-menu">
   2.351 -      <a class="minibutton select-menu-button js-menu-target" data-hotkey="w" data-ref="master">
   2.352 -        <span class="mini-icon mini-icon-branch"></span>
   2.353 -        <i>branch:</i>
   2.354 -        <span class="js-select-button">master</span>
   2.355 -      </a>
   2.356 +(defvar lua-process-buffer nil
   2.357 +  "Buffer used for communication with Lua subprocess")
   2.358  
   2.359 -      <div class="select-menu-modal-holder js-menu-content js-navigation-container js-select-menu-pane">
   2.360 +(defun lua--customize-set-prefix-key (prefix-key-sym prefix-key-val)
   2.361 +  (lua--cl-assert (eq prefix-key-sym 'lua-prefix-key))
   2.362 +  (set prefix-key-sym (if (and prefix-key-val (> (length prefix-key-val) 0))
   2.363 +                          ;; read-kbd-macro returns a string or a vector
   2.364 +                          ;; in both cases (elt x 0) is ok
   2.365 +                          (elt (read-kbd-macro prefix-key-val) 0)))
   2.366 +  (if (fboundp 'lua-prefix-key-update-bindings)
   2.367 +      (lua-prefix-key-update-bindings))
   2.368 +  (message "prefix key set to %S"  (single-key-description (eval prefix-key-sym))))
   2.369  
   2.370 -        <div class="select-menu-modal js-select-menu-pane">
   2.371 -          <div class="select-menu-header">
   2.372 -            <span class="select-menu-title">Switch branches/tags</span>
   2.373 -            <span class="mini-icon mini-icon-remove-close js-menu-close"></span>
   2.374 -          </div> <!-- /.select-menu-header -->
   2.375 +(defcustom lua-prefix-key "\C-c"
   2.376 +  "Prefix for all lua-mode commands."
   2.377 +  :type 'string
   2.378 +  :group 'lua
   2.379 +  :set 'lua--customize-set-prefix-key
   2.380 +  :get '(lambda (sym)
   2.381 +          (let ((val (eval sym))) (if val (single-key-description (eval sym)) ""))))
   2.382  
   2.383 -          <div class="select-menu-filters">
   2.384 -            <div class="select-menu-text-filter">
   2.385 -              <input type="text" id="commitish-filter-field" class="js-select-menu-text-filter js-filterable-field js-navigation-enable" placeholder="Filter branches/tags">
   2.386 -            </div> <!-- /.select-menu-text-filter -->
   2.387 -            <div class="select-menu-tabs">
   2.388 -              <ul>
   2.389 -                <li class="select-menu-tab">
   2.390 -                  <a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a>
   2.391 -                </li>
   2.392 -                <li class="select-menu-tab">
   2.393 -                  <a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a>
   2.394 -                </li>
   2.395 -              </ul>
   2.396 -            </div><!-- /.select-menu-tabs -->
   2.397 -          </div><!-- /.select-menu-filters -->
   2.398 +(defvar lua-mode-menu (make-sparse-keymap "Lua")
   2.399 +  "Keymap for lua-mode's menu.")
   2.400  
   2.401 -          <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket css-truncate" data-tab-filter="branches" data-filterable-for="commitish-filter-field" data-filterable-type="substring">
   2.402 +(defvar lua-prefix-mode-map
   2.403 +  (eval-when-compile
   2.404 +    (let ((result-map (make-sparse-keymap)))
   2.405 +      (mapc (lambda (key_defn)
   2.406 +              (define-key result-map (read-kbd-macro (car key_defn)) (cdr key_defn)))
   2.407 +            '(("C-l" . lua-send-buffer)
   2.408 +              ("C-f" . lua-search-documentation)
   2.409 +              ("C-;" . lua-mark-all-multiline-literals)))
   2.410 +      result-map))
   2.411 +  "Keymap that is used to define keys accessible by `lua-prefix-key'.
   2.412  
   2.413 +If the latter is nil, the keymap translates into `lua-mode-map' verbatim.")
   2.414  
   2.415 +(defvar lua-mode-map
   2.416 +  (let ((result-map (make-sparse-keymap))
   2.417 +        prefix-key)
   2.418 +    (mapc (lambda (key_defn)
   2.419 +            (define-key result-map (read-kbd-macro (car key_defn)) (cdr key_defn)))
   2.420 +          ;; here go all the default bindings
   2.421 +          ;; backquote enables evaluating certain symbols by comma
   2.422 +          `(("}" . lua-electric-match)
   2.423 +            ("]" . lua-electric-match)
   2.424 +            (")" . lua-electric-match)))
   2.425 +    (define-key result-map [menu-bar lua-mode] (cons "Lua" lua-mode-menu))
   2.426  
   2.427 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   2.428 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   2.429 -                <a href="/immerrr/lua-mode/blob/comma_indentation/lua-mode.el" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="comma_indentation" rel="nofollow" title="comma_indentation">comma_indentation</a>
   2.430 -              </div> <!-- /.select-menu-item -->
   2.431 +    ;; FIXME: see if the declared logic actually works
   2.432 +    ;; handle prefix-keyed bindings:
   2.433 +    ;; * if no prefix, set prefix-map as parent, i.e.
   2.434 +    ;;      if key is not defined look it up in prefix-map
   2.435 +    ;; * if prefix is set, bind the prefix-map to that key
   2.436 +    (if (boundp 'lua-prefix-key)
   2.437 +        (define-key result-map (vector lua-prefix-key) lua-prefix-mode-map)
   2.438 +      (set-keymap-parent result-map lua-prefix-mode-map))
   2.439 +    result-map)
   2.440 +  "Keymap used in lua-mode buffers.")
   2.441  
   2.442 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   2.443 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   2.444 -                <a href="/immerrr/lua-mode/blob/compat/lua-mode.el" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="compat" rel="nofollow" title="compat">compat</a>
   2.445 -              </div> <!-- /.select-menu-item -->
   2.446 +(defvar lua-electric-flag t
   2.447 +  "If t, electric actions (like automatic reindentation) will happen when an electric
   2.448 + key like `{' is pressed")
   2.449 +(make-variable-buffer-local 'lua-electric-flag)
   2.450  
   2.451 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   2.452 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   2.453 -                <a href="/immerrr/lua-mode/blob/gh-pages/lua-mode.el" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="gh-pages" rel="nofollow" title="gh-pages">gh-pages</a>
   2.454 -              </div> <!-- /.select-menu-item -->
   2.455 +(defcustom lua-prompt-regexp "[^\n]*\\(>[\t ]+\\)+$"
   2.456 +  "Regexp which matches the Lua program's prompt."
   2.457 +  :type  'regexp
   2.458 +  :group 'lua)
   2.459  
   2.460 -              <div class="select-menu-item js-navigation-item js-navigation-target selected">
   2.461 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   2.462 -                <a href="/immerrr/lua-mode/blob/master/lua-mode.el" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="master" rel="nofollow" title="master">master</a>
   2.463 -              </div> <!-- /.select-menu-item -->
   2.464 +(defcustom lua-traceback-line-re
   2.465 +  "^\\(?:[\t ]*\\|.*>[\t ]+\\)\\([^\n\t ]+\\):\\([0-9]+\\):"
   2.466 +  "Regular expression that describes tracebacks and errors."
   2.467 +  :type 'regexp
   2.468 +  :group 'lua)
   2.469  
   2.470 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   2.471 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   2.472 -                <a href="/immerrr/lua-mode/blob/multiline_literals/lua-mode.el" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="multiline_literals" rel="nofollow" title="multiline_literals">multiline_literals</a>
   2.473 -              </div> <!-- /.select-menu-item -->
   2.474 +(defcustom lua-indent-string-contents nil
   2.475 +  "If non-nil, contents of multiline string will be indented.
   2.476 +Otherwise leading amount of whitespace on each line is preserved."
   2.477 +  :group 'lua
   2.478 +  :type 'boolean)
   2.479  
   2.480 -              <div class="select-menu-no-results js-not-filterable">Nothing to show</div>
   2.481 -          </div> <!-- /.select-menu-list -->
   2.482 +(defcustom lua-jump-on-traceback t
   2.483 +  "*Jump to innermost traceback location in *lua* buffer.  When this
   2.484 +variable is non-nil and a traceback occurs when running Lua code in a
   2.485 +subprocess, jump immediately to the source code of the innermost
   2.486 +traceback location."
   2.487 +  :type 'boolean
   2.488 +  :group 'lua)
   2.489  
   2.490 +(defcustom lua-mode-hook nil
   2.491 +  "Hooks called when Lua mode fires up."
   2.492 +  :type 'hook
   2.493 +  :group 'lua)
   2.494  
   2.495 -          <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket css-truncate" data-tab-filter="tags" data-filterable-for="commitish-filter-field" data-filterable-type="substring">
   2.496 +(defvar lua-region-start (make-marker)
   2.497 +  "Start of special region for Lua communication.")
   2.498  
   2.499 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   2.500 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   2.501 -                    <a href="/immerrr/lua-mode/blob/rel-20111107/lua-mode.el" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="rel-20111107" rel="nofollow" title="rel-20111107">rel-20111107</a>
   2.502 +(defvar lua-region-end (make-marker)
   2.503 +  "End of special region for Lua communication.")
   2.504  
   2.505 -              </div> <!-- /.select-menu-item -->
   2.506 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   2.507 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   2.508 -                    <a href="/immerrr/lua-mode/blob/rel-20110428/lua-mode.el" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="rel-20110428" rel="nofollow" title="rel-20110428">rel-20110428</a>
   2.509 +(defvar lua-emacs-menu
   2.510 +  '(["Restart With Whole File" lua-restart-with-whole-file t]
   2.511 +    ["Kill Process" lua-kill-process t]
   2.512 +    ["Hide Process Buffer" lua-hide-process-buffer t]
   2.513 +    ["Show Process Buffer" lua-show-process-buffer t]
   2.514 +    ["Beginning Of Proc" lua-beginning-of-proc t]
   2.515 +    ["End Of Proc" lua-end-of-proc t]
   2.516 +    ["Set Lua-Region Start" lua-set-lua-region-start t]
   2.517 +    ["Set Lua-Region End" lua-set-lua-region-end t]
   2.518 +    ["Send Lua-Region" lua-send-lua-region t]
   2.519 +    ["Send Current Line" lua-send-current-line t]
   2.520 +    ["Send Region" lua-send-region t]
   2.521 +    ["Send Proc" lua-send-proc t]
   2.522 +    ["Send Buffer" lua-send-buffer t]
   2.523 +    ["Search Documentation" lua-search-documentation t])
   2.524 +  "Emacs menu for Lua mode.")
   2.525  
   2.526 -              </div> <!-- /.select-menu-item -->
   2.527 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   2.528 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   2.529 -                    <a href="/immerrr/lua-mode/blob/rel-20110324/lua-mode.el" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="rel-20110324" rel="nofollow" title="rel-20110324">rel-20110324</a>
   2.530 +;; the whole defconst is inside eval-when-compile, because it's later referenced
   2.531 +;; inside another eval-and-compile block
   2.532 +(eval-and-compile
   2.533 +  (defconst
   2.534 +    lua--builtins
   2.535 +    (let*
   2.536 +        ((modules
   2.537 +          '("_G" "_VERSION" "assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable"
   2.538 +            "ipairs" "load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print" 
   2.539 +            "rawequal" "rawget" "rawlen" "rawset" "require" "select" "setfenv" "setmetatable"
   2.540 +            "tonumber" "tostring" "type" "unpack" "xpcall"
   2.541 +            ("bit32" . ("arshift" "band" "bnot" "bor" "btest" "bxor" "extract" "lrotate" "lshift"
   2.542 +                        "replace" "rrotate" "rshift"))
   2.543 +            ("coroutine" . ("create" "resume" "running" "status" "wrap" "yield"))
   2.544 +            ("debug" . ("debug" "getfenv" "gethook" "getinfo" "getlocal" "getmetatable" 
   2.545 +                        "getregistry" "getupvalue" "getuservalue" "setfenv" "sethook" "setlocal" 
   2.546 +                        "setmetatable" "setupvalue" "setuservalue" "traceback" "upvalueid"
   2.547 +                        "upvaluejoin"))
   2.548 +            ("io" . ("close" "flush" "input" "lines" "open" "output" "popen" "read" "stderr" 
   2.549 +                     "stdin" "stdout" "tmpfile" "type" "write"))
   2.550 +            ("math" . ("abs" "acos" "asin" "atan" "atan2" "ceil" "cos" "cosh" "deg" "exp" "floor"
   2.551 +                       "fmod" "frexp" "huge" "ldexp" "log" "log10" "max" "min" "modf" "pi" "pow"
   2.552 +                       "rad" "random" "randomseed" "sin" "sinh" "sqrt" "tan" "tanh"))
   2.553 +            ("os" . ("clock" "date" "difftime" "execute" "exit" "getenv" "remove" "rename"
   2.554 +                     "setlocale" "time" "tmpname"))
   2.555 +            ("package" . ("config" "cpath" "loaded" "loaders" "loadlib" "path" "preload"
   2.556 +                          "searchers" "searchpath" "seeall"))
   2.557 +            ("string" . ("byte" "char" "dump" "find" "format" "gmatch" "gsub" "len" "lower"
   2.558 +                         "match" "rep" "reverse" "sub" "upper"))
   2.559 +            ("table" . ("concat" "insert" "maxn" "pack" "remove" "sort" "unpack")))))
   2.560  
   2.561 -              </div> <!-- /.select-menu-item -->
   2.562 +      ;; This code uses \\< and \\> to delimit builtin symbols instead of
   2.563 +      ;; \\_< and \\_>, because -- a necessity -- '.' syntax class is hacked
   2.564 +      ;; to 'symbol' and \\_> won't detect a symbol boundary in 'foo.bar' and
   2.565 +      ;; -- sufficiency -- conveniently, underscore '_' is hacked to count as
   2.566 +      ;; word constituent, but only for font-locking. Neither of these hacks
   2.567 +      ;; makes sense to me, I'm going to wipe them out as soon as I'm sure
   2.568 +      ;; that indentation won't get hurt. --immerrr
   2.569 +      ;;
   2.570 +      (lua--cl-labels
   2.571 +          ((module-name-re (x)
   2.572 +                           (concat "\\(?1:\\<"
   2.573 +                                   (if (listp x) (car x) x)
   2.574 +                                   "\\>\\)"))
   2.575 +           (module-members-re (x) (if (listp x)
   2.576 +                                      (concat "\\(?:[ \t]*\\.[ \t]*"
   2.577 +                                              "\\<\\(?2:"
   2.578 +                                              (regexp-opt (cdr x))
   2.579 +                                              "\\)\\>\\)?")
   2.580 +                                    "")))
   2.581  
   2.582 -            <div class="select-menu-no-results js-not-filterable">Nothing to show</div>
   2.583 +        (concat
   2.584 +         ;; common prefix - beginning-of-line or neither of [ '.', ':' ] to
   2.585 +         ;; exclude "foo.string.rep"
   2.586 +         "\\(?:\\`\\|[^:. \n\t]\\)"
   2.587 +         ;; optional whitespace
   2.588 +         "[ \n\t]*"
   2.589 +         "\\(?:"
   2.590 +         ;; any of modules/functions
   2.591 +         (mapconcat (lambda (x) (concat (module-name-re x)
   2.592 +                                        (module-members-re x)))
   2.593 +                    modules
   2.594 +                    "\\|")
   2.595 +         "\\)"))))
   2.596  
   2.597 -          </div> <!-- /.select-menu-list -->
   2.598 +  "A regexp that matches lua builtin functions & variables.
   2.599  
   2.600 -        </div> <!-- /.select-menu-modal -->
   2.601 -      </div> <!-- /.select-menu-modal-holder -->
   2.602 -    </div> <!-- /.select-menu -->
   2.603 +This is a compilation of 5.1 and 5.2 builtins taken from the
   2.604 +index of respective Lua reference manuals.")
   2.605  
   2.606 -  </div> <!-- /.scope -->
   2.607 +(defvar lua-font-lock-keywords
   2.608 +  (eval-when-compile
   2.609 +    (list
   2.610 +     ;; highlight the hash-bang line "#!/foo/bar/lua" as comment
   2.611 +     '("^#!.*$" . font-lock-comment-face)
   2.612 +     ;; Handle variable names
   2.613 +     ;;  local blalba =
   2.614 +     ;;        ^^^^^^
   2.615 +     '("\\(local[ \t]+\\(\\sw+\\)[ \t]*=\\)"
   2.616 +       (2 font-lock-variable-name-face))
   2.617  
   2.618 -  <ul class="tabnav-tabs">
   2.619 -    <li><a href="/immerrr/lua-mode" class="selected tabnav-tab" highlight="repo_source">Files</a></li>
   2.620 -    <li><a href="/immerrr/lua-mode/commits/master" class="tabnav-tab" highlight="repo_commits">Commits</a></li>
   2.621 -    <li><a href="/immerrr/lua-mode/branches" class="tabnav-tab" highlight="repo_branches" rel="nofollow">Branches <span class="counter ">5</span></a></li>
   2.622 -  </ul>
   2.623 +     ;; Function name declarations.
   2.624 +     '("^[ \t]*\\_<\\(\\(local[ \t]+\\)?function\\)\\_>[ \t]+\\(\\(\\sw:\\|\\sw\\.\\|\\sw_\\|\\sw\\)+\\)"
   2.625 +       (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t))
   2.626  
   2.627 -</div>
   2.628 +     ;; Highlight lua builtin functions and variables
   2.629 +     `(,lua--builtins
   2.630 +           (1 font-lock-builtin-face) (2 font-lock-builtin-face nil noerror))
   2.631  
   2.632 -  
   2.633 -  
   2.634 -  
   2.635 +     ;; Handle function names in assignments
   2.636 +     '("\\(\\(\\sw:\\|\\sw\\.\\|\\sw_\\|\\sw\\)+\\)[ \t]*=[ \t]*\\(function\\)\\_>"
   2.637 +       (1 font-lock-function-name-face nil t) (3 font-lock-keyword-face))
   2.638  
   2.639 +     ;; octal numbers
   2.640 +     '("\\_<0x[[:xdigit:]]+\\_>" . font-lock-constant-face)
   2.641  
   2.642 -            
   2.643 -          </div>
   2.644 -        </div><!-- /.repohead -->
   2.645 +     ;; regular numbers
   2.646 +     ;;
   2.647 +     ;; This regexp relies on '.' being symbol constituent. Whenever this
   2.648 +     ;; changes, the regexp needs revisiting --immerrr
   2.649 +     `(,(concat "\\_<\\(?1:"
   2.650 +                ;; make a digit on either side of dot mandatory
   2.651 +                "\\(?:[0-9]+\\.?[0-9]*\\|[0-9]*\\.?[0-9]+\\)"
   2.652 +                "\\(?:[eE][+-]?[0-9]+\\)?"
   2.653 +                "\\)\\_>")
   2.654 +       . font-lock-constant-face)
   2.655  
   2.656 -        <div id="js-repo-pjax-container" class="container context-loader-container" data-pjax-container>
   2.657 -          
   2.658 +     ;; Keywords.
   2.659 +     (concat "\\_<"
   2.660 +             (regexp-opt '("and" "break" "do" "else" "elseif" "end" "false"
   2.661 +                           "for" "function" "if" "in" "local" "nil" "not"
   2.662 +                           "or" "repeat" "return" "then" "true" "until"
   2.663 +                           "while") t)
   2.664 +             "\\_>")
   2.665  
   2.666 +     "Default expressions to highlight in Lua mode.")))
   2.667  
   2.668 -<!-- blob contrib key: blob_contributors:v21:5c00d163385428f2cbceab8569302ca7 -->
   2.669 -<!-- blob contrib frag key: views10/v8/blob_contributors:v21:5c00d163385428f2cbceab8569302ca7 -->
   2.670 +(defvar lua-imenu-generic-expression
   2.671 +  '((nil "^[ \t]*\\(?:local[ \t]+\\)?function[ \t]+\\(\\(\\sw:\\|\\sw_\\|\\sw\\.\\|\\sw\\)+\\)" 1))
   2.672 +  "Imenu generic expression for lua-mode.  See `imenu-generic-expression'.")
   2.673  
   2.674 +(defvar lua-sexp-alist '(("then" . "end")
   2.675 +                         ("function" . "end")
   2.676 +                         ("do" . "end")))
   2.677  
   2.678 -<div id="slider">
   2.679 -    <div class="frame-meta">
   2.680 +(defvar lua-mode-abbrev-table nil
   2.681 +  "Abbreviation table used in lua-mode buffers.")
   2.682  
   2.683 -      <p title="This is a placeholder element" class="js-history-link-replace hidden"></p>
   2.684 +(define-abbrev-table 'lua-mode-abbrev-table
   2.685 +  ;; Emacs 23 introduced :system property that prevents abbrev
   2.686 +  ;; entries from being written to file specified by abbrev-file-name
   2.687 +  ;;
   2.688 +  ;; Emacs 22 and earlier had this functionality implemented
   2.689 +  ;; by simple nil/non-nil flag as positional parameter
   2.690 +  (if (>= emacs-major-version 23)
   2.691 +      '(("end"    "end"    lua-indent-line :system t)
   2.692 +        ("else"   "else"   lua-indent-line :system t)
   2.693 +        ("elseif" "elseif" lua-indent-line :system t))
   2.694 +    '(("end"    "end"      lua-indent-line nil 'system)
   2.695 +      ("else"   "else"     lua-indent-line nil 'system)
   2.696 +      ("elseif" "elseif"   lua-indent-line nil 'system))))
   2.697  
   2.698 -        <div class="breadcrumb">
   2.699 -          <span class='bold'><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/immerrr/lua-mode" class="js-slide-to" data-direction="back" itemscope="url"><span itemprop="title">lua-mode</span></a></span></span> / <strong class="final-path">lua-mode.el</strong> <span class="js-zeroclipboard zeroclipboard-button" data-clipboard-text="lua-mode.el" data-copied-hint="copied!" title="copy to clipboard"><span class="mini-icon mini-icon-clipboard"></span></span>
   2.700 -        </div>
   2.701 +(eval-and-compile
   2.702 +  (defalias 'lua-make-temp-file
   2.703 +    (if (fboundp 'make-temp-file)
   2.704 +        'make-temp-file
   2.705 +      (lambda (prefix &optional dir-flag) ;; Simple implementation
   2.706 +        (expand-file-name
   2.707 +         (make-temp-name prefix)
   2.708 +         (if (fboundp 'temp-directory)
   2.709 +             (temp-directory)
   2.710 +           temporary-file-directory))))))
   2.711  
   2.712 -      <a href="/immerrr/lua-mode/find/master" class="js-slide-to" data-hotkey="t" style="display:none">Show File Finder</a>
   2.713 +(defvar lua-mode-syntax-table
   2.714 +  (with-syntax-table (copy-syntax-table)
   2.715 +    (modify-syntax-entry ?+ ".")
   2.716 +    (modify-syntax-entry ?- ". 12")
   2.717 +    (modify-syntax-entry ?* ".")
   2.718 +    (modify-syntax-entry ?/ ".")
   2.719 +    (modify-syntax-entry ?^ ".")
   2.720 +    ;; This might be better as punctuation, as for C, but this way you
   2.721 +    ;; can treat table index as symbol.
   2.722 +    (modify-syntax-entry ?. "_")        ; e.g. `io.string'
   2.723 +    (modify-syntax-entry ?> ".")
   2.724 +    (modify-syntax-entry ?< ".")
   2.725 +    (modify-syntax-entry ?= ".")
   2.726 +    (modify-syntax-entry ?~ ".")
   2.727 +    (modify-syntax-entry ?\n ">")
   2.728 +    (modify-syntax-entry ?\' "\"")
   2.729 +    (modify-syntax-entry ?\" "\"")
   2.730 +    (syntax-table))
   2.731 +  "Syntax table used while in `lua-mode'.")
   2.732  
   2.733 +;;;###autoload
   2.734 +(define-derived-mode lua-mode lua--prog-mode "Lua"
   2.735 +  "Major mode for editing Lua code."
   2.736 +  :abbrev-table lua-mode-abbrev-table
   2.737 +  :syntax-table lua-mode-syntax-table
   2.738 +  :group 'lua
   2.739 +  (let ((switches nil)
   2.740 +        s)
   2.741 +    (setq comint-prompt-regexp lua-prompt-regexp)
   2.742 +    (make-local-variable 'lua-default-command-switches)
   2.743 +    (set (make-local-variable 'beginning-of-defun-function)
   2.744 +         'lua-beginning-of-proc)
   2.745 +    (set (make-local-variable 'end-of-defun-function) 'lua-end-of-proc)
   2.746 +    (set (make-local-variable 'indent-line-function) 'lua-indent-line)
   2.747 +    (set (make-local-variable 'comment-start) lua-comment-start)
   2.748 +    (set (make-local-variable 'comment-start-skip) lua-comment-start-skip)
   2.749 +    (set (make-local-variable 'font-lock-defaults)
   2.750 +         '(lua-font-lock-keywords
   2.751 +           nil nil ((?_ . "w"))))
   2.752 +    (set (make-local-variable 'imenu-generic-expression)
   2.753 +         lua-imenu-generic-expression)
   2.754 +    (make-local-variable 'lua-default-eval)
   2.755 +    ;; setup menu bar entry (XEmacs style)
   2.756 +    (if (and (featurep 'menubar)
   2.757 +             (boundp 'current-menubar)
   2.758 +             (fboundp 'set-buffer-menubar)
   2.759 +             (fboundp 'add-menu)
   2.760 +             (not (assoc "Lua" current-menubar)))
   2.761 +        (progn
   2.762 +          (set-buffer-menubar (copy-sequence current-menubar))
   2.763 +          (add-menu nil "Lua" lua-emacs-menu)))
   2.764 +    ;; Append Lua menu to popup menu for Emacs.
   2.765 +    (if (boundp 'mode-popup-menu)
   2.766 +        (setq mode-popup-menu
   2.767 +              (cons (concat mode-name " Mode Commands") lua-emacs-menu)))
   2.768  
   2.769 -        <div class="commit commit-loader file-history-tease js-deferred-content" data-url="/immerrr/lua-mode/contributors/master/lua-mode.el">
   2.770 -          Fetching contributors…
   2.771 +    ;; hideshow setup
   2.772 +    (unless (assq 'lua-mode hs-special-modes-alist)
   2.773 +      (add-to-list 'hs-special-modes-alist
   2.774 +                   `(lua-mode
   2.775 +                     ,(regexp-opt (mapcar 'car lua-sexp-alist) 'words) ;start
   2.776 +                     ,(regexp-opt (mapcar 'cdr lua-sexp-alist) 'words) ;end
   2.777 +                     nil lua-forward-sexp)))
   2.778  
   2.779 -          <div class="participation">
   2.780 -            <p class="loader-loading"><img alt="Octocat-spinner-32-eaf2f5" height="16" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32-EAF2F5.gif?1359500886" width="16" /></p>
   2.781 -            <p class="loader-error">Cannot retrieve contributors at this time</p>
   2.782 -          </div>
   2.783 -        </div>
   2.784 +    (set (make-local-variable 'parse-sexp-lookup-properties) t)
   2.785 +    (lua-mark-all-multiline-literals)
   2.786 +    (lua--automark-multiline-update-timer)))
   2.787  
   2.788 -    </div><!-- ./.frame-meta -->
   2.789 +;;;###autoload
   2.790 +(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
   2.791  
   2.792 -    <div class="frames">
   2.793 -      <div class="frame" data-permalink-url="/immerrr/lua-mode/blob/e6a46ee34362b5090748643d4b2bef1f849ea0a8/lua-mode.el" data-title="lua-mode/lua-mode.el at master · immerrr/lua-mode · GitHub" data-type="blob">
   2.794 +;;;###autoload
   2.795 +(add-to-list 'interpreter-mode-alist '("lua" . lua-mode))
   2.796  
   2.797 -        <div id="files" class="bubble">
   2.798 -          <div class="file">
   2.799 -            <div class="meta">
   2.800 -              <div class="info">
   2.801 -                <span class="icon"><b class="mini-icon mini-icon-text-file"></b></span>
   2.802 -                <span class="mode" title="File Mode">file</span>
   2.803 -                  <span>1666 lines (1458 sloc)</span>
   2.804 -                <span>68.277 kb</span>
   2.805 -              </div>
   2.806 -              <div class="actions">
   2.807 -                <div class="button-group">
   2.808 -                      <a class="minibutton js-entice" href=""
   2.809 -                         data-entice="You must be signed in and on a branch to make or propose changes">Edit</a>
   2.810 -                  <a href="/immerrr/lua-mode/raw/master/lua-mode.el" class="button minibutton " id="raw-url">Raw</a>
   2.811 -                    <a href="/immerrr/lua-mode/blame/master/lua-mode.el" class="button minibutton ">Blame</a>
   2.812 -                  <a href="/immerrr/lua-mode/commits/master/lua-mode.el" class="button minibutton " rel="nofollow">History</a>
   2.813 -                </div><!-- /.button-group -->
   2.814 -              </div><!-- /.actions -->
   2.815 +(defun lua-electric-match (arg)
   2.816 +  "Insert character and adjust indentation."
   2.817 +  (interactive "P")
   2.818 +  (insert-char last-command-event (prefix-numeric-value arg))
   2.819 +  (if lua-electric-flag
   2.820 +      (lua-indent-line))
   2.821 +  (blink-matching-open))
   2.822  
   2.823 -            </div>
   2.824 -                <div class="data type-emacs-lisp js-blob-data">
   2.825 -      <table cellpadding="0" cellspacing="0" class="lines">
   2.826 -        <tr>
   2.827 -          <td>
   2.828 -            <pre class="line_numbers"><span id="L1" rel="#L1">1</span>
   2.829 -<span id="L2" rel="#L2">2</span>
   2.830 -<span id="L3" rel="#L3">3</span>
   2.831 -<span id="L4" rel="#L4">4</span>
   2.832 -<span id="L5" rel="#L5">5</span>
   2.833 -<span id="L6" rel="#L6">6</span>
   2.834 -<span id="L7" rel="#L7">7</span>
   2.835 -<span id="L8" rel="#L8">8</span>
   2.836 -<span id="L9" rel="#L9">9</span>
   2.837 -<span id="L10" rel="#L10">10</span>
   2.838 -<span id="L11" rel="#L11">11</span>
   2.839 -<span id="L12" rel="#L12">12</span>
   2.840 -<span id="L13" rel="#L13">13</span>
   2.841 -<span id="L14" rel="#L14">14</span>
   2.842 -<span id="L15" rel="#L15">15</span>
   2.843 -<span id="L16" rel="#L16">16</span>
   2.844 -<span id="L17" rel="#L17">17</span>
   2.845 -<span id="L18" rel="#L18">18</span>
   2.846 -<span id="L19" rel="#L19">19</span>
   2.847 -<span id="L20" rel="#L20">20</span>
   2.848 -<span id="L21" rel="#L21">21</span>
   2.849 -<span id="L22" rel="#L22">22</span>
   2.850 -<span id="L23" rel="#L23">23</span>
   2.851 -<span id="L24" rel="#L24">24</span>
   2.852 -<span id="L25" rel="#L25">25</span>
   2.853 -<span id="L26" rel="#L26">26</span>
   2.854 -<span id="L27" rel="#L27">27</span>
   2.855 -<span id="L28" rel="#L28">28</span>
   2.856 -<span id="L29" rel="#L29">29</span>
   2.857 -<span id="L30" rel="#L30">30</span>
   2.858 -<span id="L31" rel="#L31">31</span>
   2.859 -<span id="L32" rel="#L32">32</span>
   2.860 -<span id="L33" rel="#L33">33</span>
   2.861 -<span id="L34" rel="#L34">34</span>
   2.862 -<span id="L35" rel="#L35">35</span>
   2.863 -<span id="L36" rel="#L36">36</span>
   2.864 -<span id="L37" rel="#L37">37</span>
   2.865 -<span id="L38" rel="#L38">38</span>
   2.866 -<span id="L39" rel="#L39">39</span>
   2.867 -<span id="L40" rel="#L40">40</span>
   2.868 -<span id="L41" rel="#L41">41</span>
   2.869 -<span id="L42" rel="#L42">42</span>
   2.870 -<span id="L43" rel="#L43">43</span>
   2.871 -<span id="L44" rel="#L44">44</span>
   2.872 -<span id="L45" rel="#L45">45</span>
   2.873 -<span id="L46" rel="#L46">46</span>
   2.874 -<span id="L47" rel="#L47">47</span>
   2.875 -<span id="L48" rel="#L48">48</span>
   2.876 -<span id="L49" rel="#L49">49</span>
   2.877 -<span id="L50" rel="#L50">50</span>
   2.878 -<span id="L51" rel="#L51">51</span>
   2.879 -<span id="L52" rel="#L52">52</span>
   2.880 -<span id="L53" rel="#L53">53</span>
   2.881 -<span id="L54" rel="#L54">54</span>
   2.882 -<span id="L55" rel="#L55">55</span>
   2.883 -<span id="L56" rel="#L56">56</span>
   2.884 -<span id="L57" rel="#L57">57</span>
   2.885 -<span id="L58" rel="#L58">58</span>
   2.886 -<span id="L59" rel="#L59">59</span>
   2.887 -<span id="L60" rel="#L60">60</span>
   2.888 -<span id="L61" rel="#L61">61</span>
   2.889 -<span id="L62" rel="#L62">62</span>
   2.890 -<span id="L63" rel="#L63">63</span>
   2.891 -<span id="L64" rel="#L64">64</span>
   2.892 -<span id="L65" rel="#L65">65</span>
   2.893 -<span id="L66" rel="#L66">66</span>
   2.894 -<span id="L67" rel="#L67">67</span>
   2.895 -<span id="L68" rel="#L68">68</span>
   2.896 -<span id="L69" rel="#L69">69</span>
   2.897 -<span id="L70" rel="#L70">70</span>
   2.898 -<span id="L71" rel="#L71">71</span>
   2.899 -<span id="L72" rel="#L72">72</span>
   2.900 -<span id="L73" rel="#L73">73</span>
   2.901 -<span id="L74" rel="#L74">74</span>
   2.902 -<span id="L75" rel="#L75">75</span>
   2.903 -<span id="L76" rel="#L76">76</span>
   2.904 -<span id="L77" rel="#L77">77</span>
   2.905 -<span id="L78" rel="#L78">78</span>
   2.906 -<span id="L79" rel="#L79">79</span>
   2.907 -<span id="L80" rel="#L80">80</span>
   2.908 -<span id="L81" rel="#L81">81</span>
   2.909 -<span id="L82" rel="#L82">82</span>
   2.910 -<span id="L83" rel="#L83">83</span>
   2.911 -<span id="L84" rel="#L84">84</span>
   2.912 -<span id="L85" rel="#L85">85</span>
   2.913 -<span id="L86" rel="#L86">86</span>
   2.914 -<span id="L87" rel="#L87">87</span>
   2.915 -<span id="L88" rel="#L88">88</span>
   2.916 -<span id="L89" rel="#L89">89</span>
   2.917 -<span id="L90" rel="#L90">90</span>
   2.918 -<span id="L91" rel="#L91">91</span>
   2.919 -<span id="L92" rel="#L92">92</span>
   2.920 -<span id="L93" rel="#L93">93</span>
   2.921 -<span id="L94" rel="#L94">94</span>
   2.922 -<span id="L95" rel="#L95">95</span>
   2.923 -<span id="L96" rel="#L96">96</span>
   2.924 -<span id="L97" rel="#L97">97</span>
   2.925 -<span id="L98" rel="#L98">98</span>
   2.926 -<span id="L99" rel="#L99">99</span>
   2.927 -<span id="L100" rel="#L100">100</span>
   2.928 -<span id="L101" rel="#L101">101</span>
   2.929 -<span id="L102" rel="#L102">102</span>
   2.930 -<span id="L103" rel="#L103">103</span>
   2.931 -<span id="L104" rel="#L104">104</span>
   2.932 -<span id="L105" rel="#L105">105</span>
   2.933 -<span id="L106" rel="#L106">106</span>
   2.934 -<span id="L107" rel="#L107">107</span>
   2.935 -<span id="L108" rel="#L108">108</span>
   2.936 -<span id="L109" rel="#L109">109</span>
   2.937 -<span id="L110" rel="#L110">110</span>
   2.938 -<span id="L111" rel="#L111">111</span>
   2.939 -<span id="L112" rel="#L112">112</span>
   2.940 -<span id="L113" rel="#L113">113</span>
   2.941 -<span id="L114" rel="#L114">114</span>
   2.942 -<span id="L115" rel="#L115">115</span>
   2.943 -<span id="L116" rel="#L116">116</span>
   2.944 -<span id="L117" rel="#L117">117</span>
   2.945 -<span id="L118" rel="#L118">118</span>
   2.946 -<span id="L119" rel="#L119">119</span>
   2.947 -<span id="L120" rel="#L120">120</span>
   2.948 -<span id="L121" rel="#L121">121</span>
   2.949 -<span id="L122" rel="#L122">122</span>
   2.950 -<span id="L123" rel="#L123">123</span>
   2.951 -<span id="L124" rel="#L124">124</span>
   2.952 -<span id="L125" rel="#L125">125</span>
   2.953 -<span id="L126" rel="#L126">126</span>
   2.954 -<span id="L127" rel="#L127">127</span>
   2.955 -<span id="L128" rel="#L128">128</span>
   2.956 -<span id="L129" rel="#L129">129</span>
   2.957 -<span id="L130" rel="#L130">130</span>
   2.958 -<span id="L131" rel="#L131">131</span>
   2.959 -<span id="L132" rel="#L132">132</span>
   2.960 -<span id="L133" rel="#L133">133</span>
   2.961 -<span id="L134" rel="#L134">134</span>
   2.962 -<span id="L135" rel="#L135">135</span>
   2.963 -<span id="L136" rel="#L136">136</span>
   2.964 -<span id="L137" rel="#L137">137</span>
   2.965 -<span id="L138" rel="#L138">138</span>
   2.966 -<span id="L139" rel="#L139">139</span>
   2.967 -<span id="L140" rel="#L140">140</span>
   2.968 -<span id="L141" rel="#L141">141</span>
   2.969 -<span id="L142" rel="#L142">142</span>
   2.970 -<span id="L143" rel="#L143">143</span>
   2.971 -<span id="L144" rel="#L144">144</span>
   2.972 -<span id="L145" rel="#L145">145</span>
   2.973 -<span id="L146" rel="#L146">146</span>
   2.974 -<span id="L147" rel="#L147">147</span>
   2.975 -<span id="L148" rel="#L148">148</span>
   2.976 -<span id="L149" rel="#L149">149</span>
   2.977 -<span id="L150" rel="#L150">150</span>
   2.978 -<span id="L151" rel="#L151">151</span>
   2.979 -<span id="L152" rel="#L152">152</span>
   2.980 -<span id="L153" rel="#L153">153</span>
   2.981 -<span id="L154" rel="#L154">154</span>
   2.982 -<span id="L155" rel="#L155">155</span>
   2.983 -<span id="L156" rel="#L156">156</span>
   2.984 -<span id="L157" rel="#L157">157</span>
   2.985 -<span id="L158" rel="#L158">158</span>
   2.986 -<span id="L159" rel="#L159">159</span>
   2.987 -<span id="L160" rel="#L160">160</span>
   2.988 -<span id="L161" rel="#L161">161</span>
   2.989 -<span id="L162" rel="#L162">162</span>
   2.990 -<span id="L163" rel="#L163">163</span>
   2.991 -<span id="L164" rel="#L164">164</span>
   2.992 -<span id="L165" rel="#L165">165</span>
   2.993 -<span id="L166" rel="#L166">166</span>
   2.994 -<span id="L167" rel="#L167">167</span>
   2.995 -<span id="L168" rel="#L168">168</span>
   2.996 -<span id="L169" rel="#L169">169</span>
   2.997 -<span id="L170" rel="#L170">170</span>
   2.998 -<span id="L171" rel="#L171">171</span>
   2.999 -<span id="L172" rel="#L172">172</span>
  2.1000 -<span id="L173" rel="#L173">173</span>
  2.1001 -<span id="L174" rel="#L174">174</span>
  2.1002 -<span id="L175" rel="#L175">175</span>
  2.1003 -<span id="L176" rel="#L176">176</span>
  2.1004 -<span id="L177" rel="#L177">177</span>
  2.1005 -<span id="L178" rel="#L178">178</span>
  2.1006 -<span id="L179" rel="#L179">179</span>
  2.1007 -<span id="L180" rel="#L180">180</span>
  2.1008 -<span id="L181" rel="#L181">181</span>
  2.1009 -<span id="L182" rel="#L182">182</span>
  2.1010 -<span id="L183" rel="#L183">183</span>
  2.1011 -<span id="L184" rel="#L184">184</span>
  2.1012 -<span id="L185" rel="#L185">185</span>
  2.1013 -<span id="L186" rel="#L186">186</span>
  2.1014 -<span id="L187" rel="#L187">187</span>
  2.1015 -<span id="L188" rel="#L188">188</span>
  2.1016 -<span id="L189" rel="#L189">189</span>
  2.1017 -<span id="L190" rel="#L190">190</span>
  2.1018 -<span id="L191" rel="#L191">191</span>
  2.1019 -<span id="L192" rel="#L192">192</span>
  2.1020 -<span id="L193" rel="#L193">193</span>
  2.1021 -<span id="L194" rel="#L194">194</span>
  2.1022 -<span id="L195" rel="#L195">195</span>
  2.1023 -<span id="L196" rel="#L196">196</span>
  2.1024 -<span id="L197" rel="#L197">197</span>
  2.1025 -<span id="L198" rel="#L198">198</span>
  2.1026 -<span id="L199" rel="#L199">199</span>
  2.1027 -<span id="L200" rel="#L200">200</span>
  2.1028 -<span id="L201" rel="#L201">201</span>
  2.1029 -<span id="L202" rel="#L202">202</span>
  2.1030 -<span id="L203" rel="#L203">203</span>
  2.1031 -<span id="L204" rel="#L204">204</span>
  2.1032 -<span id="L205" rel="#L205">205</span>
  2.1033 -<span id="L206" rel="#L206">206</span>
  2.1034 -<span id="L207" rel="#L207">207</span>
  2.1035 -<span id="L208" rel="#L208">208</span>
  2.1036 -<span id="L209" rel="#L209">209</span>
  2.1037 -<span id="L210" rel="#L210">210</span>
  2.1038 -<span id="L211" rel="#L211">211</span>
  2.1039 -<span id="L212" rel="#L212">212</span>
  2.1040 -<span id="L213" rel="#L213">213</span>
  2.1041 -<span id="L214" rel="#L214">214</span>
  2.1042 -<span id="L215" rel="#L215">215</span>
  2.1043 -<span id="L216" rel="#L216">216</span>
  2.1044 -<span id="L217" rel="#L217">217</span>
  2.1045 -<span id="L218" rel="#L218">218</span>
  2.1046 -<span id="L219" rel="#L219">219</span>
  2.1047 -<span id="L220" rel="#L220">220</span>
  2.1048 -<span id="L221" rel="#L221">221</span>
  2.1049 -<span id="L222" rel="#L222">222</span>
  2.1050 -<span id="L223" rel="#L223">223</span>
  2.1051 -<span id="L224" rel="#L224">224</span>
  2.1052 -<span id="L225" rel="#L225">225</span>
  2.1053 -<span id="L226" rel="#L226">226</span>
  2.1054 -<span id="L227" rel="#L227">227</span>
  2.1055 -<span id="L228" rel="#L228">228</span>
  2.1056 -<span id="L229" rel="#L229">229</span>
  2.1057 -<span id="L230" rel="#L230">230</span>
  2.1058 -<span id="L231" rel="#L231">231</span>
  2.1059 -<span id="L232" rel="#L232">232</span>
  2.1060 -<span id="L233" rel="#L233">233</span>
  2.1061 -<span id="L234" rel="#L234">234</span>
  2.1062 -<span id="L235" rel="#L235">235</span>
  2.1063 -<span id="L236" rel="#L236">236</span>
  2.1064 -<span id="L237" rel="#L237">237</span>
  2.1065 -<span id="L238" rel="#L238">238</span>
  2.1066 -<span id="L239" rel="#L239">239</span>
  2.1067 -<span id="L240" rel="#L240">240</span>
  2.1068 -<span id="L241" rel="#L241">241</span>
  2.1069 -<span id="L242" rel="#L242">242</span>
  2.1070 -<span id="L243" rel="#L243">243</span>
  2.1071 -<span id="L244" rel="#L244">244</span>
  2.1072 -<span id="L245" rel="#L245">245</span>
  2.1073 -<span id="L246" rel="#L246">246</span>
  2.1074 -<span id="L247" rel="#L247">247</span>
  2.1075 -<span id="L248" rel="#L248">248</span>
  2.1076 -<span id="L249" rel="#L249">249</span>
  2.1077 -<span id="L250" rel="#L250">250</span>
  2.1078 -<span id="L251" rel="#L251">251</span>
  2.1079 -<span id="L252" rel="#L252">252</span>
  2.1080 -<span id="L253" rel="#L253">253</span>
  2.1081 -<span id="L254" rel="#L254">254</span>
  2.1082 -<span id="L255" rel="#L255">255</span>
  2.1083 -<span id="L256" rel="#L256">256</span>
  2.1084 -<span id="L257" rel="#L257">257</span>
  2.1085 -<span id="L258" rel="#L258">258</span>
  2.1086 -<span id="L259" rel="#L259">259</span>
  2.1087 -<span id="L260" rel="#L260">260</span>
  2.1088 -<span id="L261" rel="#L261">261</span>
  2.1089 -<span id="L262" rel="#L262">262</span>
  2.1090 -<span id="L263" rel="#L263">263</span>
  2.1091 -<span id="L264" rel="#L264">264</span>
  2.1092 -<span id="L265" rel="#L265">265</span>
  2.1093 -<span id="L266" rel="#L266">266</span>
  2.1094 -<span id="L267" rel="#L267">267</span>
  2.1095 -<span id="L268" rel="#L268">268</span>
  2.1096 -<span id="L269" rel="#L269">269</span>
  2.1097 -<span id="L270" rel="#L270">270</span>
  2.1098 -<span id="L271" rel="#L271">271</span>
  2.1099 -<span id="L272" rel="#L272">272</span>
  2.1100 -<span id="L273" rel="#L273">273</span>
  2.1101 -<span id="L274" rel="#L274">274</span>
  2.1102 -<span id="L275" rel="#L275">275</span>
  2.1103 -<span id="L276" rel="#L276">276</span>
  2.1104 -<span id="L277" rel="#L277">277</span>
  2.1105 -<span id="L278" rel="#L278">278</span>
  2.1106 -<span id="L279" rel="#L279">279</span>
  2.1107 -<span id="L280" rel="#L280">280</span>
  2.1108 -<span id="L281" rel="#L281">281</span>
  2.1109 -<span id="L282" rel="#L282">282</span>
  2.1110 -<span id="L283" rel="#L283">283</span>
  2.1111 -<span id="L284" rel="#L284">284</span>
  2.1112 -<span id="L285" rel="#L285">285</span>
  2.1113 -<span id="L286" rel="#L286">286</span>
  2.1114 -<span id="L287" rel="#L287">287</span>
  2.1115 -<span id="L288" rel="#L288">288</span>
  2.1116 -<span id="L289" rel="#L289">289</span>
  2.1117 -<span id="L290" rel="#L290">290</span>
  2.1118 -<span id="L291" rel="#L291">291</span>
  2.1119 -<span id="L292" rel="#L292">292</span>
  2.1120 -<span id="L293" rel="#L293">293</span>
  2.1121 -<span id="L294" rel="#L294">294</span>
  2.1122 -<span id="L295" rel="#L295">295</span>
  2.1123 -<span id="L296" rel="#L296">296</span>
  2.1124 -<span id="L297" rel="#L297">297</span>
  2.1125 -<span id="L298" rel="#L298">298</span>
  2.1126 -<span id="L299" rel="#L299">299</span>
  2.1127 -<span id="L300" rel="#L300">300</span>
  2.1128 -<span id="L301" rel="#L301">301</span>
  2.1129 -<span id="L302" rel="#L302">302</span>
  2.1130 -<span id="L303" rel="#L303">303</span>
  2.1131 -<span id="L304" rel="#L304">304</span>
  2.1132 -<span id="L305" rel="#L305">305</span>
  2.1133 -<span id="L306" rel="#L306">306</span>
  2.1134 -<span id="L307" rel="#L307">307</span>
  2.1135 -<span id="L308" rel="#L308">308</span>
  2.1136 -<span id="L309" rel="#L309">309</span>
  2.1137 -<span id="L310" rel="#L310">310</span>
  2.1138 -<span id="L311" rel="#L311">311</span>
  2.1139 -<span id="L312" rel="#L312">312</span>
  2.1140 -<span id="L313" rel="#L313">313</span>
  2.1141 -<span id="L314" rel="#L314">314</span>
  2.1142 -<span id="L315" rel="#L315">315</span>
  2.1143 -<span id="L316" rel="#L316">316</span>
  2.1144 -<span id="L317" rel="#L317">317</span>
  2.1145 -<span id="L318" rel="#L318">318</span>
  2.1146 -<span id="L319" rel="#L319">319</span>
  2.1147 -<span id="L320" rel="#L320">320</span>
  2.1148 -<span id="L321" rel="#L321">321</span>
  2.1149 -<span id="L322" rel="#L322">322</span>
  2.1150 -<span id="L323" rel="#L323">323</span>
  2.1151 -<span id="L324" rel="#L324">324</span>
  2.1152 -<span id="L325" rel="#L325">325</span>
  2.1153 -<span id="L326" rel="#L326">326</span>
  2.1154 -<span id="L327" rel="#L327">327</span>
  2.1155 -<span id="L328" rel="#L328">328</span>
  2.1156 -<span id="L329" rel="#L329">329</span>
  2.1157 -<span id="L330" rel="#L330">330</span>
  2.1158 -<span id="L331" rel="#L331">331</span>
  2.1159 -<span id="L332" rel="#L332">332</span>
  2.1160 -<span id="L333" rel="#L333">333</span>
  2.1161 -<span id="L334" rel="#L334">334</span>
  2.1162 -<span id="L335" rel="#L335">335</span>
  2.1163 -<span id="L336" rel="#L336">336</span>
  2.1164 -<span id="L337" rel="#L337">337</span>
  2.1165 -<span id="L338" rel="#L338">338</span>
  2.1166 -<span id="L339" rel="#L339">339</span>
  2.1167 -<span id="L340" rel="#L340">340</span>
  2.1168 -<span id="L341" rel="#L341">341</span>
  2.1169 -<span id="L342" rel="#L342">342</span>
  2.1170 -<span id="L343" rel="#L343">343</span>
  2.1171 -<span id="L344" rel="#L344">344</span>
  2.1172 -<span id="L345" rel="#L345">345</span>
  2.1173 -<span id="L346" rel="#L346">346</span>
  2.1174 -<span id="L347" rel="#L347">347</span>
  2.1175 -<span id="L348" rel="#L348">348</span>
  2.1176 -<span id="L349" rel="#L349">349</span>
  2.1177 -<span id="L350" rel="#L350">350</span>
  2.1178 -<span id="L351" rel="#L351">351</span>
  2.1179 -<span id="L352" rel="#L352">352</span>
  2.1180 -<span id="L353" rel="#L353">353</span>
  2.1181 -<span id="L354" rel="#L354">354</span>
  2.1182 -<span id="L355" rel="#L355">355</span>
  2.1183 -<span id="L356" rel="#L356">356</span>
  2.1184 -<span id="L357" rel="#L357">357</span>
  2.1185 -<span id="L358" rel="#L358">358</span>
  2.1186 -<span id="L359" rel="#L359">359</span>
  2.1187 -<span id="L360" rel="#L360">360</span>
  2.1188 -<span id="L361" rel="#L361">361</span>
  2.1189 -<span id="L362" rel="#L362">362</span>
  2.1190 -<span id="L363" rel="#L363">363</span>
  2.1191 -<span id="L364" rel="#L364">364</span>
  2.1192 -<span id="L365" rel="#L365">365</span>
  2.1193 -<span id="L366" rel="#L366">366</span>
  2.1194 -<span id="L367" rel="#L367">367</span>
  2.1195 -<span id="L368" rel="#L368">368</span>
  2.1196 -<span id="L369" rel="#L369">369</span>
  2.1197 -<span id="L370" rel="#L370">370</span>
  2.1198 -<span id="L371" rel="#L371">371</span>
  2.1199 -<span id="L372" rel="#L372">372</span>
  2.1200 -<span id="L373" rel="#L373">373</span>
  2.1201 -<span id="L374" rel="#L374">374</span>
  2.1202 -<span id="L375" rel="#L375">375</span>
  2.1203 -<span id="L376" rel="#L376">376</span>
  2.1204 -<span id="L377" rel="#L377">377</span>
  2.1205 -<span id="L378" rel="#L378">378</span>
  2.1206 -<span id="L379" rel="#L379">379</span>
  2.1207 -<span id="L380" rel="#L380">380</span>
  2.1208 -<span id="L381" rel="#L381">381</span>
  2.1209 -<span id="L382" rel="#L382">382</span>
  2.1210 -<span id="L383" rel="#L383">383</span>
  2.1211 -<span id="L384" rel="#L384">384</span>
  2.1212 -<span id="L385" rel="#L385">385</span>
  2.1213 -<span id="L386" rel="#L386">386</span>
  2.1214 -<span id="L387" rel="#L387">387</span>
  2.1215 -<span id="L388" rel="#L388">388</span>
  2.1216 -<span id="L389" rel="#L389">389</span>
  2.1217 -<span id="L390" rel="#L390">390</span>
  2.1218 -<span id="L391" rel="#L391">391</span>
  2.1219 -<span id="L392" rel="#L392">392</span>
  2.1220 -<span id="L393" rel="#L393">393</span>
  2.1221 -<span id="L394" rel="#L394">394</span>
  2.1222 -<span id="L395" rel="#L395">395</span>
  2.1223 -<span id="L396" rel="#L396">396</span>
  2.1224 -<span id="L397" rel="#L397">397</span>
  2.1225 -<span id="L398" rel="#L398">398</span>
  2.1226 -<span id="L399" rel="#L399">399</span>
  2.1227 -<span id="L400" rel="#L400">400</span>
  2.1228 -<span id="L401" rel="#L401">401</span>
  2.1229 -<span id="L402" rel="#L402">402</span>
  2.1230 -<span id="L403" rel="#L403">403</span>
  2.1231 -<span id="L404" rel="#L404">404</span>
  2.1232 -<span id="L405" rel="#L405">405</span>
  2.1233 -<span id="L406" rel="#L406">406</span>
  2.1234 -<span id="L407" rel="#L407">407</span>
  2.1235 -<span id="L408" rel="#L408">408</span>
  2.1236 -<span id="L409" rel="#L409">409</span>
  2.1237 -<span id="L410" rel="#L410">410</span>
  2.1238 -<span id="L411" rel="#L411">411</span>
  2.1239 -<span id="L412" rel="#L412">412</span>
  2.1240 -<span id="L413" rel="#L413">413</span>
  2.1241 -<span id="L414" rel="#L414">414</span>
  2.1242 -<span id="L415" rel="#L415">415</span>
  2.1243 -<span id="L416" rel="#L416">416</span>
  2.1244 -<span id="L417" rel="#L417">417</span>
  2.1245 -<span id="L418" rel="#L418">418</span>
  2.1246 -<span id="L419" rel="#L419">419</span>
  2.1247 -<span id="L420" rel="#L420">420</span>
  2.1248 -<span id="L421" rel="#L421">421</span>
  2.1249 -<span id="L422" rel="#L422">422</span>
  2.1250 -<span id="L423" rel="#L423">423</span>
  2.1251 -<span id="L424" rel="#L424">424</span>
  2.1252 -<span id="L425" rel="#L425">425</span>
  2.1253 -<span id="L426" rel="#L426">426</span>
  2.1254 -<span id="L427" rel="#L427">427</span>
  2.1255 -<span id="L428" rel="#L428">428</span>
  2.1256 -<span id="L429" rel="#L429">429</span>
  2.1257 -<span id="L430" rel="#L430">430</span>
  2.1258 -<span id="L431" rel="#L431">431</span>
  2.1259 -<span id="L432" rel="#L432">432</span>
  2.1260 -<span id="L433" rel="#L433">433</span>
  2.1261 -<span id="L434" rel="#L434">434</span>
  2.1262 -<span id="L435" rel="#L435">435</span>
  2.1263 -<span id="L436" rel="#L436">436</span>
  2.1264 -<span id="L437" rel="#L437">437</span>
  2.1265 -<span id="L438" rel="#L438">438</span>
  2.1266 -<span id="L439" rel="#L439">439</span>
  2.1267 -<span id="L440" rel="#L440">440</span>
  2.1268 -<span id="L441" rel="#L441">441</span>
  2.1269 -<span id="L442" rel="#L442">442</span>
  2.1270 -<span id="L443" rel="#L443">443</span>
  2.1271 -<span id="L444" rel="#L444">444</span>
  2.1272 -<span id="L445" rel="#L445">445</span>
  2.1273 -<span id="L446" rel="#L446">446</span>
  2.1274 -<span id="L447" rel="#L447">447</span>
  2.1275 -<span id="L448" rel="#L448">448</span>
  2.1276 -<span id="L449" rel="#L449">449</span>
  2.1277 -<span id="L450" rel="#L450">450</span>
  2.1278 -<span id="L451" rel="#L451">451</span>
  2.1279 -<span id="L452" rel="#L452">452</span>
  2.1280 -<span id="L453" rel="#L453">453</span>
  2.1281 -<span id="L454" rel="#L454">454</span>
  2.1282 -<span id="L455" rel="#L455">455</span>
  2.1283 -<span id="L456" rel="#L456">456</span>
  2.1284 -<span id="L457" rel="#L457">457</span>
  2.1285 -<span id="L458" rel="#L458">458</span>
  2.1286 -<span id="L459" rel="#L459">459</span>
  2.1287 -<span id="L460" rel="#L460">460</span>
  2.1288 -<span id="L461" rel="#L461">461</span>
  2.1289 -<span id="L462" rel="#L462">462</span>
  2.1290 -<span id="L463" rel="#L463">463</span>
  2.1291 -<span id="L464" rel="#L464">464</span>
  2.1292 -<span id="L465" rel="#L465">465</span>
  2.1293 -<span id="L466" rel="#L466">466</span>
  2.1294 -<span id="L467" rel="#L467">467</span>
  2.1295 -<span id="L468" rel="#L468">468</span>
  2.1296 -<span id="L469" rel="#L469">469</span>
  2.1297 -<span id="L470" rel="#L470">470</span>
  2.1298 -<span id="L471" rel="#L471">471</span>
  2.1299 -<span id="L472" rel="#L472">472</span>
  2.1300 -<span id="L473" rel="#L473">473</span>
  2.1301 -<span id="L474" rel="#L474">474</span>
  2.1302 -<span id="L475" rel="#L475">475</span>
  2.1303 -<span id="L476" rel="#L476">476</span>
  2.1304 -<span id="L477" rel="#L477">477</span>
  2.1305 -<span id="L478" rel="#L478">478</span>
  2.1306 -<span id="L479" rel="#L479">479</span>
  2.1307 -<span id="L480" rel="#L480">480</span>
  2.1308 -<span id="L481" rel="#L481">481</span>
  2.1309 -<span id="L482" rel="#L482">482</span>
  2.1310 -<span id="L483" rel="#L483">483</span>
  2.1311 -<span id="L484" rel="#L484">484</span>
  2.1312 -<span id="L485" rel="#L485">485</span>
  2.1313 -<span id="L486" rel="#L486">486</span>
  2.1314 -<span id="L487" rel="#L487">487</span>
  2.1315 -<span id="L488" rel="#L488">488</span>
  2.1316 -<span id="L489" rel="#L489">489</span>
  2.1317 -<span id="L490" rel="#L490">490</span>
  2.1318 -<span id="L491" rel="#L491">491</span>
  2.1319 -<span id="L492" rel="#L492">492</span>
  2.1320 -<span id="L493" rel="#L493">493</span>
  2.1321 -<span id="L494" rel="#L494">494</span>
  2.1322 -<span id="L495" rel="#L495">495</span>
  2.1323 -<span id="L496" rel="#L496">496</span>
  2.1324 -<span id="L497" rel="#L497">497</span>
  2.1325 -<span id="L498" rel="#L498">498</span>
  2.1326 -<span id="L499" rel="#L499">499</span>
  2.1327 -<span id="L500" rel="#L500">500</span>
  2.1328 -<span id="L501" rel="#L501">501</span>
  2.1329 -<span id="L502" rel="#L502">502</span>
  2.1330 -<span id="L503" rel="#L503">503</span>
  2.1331 -<span id="L504" rel="#L504">504</span>
  2.1332 -<span id="L505" rel="#L505">505</span>
  2.1333 -<span id="L506" rel="#L506">506</span>
  2.1334 -<span id="L507" rel="#L507">507</span>
  2.1335 -<span id="L508" rel="#L508">508</span>
  2.1336 -<span id="L509" rel="#L509">509</span>
  2.1337 -<span id="L510" rel="#L510">510</span>
  2.1338 -<span id="L511" rel="#L511">511</span>
  2.1339 -<span id="L512" rel="#L512">512</span>
  2.1340 -<span id="L513" rel="#L513">513</span>
  2.1341 -<span id="L514" rel="#L514">514</span>
  2.1342 -<span id="L515" rel="#L515">515</span>
  2.1343 -<span id="L516" rel="#L516">516</span>
  2.1344 -<span id="L517" rel="#L517">517</span>
  2.1345 -<span id="L518" rel="#L518">518</span>
  2.1346 -<span id="L519" rel="#L519">519</span>
  2.1347 -<span id="L520" rel="#L520">520</span>
  2.1348 -<span id="L521" rel="#L521">521</span>
  2.1349 -<span id="L522" rel="#L522">522</span>
  2.1350 -<span id="L523" rel="#L523">523</span>
  2.1351 -<span id="L524" rel="#L524">524</span>
  2.1352 -<span id="L525" rel="#L525">525</span>
  2.1353 -<span id="L526" rel="#L526">526</span>
  2.1354 -<span id="L527" rel="#L527">527</span>
  2.1355 -<span id="L528" rel="#L528">528</span>
  2.1356 -<span id="L529" rel="#L529">529</span>
  2.1357 -<span id="L530" rel="#L530">530</span>
  2.1358 -<span id="L531" rel="#L531">531</span>
  2.1359 -<span id="L532" rel="#L532">532</span>
  2.1360 -<span id="L533" rel="#L533">533</span>
  2.1361 -<span id="L534" rel="#L534">534</span>
  2.1362 -<span id="L535" rel="#L535">535</span>
  2.1363 -<span id="L536" rel="#L536">536</span>
  2.1364 -<span id="L537" rel="#L537">537</span>
  2.1365 -<span id="L538" rel="#L538">538</span>
  2.1366 -<span id="L539" rel="#L539">539</span>
  2.1367 -<span id="L540" rel="#L540">540</span>
  2.1368 -<span id="L541" rel="#L541">541</span>
  2.1369 -<span id="L542" rel="#L542">542</span>
  2.1370 -<span id="L543" rel="#L543">543</span>
  2.1371 -<span id="L544" rel="#L544">544</span>
  2.1372 -<span id="L545" rel="#L545">545</span>
  2.1373 -<span id="L546" rel="#L546">546</span>
  2.1374 -<span id="L547" rel="#L547">547</span>
  2.1375 -<span id="L548" rel="#L548">548</span>
  2.1376 -<span id="L549" rel="#L549">549</span>
  2.1377 -<span id="L550" rel="#L550">550</span>
  2.1378 -<span id="L551" rel="#L551">551</span>
  2.1379 -<span id="L552" rel="#L552">552</span>
  2.1380 -<span id="L553" rel="#L553">553</span>
  2.1381 -<span id="L554" rel="#L554">554</span>
  2.1382 -<span id="L555" rel="#L555">555</span>
  2.1383 -<span id="L556" rel="#L556">556</span>
  2.1384 -<span id="L557" rel="#L557">557</span>
  2.1385 -<span id="L558" rel="#L558">558</span>
  2.1386 -<span id="L559" rel="#L559">559</span>
  2.1387 -<span id="L560" rel="#L560">560</span>
  2.1388 -<span id="L561" rel="#L561">561</span>
  2.1389 -<span id="L562" rel="#L562">562</span>
  2.1390 -<span id="L563" rel="#L563">563</span>
  2.1391 -<span id="L564" rel="#L564">564</span>
  2.1392 -<span id="L565" rel="#L565">565</span>
  2.1393 -<span id="L566" rel="#L566">566</span>
  2.1394 -<span id="L567" rel="#L567">567</span>
  2.1395 -<span id="L568" rel="#L568">568</span>
  2.1396 -<span id="L569" rel="#L569">569</span>
  2.1397 -<span id="L570" rel="#L570">570</span>
  2.1398 -<span id="L571" rel="#L571">571</span>
  2.1399 -<span id="L572" rel="#L572">572</span>
  2.1400 -<span id="L573" rel="#L573">573</span>
  2.1401 -<span id="L574" rel="#L574">574</span>
  2.1402 -<span id="L575" rel="#L575">575</span>
  2.1403 -<span id="L576" rel="#L576">576</span>
  2.1404 -<span id="L577" rel="#L577">577</span>
  2.1405 -<span id="L578" rel="#L578">578</span>
  2.1406 -<span id="L579" rel="#L579">579</span>
  2.1407 -<span id="L580" rel="#L580">580</span>
  2.1408 -<span id="L581" rel="#L581">581</span>
  2.1409 -<span id="L582" rel="#L582">582</span>
  2.1410 -<span id="L583" rel="#L583">583</span>
  2.1411 -<span id="L584" rel="#L584">584</span>
  2.1412 -<span id="L585" rel="#L585">585</span>
  2.1413 -<span id="L586" rel="#L586">586</span>
  2.1414 -<span id="L587" rel="#L587">587</span>
  2.1415 -<span id="L588" rel="#L588">588</span>
  2.1416 -<span id="L589" rel="#L589">589</span>
  2.1417 -<span id="L590" rel="#L590">590</span>
  2.1418 -<span id="L591" rel="#L591">591</span>
  2.1419 -<span id="L592" rel="#L592">592</span>
  2.1420 -<span id="L593" rel="#L593">593</span>
  2.1421 -<span id="L594" rel="#L594">594</span>
  2.1422 -<span id="L595" rel="#L595">595</span>
  2.1423 -<span id="L596" rel="#L596">596</span>
  2.1424 -<span id="L597" rel="#L597">597</span>
  2.1425 -<span id="L598" rel="#L598">598</span>
  2.1426 -<span id="L599" rel="#L599">599</span>
  2.1427 -<span id="L600" rel="#L600">600</span>
  2.1428 -<span id="L601" rel="#L601">601</span>
  2.1429 -<span id="L602" rel="#L602">602</span>
  2.1430 -<span id="L603" rel="#L603">603</span>
  2.1431 -<span id="L604" rel="#L604">604</span>
  2.1432 -<span id="L605" rel="#L605">605</span>
  2.1433 -<span id="L606" rel="#L606">606</span>
  2.1434 -<span id="L607" rel="#L607">607</span>
  2.1435 -<span id="L608" rel="#L608">608</span>
  2.1436 -<span id="L609" rel="#L609">609</span>
  2.1437 -<span id="L610" rel="#L610">610</span>
  2.1438 -<span id="L611" rel="#L611">611</span>
  2.1439 -<span id="L612" rel="#L612">612</span>
  2.1440 -<span id="L613" rel="#L613">613</span>
  2.1441 -<span id="L614" rel="#L614">614</span>
  2.1442 -<span id="L615" rel="#L615">615</span>
  2.1443 -<span id="L616" rel="#L616">616</span>
  2.1444 -<span id="L617" rel="#L617">617</span>
  2.1445 -<span id="L618" rel="#L618">618</span>
  2.1446 -<span id="L619" rel="#L619">619</span>
  2.1447 -<span id="L620" rel="#L620">620</span>
  2.1448 -<span id="L621" rel="#L621">621</span>
  2.1449 -<span id="L622" rel="#L622">622</span>
  2.1450 -<span id="L623" rel="#L623">623</span>
  2.1451 -<span id="L624" rel="#L624">624</span>
  2.1452 -<span id="L625" rel="#L625">625</span>
  2.1453 -<span id="L626" rel="#L626">626</span>
  2.1454 -<span id="L627" rel="#L627">627</span>
  2.1455 -<span id="L628" rel="#L628">628</span>
  2.1456 -<span id="L629" rel="#L629">629</span>
  2.1457 -<span id="L630" rel="#L630">630</span>
  2.1458 -<span id="L631" rel="#L631">631</span>
  2.1459 -<span id="L632" rel="#L632">632</span>
  2.1460 -<span id="L633" rel="#L633">633</span>
  2.1461 -<span id="L634" rel="#L634">634</span>
  2.1462 -<span id="L635" rel="#L635">635</span>
  2.1463 -<span id="L636" rel="#L636">636</span>
  2.1464 -<span id="L637" rel="#L637">637</span>
  2.1465 -<span id="L638" rel="#L638">638</span>
  2.1466 -<span id="L639" rel="#L639">639</span>
  2.1467 -<span id="L640" rel="#L640">640</span>
  2.1468 -<span id="L641" rel="#L641">641</span>
  2.1469 -<span id="L642" rel="#L642">642</span>
  2.1470 -<span id="L643" rel="#L643">643</span>
  2.1471 -<span id="L644" rel="#L644">644</span>
  2.1472 -<span id="L645" rel="#L645">645</span>
  2.1473 -<span id="L646" rel="#L646">646</span>
  2.1474 -<span id="L647" rel="#L647">647</span>
  2.1475 -<span id="L648" rel="#L648">648</span>
  2.1476 -<span id="L649" rel="#L649">649</span>
  2.1477 -<span id="L650" rel="#L650">650</span>
  2.1478 -<span id="L651" rel="#L651">651</span>
  2.1479 -<span id="L652" rel="#L652">652</span>
  2.1480 -<span id="L653" rel="#L653">653</span>
  2.1481 -<span id="L654" rel="#L654">654</span>
  2.1482 -<span id="L655" rel="#L655">655</span>
  2.1483 -<span id="L656" rel="#L656">656</span>
  2.1484 -<span id="L657" rel="#L657">657</span>
  2.1485 -<span id="L658" rel="#L658">658</span>
  2.1486 -<span id="L659" rel="#L659">659</span>
  2.1487 -<span id="L660" rel="#L660">660</span>
  2.1488 -<span id="L661" rel="#L661">661</span>
  2.1489 -<span id="L662" rel="#L662">662</span>
  2.1490 -<span id="L663" rel="#L663">663</span>
  2.1491 -<span id="L664" rel="#L664">664</span>
  2.1492 -<span id="L665" rel="#L665">665</span>
  2.1493 -<span id="L666" rel="#L666">666</span>
  2.1494 -<span id="L667" rel="#L667">667</span>
  2.1495 -<span id="L668" rel="#L668">668</span>
  2.1496 -<span id="L669" rel="#L669">669</span>
  2.1497 -<span id="L670" rel="#L670">670</span>
  2.1498 -<span id="L671" rel="#L671">671</span>
  2.1499 -<span id="L672" rel="#L672">672</span>
  2.1500 -<span id="L673" rel="#L673">673</span>
  2.1501 -<span id="L674" rel="#L674">674</span>
  2.1502 -<span id="L675" rel="#L675">675</span>
  2.1503 -<span id="L676" rel="#L676">676</span>
  2.1504 -<span id="L677" rel="#L677">677</span>
  2.1505 -<span id="L678" rel="#L678">678</span>
  2.1506 -<span id="L679" rel="#L679">679</span>
  2.1507 -<span id="L680" rel="#L680">680</span>
  2.1508 -<span id="L681" rel="#L681">681</span>
  2.1509 -<span id="L682" rel="#L682">682</span>
  2.1510 -<span id="L683" rel="#L683">683</span>
  2.1511 -<span id="L684" rel="#L684">684</span>
  2.1512 -<span id="L685" rel="#L685">685</span>
  2.1513 -<span id="L686" rel="#L686">686</span>
  2.1514 -<span id="L687" rel="#L687">687</span>
  2.1515 -<span id="L688" rel="#L688">688</span>
  2.1516 -<span id="L689" rel="#L689">689</span>
  2.1517 -<span id="L690" rel="#L690">690</span>
  2.1518 -<span id="L691" rel="#L691">691</span>
  2.1519 -<span id="L692" rel="#L692">692</span>
  2.1520 -<span id="L693" rel="#L693">693</span>
  2.1521 -<span id="L694" rel="#L694">694</span>
  2.1522 -<span id="L695" rel="#L695">695</span>
  2.1523 -<span id="L696" rel="#L696">696</span>
  2.1524 -<span id="L697" rel="#L697">697</span>
  2.1525 -<span id="L698" rel="#L698">698</span>
  2.1526 -<span id="L699" rel="#L699">699</span>
  2.1527 -<span id="L700" rel="#L700">700</span>
  2.1528 -<span id="L701" rel="#L701">701</span>
  2.1529 -<span id="L702" rel="#L702">702</span>
  2.1530 -<span id="L703" rel="#L703">703</span>
  2.1531 -<span id="L704" rel="#L704">704</span>
  2.1532 -<span id="L705" rel="#L705">705</span>
  2.1533 -<span id="L706" rel="#L706">706</span>
  2.1534 -<span id="L707" rel="#L707">707</span>
  2.1535 -<span id="L708" rel="#L708">708</span>
  2.1536 -<span id="L709" rel="#L709">709</span>
  2.1537 -<span id="L710" rel="#L710">710</span>
  2.1538 -<span id="L711" rel="#L711">711</span>
  2.1539 -<span id="L712" rel="#L712">712</span>
  2.1540 -<span id="L713" rel="#L713">713</span>
  2.1541 -<span id="L714" rel="#L714">714</span>
  2.1542 -<span id="L715" rel="#L715">715</span>
  2.1543 -<span id="L716" rel="#L716">716</span>
  2.1544 -<span id="L717" rel="#L717">717</span>
  2.1545 -<span id="L718" rel="#L718">718</span>
  2.1546 -<span id="L719" rel="#L719">719</span>
  2.1547 -<span id="L720" rel="#L720">720</span>
  2.1548 -<span id="L721" rel="#L721">721</span>
  2.1549 -<span id="L722" rel="#L722">722</span>
  2.1550 -<span id="L723" rel="#L723">723</span>
  2.1551 -<span id="L724" rel="#L724">724</span>
  2.1552 -<span id="L725" rel="#L725">725</span>
  2.1553 -<span id="L726" rel="#L726">726</span>
  2.1554 -<span id="L727" rel="#L727">727</span>
  2.1555 -<span id="L728" rel="#L728">728</span>
  2.1556 -<span id="L729" rel="#L729">729</span>
  2.1557 -<span id="L730" rel="#L730">730</span>
  2.1558 -<span id="L731" rel="#L731">731</span>
  2.1559 -<span id="L732" rel="#L732">732</span>
  2.1560 -<span id="L733" rel="#L733">733</span>
  2.1561 -<span id="L734" rel="#L734">734</span>
  2.1562 -<span id="L735" rel="#L735">735</span>
  2.1563 -<span id="L736" rel="#L736">736</span>
  2.1564 -<span id="L737" rel="#L737">737</span>
  2.1565 -<span id="L738" rel="#L738">738</span>
  2.1566 -<span id="L739" rel="#L739">739</span>
  2.1567 -<span id="L740" rel="#L740">740</span>
  2.1568 -<span id="L741" rel="#L741">741</span>
  2.1569 -<span id="L742" rel="#L742">742</span>
  2.1570 -<span id="L743" rel="#L743">743</span>
  2.1571 -<span id="L744" rel="#L744">744</span>
  2.1572 -<span id="L745" rel="#L745">745</span>
  2.1573 -<span id="L746" rel="#L746">746</span>
  2.1574 -<span id="L747" rel="#L747">747</span>
  2.1575 -<span id="L748" rel="#L748">748</span>
  2.1576 -<span id="L749" rel="#L749">749</span>
  2.1577 -<span id="L750" rel="#L750">750</span>
  2.1578 -<span id="L751" rel="#L751">751</span>
  2.1579 -<span id="L752" rel="#L752">752</span>
  2.1580 -<span id="L753" rel="#L753">753</span>
  2.1581 -<span id="L754" rel="#L754">754</span>
  2.1582 -<span id="L755" rel="#L755">755</span>
  2.1583 -<span id="L756" rel="#L756">756</span>
  2.1584 -<span id="L757" rel="#L757">757</span>
  2.1585 -<span id="L758" rel="#L758">758</span>
  2.1586 -<span id="L759" rel="#L759">759</span>
  2.1587 -<span id="L760" rel="#L760">760</span>
  2.1588 -<span id="L761" rel="#L761">761</span>
  2.1589 -<span id="L762" rel="#L762">762</span>
  2.1590 -<span id="L763" rel="#L763">763</span>
  2.1591 -<span id="L764" rel="#L764">764</span>
  2.1592 -<span id="L765" rel="#L765">765</span>
  2.1593 -<span id="L766" rel="#L766">766</span>
  2.1594 -<span id="L767" rel="#L767">767</span>
  2.1595 -<span id="L768" rel="#L768">768</span>
  2.1596 -<span id="L769" rel="#L769">769</span>
  2.1597 -<span id="L770" rel="#L770">770</span>
  2.1598 -<span id="L771" rel="#L771">771</span>
  2.1599 -<span id="L772" rel="#L772">772</span>
  2.1600 -<span id="L773" rel="#L773">773</span>
  2.1601 -<span id="L774" rel="#L774">774</span>
  2.1602 -<span id="L775" rel="#L775">775</span>
  2.1603 -<span id="L776" rel="#L776">776</span>
  2.1604 -<span id="L777" rel="#L777">777</span>
  2.1605 -<span id="L778" rel="#L778">778</span>
  2.1606 -<span id="L779" rel="#L779">779</span>
  2.1607 -<span id="L780" rel="#L780">780</span>
  2.1608 -<span id="L781" rel="#L781">781</span>
  2.1609 -<span id="L782" rel="#L782">782</span>
  2.1610 -<span id="L783" rel="#L783">783</span>
  2.1611 -<span id="L784" rel="#L784">784</span>
  2.1612 -<span id="L785" rel="#L785">785</span>
  2.1613 -<span id="L786" rel="#L786">786</span>
  2.1614 -<span id="L787" rel="#L787">787</span>
  2.1615 -<span id="L788" rel="#L788">788</span>
  2.1616 -<span id="L789" rel="#L789">789</span>
  2.1617 -<span id="L790" rel="#L790">790</span>
  2.1618 -<span id="L791" rel="#L791">791</span>
  2.1619 -<span id="L792" rel="#L792">792</span>
  2.1620 -<span id="L793" rel="#L793">793</span>
  2.1621 -<span id="L794" rel="#L794">794</span>
  2.1622 -<span id="L795" rel="#L795">795</span>
  2.1623 -<span id="L796" rel="#L796">796</span>
  2.1624 -<span id="L797" rel="#L797">797</span>
  2.1625 -<span id="L798" rel="#L798">798</span>
  2.1626 -<span id="L799" rel="#L799">799</span>
  2.1627 -<span id="L800" rel="#L800">800</span>
  2.1628 -<span id="L801" rel="#L801">801</span>
  2.1629 -<span id="L802" rel="#L802">802</span>
  2.1630 -<span id="L803" rel="#L803">803</span>
  2.1631 -<span id="L804" rel="#L804">804</span>
  2.1632 -<span id="L805" rel="#L805">805</span>
  2.1633 -<span id="L806" rel="#L806">806</span>
  2.1634 -<span id="L807" rel="#L807">807</span>
  2.1635 -<span id="L808" rel="#L808">808</span>
  2.1636 -<span id="L809" rel="#L809">809</span>
  2.1637 -<span id="L810" rel="#L810">810</span>
  2.1638 -<span id="L811" rel="#L811">811</span>
  2.1639 -<span id="L812" rel="#L812">812</span>
  2.1640 -<span id="L813" rel="#L813">813</span>
  2.1641 -<span id="L814" rel="#L814">814</span>
  2.1642 -<span id="L815" rel="#L815">815</span>
  2.1643 -<span id="L816" rel="#L816">816</span>
  2.1644 -<span id="L817" rel="#L817">817</span>
  2.1645 -<span id="L818" rel="#L818">818</span>
  2.1646 -<span id="L819" rel="#L819">819</span>
  2.1647 -<span id="L820" rel="#L820">820</span>
  2.1648 -<span id="L821" rel="#L821">821</span>
  2.1649 -<span id="L822" rel="#L822">822</span>
  2.1650 -<span id="L823" rel="#L823">823</span>
  2.1651 -<span id="L824" rel="#L824">824</span>
  2.1652 -<span id="L825" rel="#L825">825</span>
  2.1653 -<span id="L826" rel="#L826">826</span>
  2.1654 -<span id="L827" rel="#L827">827</span>
  2.1655 -<span id="L828" rel="#L828">828</span>
  2.1656 -<span id="L829" rel="#L829">829</span>
  2.1657 -<span id="L830" rel="#L830">830</span>
  2.1658 -<span id="L831" rel="#L831">831</span>
  2.1659 -<span id="L832" rel="#L832">832</span>
  2.1660 -<span id="L833" rel="#L833">833</span>
  2.1661 -<span id="L834" rel="#L834">834</span>
  2.1662 -<span id="L835" rel="#L835">835</span>
  2.1663 -<span id="L836" rel="#L836">836</span>
  2.1664 -<span id="L837" rel="#L837">837</span>
  2.1665 -<span id="L838" rel="#L838">838</span>
  2.1666 -<span id="L839" rel="#L839">839</span>
  2.1667 -<span id="L840" rel="#L840">840</span>
  2.1668 -<span id="L841" rel="#L841">841</span>
  2.1669 -<span id="L842" rel="#L842">842</span>
  2.1670 -<span id="L843" rel="#L843">843</span>
  2.1671 -<span id="L844" rel="#L844">844</span>
  2.1672 -<span id="L845" rel="#L845">845</span>
  2.1673 -<span id="L846" rel="#L846">846</span>
  2.1674 -<span id="L847" rel="#L847">847</span>
  2.1675 -<span id="L848" rel="#L848">848</span>
  2.1676 -<span id="L849" rel="#L849">849</span>
  2.1677 -<span id="L850" rel="#L850">850</span>
  2.1678 -<span id="L851" rel="#L851">851</span>
  2.1679 -<span id="L852" rel="#L852">852</span>
  2.1680 -<span id="L853" rel="#L853">853</span>
  2.1681 -<span id="L854" rel="#L854">854</span>
  2.1682 -<span id="L855" rel="#L855">855</span>
  2.1683 -<span id="L856" rel="#L856">856</span>
  2.1684 -<span id="L857" rel="#L857">857</span>
  2.1685 -<span id="L858" rel="#L858">858</span>
  2.1686 -<span id="L859" rel="#L859">859</span>
  2.1687 -<span id="L860" rel="#L860">860</span>
  2.1688 -<span id="L861" rel="#L861">861</span>
  2.1689 -<span id="L862" rel="#L862">862</span>
  2.1690 -<span id="L863" rel="#L863">863</span>
  2.1691 -<span id="L864" rel="#L864">864</span>
  2.1692 -<span id="L865" rel="#L865">865</span>
  2.1693 -<span id="L866" rel="#L866">866</span>
  2.1694 -<span id="L867" rel="#L867">867</span>
  2.1695 -<span id="L868" rel="#L868">868</span>
  2.1696 -<span id="L869" rel="#L869">869</span>
  2.1697 -<span id="L870" rel="#L870">870</span>
  2.1698 -<span id="L871" rel="#L871">871</span>
  2.1699 -<span id="L872" rel="#L872">872</span>
  2.1700 -<span id="L873" rel="#L873">873</span>
  2.1701 -<span id="L874" rel="#L874">874</span>
  2.1702 -<span id="L875" rel="#L875">875</span>
  2.1703 -<span id="L876" rel="#L876">876</span>
  2.1704 -<span id="L877" rel="#L877">877</span>
  2.1705 -<span id="L878" rel="#L878">878</span>
  2.1706 -<span id="L879" rel="#L879">879</span>
  2.1707 -<span id="L880" rel="#L880">880</span>
  2.1708 -<span id="L881" rel="#L881">881</span>
  2.1709 -<span id="L882" rel="#L882">882</span>
  2.1710 -<span id="L883" rel="#L883">883</span>
  2.1711 -<span id="L884" rel="#L884">884</span>
  2.1712 -<span id="L885" rel="#L885">885</span>
  2.1713 -<span id="L886" rel="#L886">886</span>
  2.1714 -<span id="L887" rel="#L887">887</span>
  2.1715 -<span id="L888" rel="#L888">888</span>
  2.1716 -<span id="L889" rel="#L889">889</span>
  2.1717 -<span id="L890" rel="#L890">890</span>
  2.1718 -<span id="L891" rel="#L891">891</span>
  2.1719 -<span id="L892" rel="#L892">892</span>
  2.1720 -<span id="L893" rel="#L893">893</span>
  2.1721 -<span id="L894" rel="#L894">894</span>
  2.1722 -<span id="L895" rel="#L895">895</span>
  2.1723 -<span id="L896" rel="#L896">896</span>
  2.1724 -<span id="L897" rel="#L897">897</span>
  2.1725 -<span id="L898" rel="#L898">898</span>
  2.1726 -<span id="L899" rel="#L899">899</span>
  2.1727 -<span id="L900" rel="#L900">900</span>
  2.1728 -<span id="L901" rel="#L901">901</span>
  2.1729 -<span id="L902" rel="#L902">902</span>
  2.1730 -<span id="L903" rel="#L903">903</span>
  2.1731 -<span id="L904" rel="#L904">904</span>
  2.1732 -<span id="L905" rel="#L905">905</span>
  2.1733 -<span id="L906" rel="#L906">906</span>
  2.1734 -<span id="L907" rel="#L907">907</span>
  2.1735 -<span id="L908" rel="#L908">908</span>
  2.1736 -<span id="L909" rel="#L909">909</span>
  2.1737 -<span id="L910" rel="#L910">910</span>
  2.1738 -<span id="L911" rel="#L911">911</span>
  2.1739 -<span id="L912" rel="#L912">912</span>
  2.1740 -<span id="L913" rel="#L913">913</span>
  2.1741 -<span id="L914" rel="#L914">914</span>
  2.1742 -<span id="L915" rel="#L915">915</span>
  2.1743 -<span id="L916" rel="#L916">916</span>
  2.1744 -<span id="L917" rel="#L917">917</span>
  2.1745 -<span id="L918" rel="#L918">918</span>
  2.1746 -<span id="L919" rel="#L919">919</span>
  2.1747 -<span id="L920" rel="#L920">920</span>
  2.1748 -<span id="L921" rel="#L921">921</span>
  2.1749 -<span id="L922" rel="#L922">922</span>
  2.1750 -<span id="L923" rel="#L923">923</span>
  2.1751 -<span id="L924" rel="#L924">924</span>
  2.1752 -<span id="L925" rel="#L925">925</span>
  2.1753 -<span id="L926" rel="#L926">926</span>
  2.1754 -<span id="L927" rel="#L927">927</span>
  2.1755 -<span id="L928" rel="#L928">928</span>
  2.1756 -<span id="L929" rel="#L929">929</span>
  2.1757 -<span id="L930" rel="#L930">930</span>
  2.1758 -<span id="L931" rel="#L931">931</span>
  2.1759 -<span id="L932" rel="#L932">932</span>
  2.1760 -<span id="L933" rel="#L933">933</span>
  2.1761 -<span id="L934" rel="#L934">934</span>
  2.1762 -<span id="L935" rel="#L935">935</span>
  2.1763 -<span id="L936" rel="#L936">936</span>
  2.1764 -<span id="L937" rel="#L937">937</span>
  2.1765 -<span id="L938" rel="#L938">938</span>
  2.1766 -<span id="L939" rel="#L939">939</span>
  2.1767 -<span id="L940" rel="#L940">940</span>
  2.1768 -<span id="L941" rel="#L941">941</span>
  2.1769 -<span id="L942" rel="#L942">942</span>
  2.1770 -<span id="L943" rel="#L943">943</span>
  2.1771 -<span id="L944" rel="#L944">944</span>
  2.1772 -<span id="L945" rel="#L945">945</span>
  2.1773 -<span id="L946" rel="#L946">946</span>
  2.1774 -<span id="L947" rel="#L947">947</span>
  2.1775 -<span id="L948" rel="#L948">948</span>
  2.1776 -<span id="L949" rel="#L949">949</span>
  2.1777 -<span id="L950" rel="#L950">950</span>
  2.1778 -<span id="L951" rel="#L951">951</span>
  2.1779 -<span id="L952" rel="#L952">952</span>
  2.1780 -<span id="L953" rel="#L953">953</span>
  2.1781 -<span id="L954" rel="#L954">954</span>
  2.1782 -<span id="L955" rel="#L955">955</span>
  2.1783 -<span id="L956" rel="#L956">956</span>
  2.1784 -<span id="L957" rel="#L957">957</span>
  2.1785 -<span id="L958" rel="#L958">958</span>
  2.1786 -<span id="L959" rel="#L959">959</span>
  2.1787 -<span id="L960" rel="#L960">960</span>
  2.1788 -<span id="L961" rel="#L961">961</span>
  2.1789 -<span id="L962" rel="#L962">962</span>
  2.1790 -<span id="L963" rel="#L963">963</span>
  2.1791 -<span id="L964" rel="#L964">964</span>
  2.1792 -<span id="L965" rel="#L965">965</span>
  2.1793 -<span id="L966" rel="#L966">966</span>
  2.1794 -<span id="L967" rel="#L967">967</span>
  2.1795 -<span id="L968" rel="#L968">968</span>
  2.1796 -<span id="L969" rel="#L969">969</span>
  2.1797 -<span id="L970" rel="#L970">970</span>
  2.1798 -<span id="L971" rel="#L971">971</span>
  2.1799 -<span id="L972" rel="#L972">972</span>
  2.1800 -<span id="L973" rel="#L973">973</span>
  2.1801 -<span id="L974" rel="#L974">974</span>
  2.1802 -<span id="L975" rel="#L975">975</span>
  2.1803 -<span id="L976" rel="#L976">976</span>
  2.1804 -<span id="L977" rel="#L977">977</span>
  2.1805 -<span id="L978" rel="#L978">978</span>
  2.1806 -<span id="L979" rel="#L979">979</span>
  2.1807 -<span id="L980" rel="#L980">980</span>
  2.1808 -<span id="L981" rel="#L981">981</span>
  2.1809 -<span id="L982" rel="#L982">982</span>
  2.1810 -<span id="L983" rel="#L983">983</span>
  2.1811 -<span id="L984" rel="#L984">984</span>
  2.1812 -<span id="L985" rel="#L985">985</span>
  2.1813 -<span id="L986" rel="#L986">986</span>
  2.1814 -<span id="L987" rel="#L987">987</span>
  2.1815 -<span id="L988" rel="#L988">988</span>
  2.1816 -<span id="L989" rel="#L989">989</span>
  2.1817 -<span id="L990" rel="#L990">990</span>
  2.1818 -<span id="L991" rel="#L991">991</span>
  2.1819 -<span id="L992" rel="#L992">992</span>
  2.1820 -<span id="L993" rel="#L993">993</span>
  2.1821 -<span id="L994" rel="#L994">994</span>
  2.1822 -<span id="L995" rel="#L995">995</span>
  2.1823 -<span id="L996" rel="#L996">996</span>
  2.1824 -<span id="L997" rel="#L997">997</span>
  2.1825 -<span id="L998" rel="#L998">998</span>
  2.1826 -<span id="L999" rel="#L999">999</span>
  2.1827 -<span id="L1000" rel="#L1000">1000</span>
  2.1828 -<span id="L1001" rel="#L1001">1001</span>
  2.1829 -<span id="L1002" rel="#L1002">1002</span>
  2.1830 -<span id="L1003" rel="#L1003">1003</span>
  2.1831 -<span id="L1004" rel="#L1004">1004</span>
  2.1832 -<span id="L1005" rel="#L1005">1005</span>
  2.1833 -<span id="L1006" rel="#L1006">1006</span>
  2.1834 -<span id="L1007" rel="#L1007">1007</span>
  2.1835 -<span id="L1008" rel="#L1008">1008</span>
  2.1836 -<span id="L1009" rel="#L1009">1009</span>
  2.1837 -<span id="L1010" rel="#L1010">1010</span>
  2.1838 -<span id="L1011" rel="#L1011">1011</span>
  2.1839 -<span id="L1012" rel="#L1012">1012</span>
  2.1840 -<span id="L1013" rel="#L1013">1013</span>
  2.1841 -<span id="L1014" rel="#L1014">1014</span>
  2.1842 -<span id="L1015" rel="#L1015">1015</span>
  2.1843 -<span id="L1016" rel="#L1016">1016</span>
  2.1844 -<span id="L1017" rel="#L1017">1017</span>
  2.1845 -<span id="L1018" rel="#L1018">1018</span>
  2.1846 -<span id="L1019" rel="#L1019">1019</span>
  2.1847 -<span id="L1020" rel="#L1020">1020</span>
  2.1848 -<span id="L1021" rel="#L1021">1021</span>
  2.1849 -<span id="L1022" rel="#L1022">1022</span>
  2.1850 -<span id="L1023" rel="#L1023">1023</span>
  2.1851 -<span id="L1024" rel="#L1024">1024</span>
  2.1852 -<span id="L1025" rel="#L1025">1025</span>
  2.1853 -<span id="L1026" rel="#L1026">1026</span>
  2.1854 -<span id="L1027" rel="#L1027">1027</span>
  2.1855 -<span id="L1028" rel="#L1028">1028</span>
  2.1856 -<span id="L1029" rel="#L1029">1029</span>
  2.1857 -<span id="L1030" rel="#L1030">1030</span>
  2.1858 -<span id="L1031" rel="#L1031">1031</span>
  2.1859 -<span id="L1032" rel="#L1032">1032</span>
  2.1860 -<span id="L1033" rel="#L1033">1033</span>
  2.1861 -<span id="L1034" rel="#L1034">1034</span>
  2.1862 -<span id="L1035" rel="#L1035">1035</span>
  2.1863 -<span id="L1036" rel="#L1036">1036</span>
  2.1864 -<span id="L1037" rel="#L1037">1037</span>
  2.1865 -<span id="L1038" rel="#L1038">1038</span>
  2.1866 -<span id="L1039" rel="#L1039">1039</span>
  2.1867 -<span id="L1040" rel="#L1040">1040</span>
  2.1868 -<span id="L1041" rel="#L1041">1041</span>
  2.1869 -<span id="L1042" rel="#L1042">1042</span>
  2.1870 -<span id="L1043" rel="#L1043">1043</span>
  2.1871 -<span id="L1044" rel="#L1044">1044</span>
  2.1872 -<span id="L1045" rel="#L1045">1045</span>
  2.1873 -<span id="L1046" rel="#L1046">1046</span>
  2.1874 -<span id="L1047" rel="#L1047">1047</span>
  2.1875 -<span id="L1048" rel="#L1048">1048</span>
  2.1876 -<span id="L1049" rel="#L1049">1049</span>
  2.1877 -<span id="L1050" rel="#L1050">1050</span>
  2.1878 -<span id="L1051" rel="#L1051">1051</span>
  2.1879 -<span id="L1052" rel="#L1052">1052</span>
  2.1880 -<span id="L1053" rel="#L1053">1053</span>
  2.1881 -<span id="L1054" rel="#L1054">1054</span>
  2.1882 -<span id="L1055" rel="#L1055">1055</span>
  2.1883 -<span id="L1056" rel="#L1056">1056</span>
  2.1884 -<span id="L1057" rel="#L1057">1057</span>
  2.1885 -<span id="L1058" rel="#L1058">1058</span>
  2.1886 -<span id="L1059" rel="#L1059">1059</span>
  2.1887 -<span id="L1060" rel="#L1060">1060</span>
  2.1888 -<span id="L1061" rel="#L1061">1061</span>
  2.1889 -<span id="L1062" rel="#L1062">1062</span>
  2.1890 -<span id="L1063" rel="#L1063">1063</span>
  2.1891 -<span id="L1064" rel="#L1064">1064</span>
  2.1892 -<span id="L1065" rel="#L1065">1065</span>
  2.1893 -<span id="L1066" rel="#L1066">1066</span>
  2.1894 -<span id="L1067" rel="#L1067">1067</span>
  2.1895 -<span id="L1068" rel="#L1068">1068</span>
  2.1896 -<span id="L1069" rel="#L1069">1069</span>
  2.1897 -<span id="L1070" rel="#L1070">1070</span>
  2.1898 -<span id="L1071" rel="#L1071">1071</span>
  2.1899 -<span id="L1072" rel="#L1072">1072</span>
  2.1900 -<span id="L1073" rel="#L1073">1073</span>
  2.1901 -<span id="L1074" rel="#L1074">1074</span>
  2.1902 -<span id="L1075" rel="#L1075">1075</span>
  2.1903 -<span id="L1076" rel="#L1076">1076</span>
  2.1904 -<span id="L1077" rel="#L1077">1077</span>
  2.1905 -<span id="L1078" rel="#L1078">1078</span>
  2.1906 -<span id="L1079" rel="#L1079">1079</span>
  2.1907 -<span id="L1080" rel="#L1080">1080</span>
  2.1908 -<span id="L1081" rel="#L1081">1081</span>
  2.1909 -<span id="L1082" rel="#L1082">1082</span>
  2.1910 -<span id="L1083" rel="#L1083">1083</span>
  2.1911 -<span id="L1084" rel="#L1084">1084</span>
  2.1912 -<span id="L1085" rel="#L1085">1085</span>
  2.1913 -<span id="L1086" rel="#L1086">1086</span>
  2.1914 -<span id="L1087" rel="#L1087">1087</span>
  2.1915 -<span id="L1088" rel="#L1088">1088</span>
  2.1916 -<span id="L1089" rel="#L1089">1089</span>
  2.1917 -<span id="L1090" rel="#L1090">1090</span>
  2.1918 -<span id="L1091" rel="#L1091">1091</span>
  2.1919 -<span id="L1092" rel="#L1092">1092</span>
  2.1920 -<span id="L1093" rel="#L1093">1093</span>
  2.1921 -<span id="L1094" rel="#L1094">1094</span>
  2.1922 -<span id="L1095" rel="#L1095">1095</span>
  2.1923 -<span id="L1096" rel="#L1096">1096</span>
  2.1924 -<span id="L1097" rel="#L1097">1097</span>
  2.1925 -<span id="L1098" rel="#L1098">1098</span>
  2.1926 -<span id="L1099" rel="#L1099">1099</span>
  2.1927 -<span id="L1100" rel="#L1100">1100</span>
  2.1928 -<span id="L1101" rel="#L1101">1101</span>
  2.1929 -<span id="L1102" rel="#L1102">1102</span>
  2.1930 -<span id="L1103" rel="#L1103">1103</span>
  2.1931 -<span id="L1104" rel="#L1104">1104</span>
  2.1932 -<span id="L1105" rel="#L1105">1105</span>
  2.1933 -<span id="L1106" rel="#L1106">1106</span>
  2.1934 -<span id="L1107" rel="#L1107">1107</span>
  2.1935 -<span id="L1108" rel="#L1108">1108</span>
  2.1936 -<span id="L1109" rel="#L1109">1109</span>
  2.1937 -<span id="L1110" rel="#L1110">1110</span>
  2.1938 -<span id="L1111" rel="#L1111">1111</span>
  2.1939 -<span id="L1112" rel="#L1112">1112</span>
  2.1940 -<span id="L1113" rel="#L1113">1113</span>
  2.1941 -<span id="L1114" rel="#L1114">1114</span>
  2.1942 -<span id="L1115" rel="#L1115">1115</span>
  2.1943 -<span id="L1116" rel="#L1116">1116</span>
  2.1944 -<span id="L1117" rel="#L1117">1117</span>
  2.1945 -<span id="L1118" rel="#L1118">1118</span>
  2.1946 -<span id="L1119" rel="#L1119">1119</span>
  2.1947 -<span id="L1120" rel="#L1120">1120</span>
  2.1948 -<span id="L1121" rel="#L1121">1121</span>
  2.1949 -<span id="L1122" rel="#L1122">1122</span>
  2.1950 -<span id="L1123" rel="#L1123">1123</span>
  2.1951 -<span id="L1124" rel="#L1124">1124</span>
  2.1952 -<span id="L1125" rel="#L1125">1125</span>
  2.1953 -<span id="L1126" rel="#L1126">1126</span>
  2.1954 -<span id="L1127" rel="#L1127">1127</span>
  2.1955 -<span id="L1128" rel="#L1128">1128</span>
  2.1956 -<span id="L1129" rel="#L1129">1129</span>
  2.1957 -<span id="L1130" rel="#L1130">1130</span>
  2.1958 -<span id="L1131" rel="#L1131">1131</span>
  2.1959 -<span id="L1132" rel="#L1132">1132</span>
  2.1960 -<span id="L1133" rel="#L1133">1133</span>
  2.1961 -<span id="L1134" rel="#L1134">1134</span>
  2.1962 -<span id="L1135" rel="#L1135">1135</span>
  2.1963 -<span id="L1136" rel="#L1136">1136</span>
  2.1964 -<span id="L1137" rel="#L1137">1137</span>
  2.1965 -<span id="L1138" rel="#L1138">1138</span>
  2.1966 -<span id="L1139" rel="#L1139">1139</span>
  2.1967 -<span id="L1140" rel="#L1140">1140</span>
  2.1968 -<span id="L1141" rel="#L1141">1141</span>
  2.1969 -<span id="L1142" rel="#L1142">1142</span>
  2.1970 -<span id="L1143" rel="#L1143">1143</span>
  2.1971 -<span id="L1144" rel="#L1144">1144</span>
  2.1972 -<span id="L1145" rel="#L1145">1145</span>
  2.1973 -<span id="L1146" rel="#L1146">1146</span>
  2.1974 -<span id="L1147" rel="#L1147">1147</span>
  2.1975 -<span id="L1148" rel="#L1148">1148</span>
  2.1976 -<span id="L1149" rel="#L1149">1149</span>
  2.1977 -<span id="L1150" rel="#L1150">1150</span>
  2.1978 -<span id="L1151" rel="#L1151">1151</span>
  2.1979 -<span id="L1152" rel="#L1152">1152</span>
  2.1980 -<span id="L1153" rel="#L1153">1153</span>
  2.1981 -<span id="L1154" rel="#L1154">1154</span>
  2.1982 -<span id="L1155" rel="#L1155">1155</span>
  2.1983 -<span id="L1156" rel="#L1156">1156</span>
  2.1984 -<span id="L1157" rel="#L1157">1157</span>
  2.1985 -<span id="L1158" rel="#L1158">1158</span>
  2.1986 -<span id="L1159" rel="#L1159">1159</span>
  2.1987 -<span id="L1160" rel="#L1160">1160</span>
  2.1988 -<span id="L1161" rel="#L1161">1161</span>
  2.1989 -<span id="L1162" rel="#L1162">1162</span>
  2.1990 -<span id="L1163" rel="#L1163">1163</span>
  2.1991 -<span id="L1164" rel="#L1164">1164</span>
  2.1992 -<span id="L1165" rel="#L1165">1165</span>
  2.1993 -<span id="L1166" rel="#L1166">1166</span>
  2.1994 -<span id="L1167" rel="#L1167">1167</span>
  2.1995 -<span id="L1168" rel="#L1168">1168</span>
  2.1996 -<span id="L1169" rel="#L1169">1169</span>
  2.1997 -<span id="L1170" rel="#L1170">1170</span>
  2.1998 -<span id="L1171" rel="#L1171">1171</span>
  2.1999 -<span id="L1172" rel="#L1172">1172</span>
  2.2000 -<span id="L1173" rel="#L1173">1173</span>
  2.2001 -<span id="L1174" rel="#L1174">1174</span>
  2.2002 -<span id="L1175" rel="#L1175">1175</span>
  2.2003 -<span id="L1176" rel="#L1176">1176</span>
  2.2004 -<span id="L1177" rel="#L1177">1177</span>
  2.2005 -<span id="L1178" rel="#L1178">1178</span>
  2.2006 -<span id="L1179" rel="#L1179">1179</span>
  2.2007 -<span id="L1180" rel="#L1180">1180</span>
  2.2008 -<span id="L1181" rel="#L1181">1181</span>
  2.2009 -<span id="L1182" rel="#L1182">1182</span>
  2.2010 -<span id="L1183" rel="#L1183">1183</span>
  2.2011 -<span id="L1184" rel="#L1184">1184</span>
  2.2012 -<span id="L1185" rel="#L1185">1185</span>
  2.2013 -<span id="L1186" rel="#L1186">1186</span>
  2.2014 -<span id="L1187" rel="#L1187">1187</span>
  2.2015 -<span id="L1188" rel="#L1188">1188</span>
  2.2016 -<span id="L1189" rel="#L1189">1189</span>
  2.2017 -<span id="L1190" rel="#L1190">1190</span>
  2.2018 -<span id="L1191" rel="#L1191">1191</span>
  2.2019 -<span id="L1192" rel="#L1192">1192</span>
  2.2020 -<span id="L1193" rel="#L1193">1193</span>
  2.2021 -<span id="L1194" rel="#L1194">1194</span>
  2.2022 -<span id="L1195" rel="#L1195">1195</span>
  2.2023 -<span id="L1196" rel="#L1196">1196</span>
  2.2024 -<span id="L1197" rel="#L1197">1197</span>
  2.2025 -<span id="L1198" rel="#L1198">1198</span>
  2.2026 -<span id="L1199" rel="#L1199">1199</span>
  2.2027 -<span id="L1200" rel="#L1200">1200</span>
  2.2028 -<span id="L1201" rel="#L1201">1201</span>
  2.2029 -<span id="L1202" rel="#L1202">1202</span>
  2.2030 -<span id="L1203" rel="#L1203">1203</span>
  2.2031 -<span id="L1204" rel="#L1204">1204</span>
  2.2032 -<span id="L1205" rel="#L1205">1205</span>
  2.2033 -<span id="L1206" rel="#L1206">1206</span>
  2.2034 -<span id="L1207" rel="#L1207">1207</span>
  2.2035 -<span id="L1208" rel="#L1208">1208</span>
  2.2036 -<span id="L1209" rel="#L1209">1209</span>
  2.2037 -<span id="L1210" rel="#L1210">1210</span>
  2.2038 -<span id="L1211" rel="#L1211">1211</span>
  2.2039 -<span id="L1212" rel="#L1212">1212</span>
  2.2040 -<span id="L1213" rel="#L1213">1213</span>
  2.2041 -<span id="L1214" rel="#L1214">1214</span>
  2.2042 -<span id="L1215" rel="#L1215">1215</span>
  2.2043 -<span id="L1216" rel="#L1216">1216</span>
  2.2044 -<span id="L1217" rel="#L1217">1217</span>
  2.2045 -<span id="L1218" rel="#L1218">1218</span>
  2.2046 -<span id="L1219" rel="#L1219">1219</span>
  2.2047 -<span id="L1220" rel="#L1220">1220</span>
  2.2048 -<span id="L1221" rel="#L1221">1221</span>
  2.2049 -<span id="L1222" rel="#L1222">1222</span>
  2.2050 -<span id="L1223" rel="#L1223">1223</span>
  2.2051 -<span id="L1224" rel="#L1224">1224</span>
  2.2052 -<span id="L1225" rel="#L1225">1225</span>
  2.2053 -<span id="L1226" rel="#L1226">1226</span>
  2.2054 -<span id="L1227" rel="#L1227">1227</span>
  2.2055 -<span id="L1228" rel="#L1228">1228</span>
  2.2056 -<span id="L1229" rel="#L1229">1229</span>
  2.2057 -<span id="L1230" rel="#L1230">1230</span>
  2.2058 -<span id="L1231" rel="#L1231">1231</span>
  2.2059 -<span id="L1232" rel="#L1232">1232</span>
  2.2060 -<span id="L1233" rel="#L1233">1233</span>
  2.2061 -<span id="L1234" rel="#L1234">1234</span>
  2.2062 -<span id="L1235" rel="#L1235">1235</span>
  2.2063 -<span id="L1236" rel="#L1236">1236</span>
  2.2064 -<span id="L1237" rel="#L1237">1237</span>
  2.2065 -<span id="L1238" rel="#L1238">1238</span>
  2.2066 -<span id="L1239" rel="#L1239">1239</span>
  2.2067 -<span id="L1240" rel="#L1240">1240</span>
  2.2068 -<span id="L1241" rel="#L1241">1241</span>
  2.2069 -<span id="L1242" rel="#L1242">1242</span>
  2.2070 -<span id="L1243" rel="#L1243">1243</span>
  2.2071 -<span id="L1244" rel="#L1244">1244</span>
  2.2072 -<span id="L1245" rel="#L1245">1245</span>
  2.2073 -<span id="L1246" rel="#L1246">1246</span>
  2.2074 -<span id="L1247" rel="#L1247">1247</span>
  2.2075 -<span id="L1248" rel="#L1248">1248</span>
  2.2076 -<span id="L1249" rel="#L1249">1249</span>
  2.2077 -<span id="L1250" rel="#L1250">1250</span>
  2.2078 -<span id="L1251" rel="#L1251">1251</span>
  2.2079 -<span id="L1252" rel="#L1252">1252</span>
  2.2080 -<span id="L1253" rel="#L1253">1253</span>
  2.2081 -<span id="L1254" rel="#L1254">1254</span>
  2.2082 -<span id="L1255" rel="#L1255">1255</span>
  2.2083 -<span id="L1256" rel="#L1256">1256</span>
  2.2084 -<span id="L1257" rel="#L1257">1257</span>
  2.2085 -<span id="L1258" rel="#L1258">1258</span>
  2.2086 -<span id="L1259" rel="#L1259">1259</span>
  2.2087 -<span id="L1260" rel="#L1260">1260</span>
  2.2088 -<span id="L1261" rel="#L1261">1261</span>
  2.2089 -<span id="L1262" rel="#L1262">1262</span>
  2.2090 -<span id="L1263" rel="#L1263">1263</span>
  2.2091 -<span id="L1264" rel="#L1264">1264</span>
  2.2092 -<span id="L1265" rel="#L1265">1265</span>
  2.2093 -<span id="L1266" rel="#L1266">1266</span>
  2.2094 -<span id="L1267" rel="#L1267">1267</span>
  2.2095 -<span id="L1268" rel="#L1268">1268</span>
  2.2096 -<span id="L1269" rel="#L1269">1269</span>
  2.2097 -<span id="L1270" rel="#L1270">1270</span>
  2.2098 -<span id="L1271" rel="#L1271">1271</span>
  2.2099 -<span id="L1272" rel="#L1272">1272</span>
  2.2100 -<span id="L1273" rel="#L1273">1273</span>
  2.2101 -<span id="L1274" rel="#L1274">1274</span>
  2.2102 -<span id="L1275" rel="#L1275">1275</span>
  2.2103 -<span id="L1276" rel="#L1276">1276</span>
  2.2104 -<span id="L1277" rel="#L1277">1277</span>
  2.2105 -<span id="L1278" rel="#L1278">1278</span>
  2.2106 -<span id="L1279" rel="#L1279">1279</span>
  2.2107 -<span id="L1280" rel="#L1280">1280</span>
  2.2108 -<span id="L1281" rel="#L1281">1281</span>
  2.2109 -<span id="L1282" rel="#L1282">1282</span>
  2.2110 -<span id="L1283" rel="#L1283">1283</span>
  2.2111 -<span id="L1284" rel="#L1284">1284</span>
  2.2112 -<span id="L1285" rel="#L1285">1285</span>
  2.2113 -<span id="L1286" rel="#L1286">1286</span>
  2.2114 -<span id="L1287" rel="#L1287">1287</span>
  2.2115 -<span id="L1288" rel="#L1288">1288</span>
  2.2116 -<span id="L1289" rel="#L1289">1289</span>
  2.2117 -<span id="L1290" rel="#L1290">1290</span>
  2.2118 -<span id="L1291" rel="#L1291">1291</span>
  2.2119 -<span id="L1292" rel="#L1292">1292</span>
  2.2120 -<span id="L1293" rel="#L1293">1293</span>
  2.2121 -<span id="L1294" rel="#L1294">1294</span>
  2.2122 -<span id="L1295" rel="#L1295">1295</span>
  2.2123 -<span id="L1296" rel="#L1296">1296</span>
  2.2124 -<span id="L1297" rel="#L1297">1297</span>
  2.2125 -<span id="L1298" rel="#L1298">1298</span>
  2.2126 -<span id="L1299" rel="#L1299">1299</span>
  2.2127 -<span id="L1300" rel="#L1300">1300</span>
  2.2128 -<span id="L1301" rel="#L1301">1301</span>
  2.2129 -<span id="L1302" rel="#L1302">1302</span>
  2.2130 -<span id="L1303" rel="#L1303">1303</span>
  2.2131 -<span id="L1304" rel="#L1304">1304</span>
  2.2132 -<span id="L1305" rel="#L1305">1305</span>
  2.2133 -<span id="L1306" rel="#L1306">1306</span>
  2.2134 -<span id="L1307" rel="#L1307">1307</span>
  2.2135 -<span id="L1308" rel="#L1308">1308</span>
  2.2136 -<span id="L1309" rel="#L1309">1309</span>
  2.2137 -<span id="L1310" rel="#L1310">1310</span>
  2.2138 -<span id="L1311" rel="#L1311">1311</span>
  2.2139 -<span id="L1312" rel="#L1312">1312</span>
  2.2140 -<span id="L1313" rel="#L1313">1313</span>
  2.2141 -<span id="L1314" rel="#L1314">1314</span>
  2.2142 -<span id="L1315" rel="#L1315">1315</span>
  2.2143 -<span id="L1316" rel="#L1316">1316</span>
  2.2144 -<span id="L1317" rel="#L1317">1317</span>
  2.2145 -<span id="L1318" rel="#L1318">1318</span>
  2.2146 -<span id="L1319" rel="#L1319">1319</span>
  2.2147 -<span id="L1320" rel="#L1320">1320</span>
  2.2148 -<span id="L1321" rel="#L1321">1321</span>
  2.2149 -<span id="L1322" rel="#L1322">1322</span>
  2.2150 -<span id="L1323" rel="#L1323">1323</span>
  2.2151 -<span id="L1324" rel="#L1324">1324</span>
  2.2152 -<span id="L1325" rel="#L1325">1325</span>
  2.2153 -<span id="L1326" rel="#L1326">1326</span>
  2.2154 -<span id="L1327" rel="#L1327">1327</span>
  2.2155 -<span id="L1328" rel="#L1328">1328</span>
  2.2156 -<span id="L1329" rel="#L1329">1329</span>
  2.2157 -<span id="L1330" rel="#L1330">1330</span>
  2.2158 -<span id="L1331" rel="#L1331">1331</span>
  2.2159 -<span id="L1332" rel="#L1332">1332</span>
  2.2160 -<span id="L1333" rel="#L1333">1333</span>
  2.2161 -<span id="L1334" rel="#L1334">1334</span>
  2.2162 -<span id="L1335" rel="#L1335">1335</span>
  2.2163 -<span id="L1336" rel="#L1336">1336</span>
  2.2164 -<span id="L1337" rel="#L1337">1337</span>
  2.2165 -<span id="L1338" rel="#L1338">1338</span>
  2.2166 -<span id="L1339" rel="#L1339">1339</span>
  2.2167 -<span id="L1340" rel="#L1340">1340</span>
  2.2168 -<span id="L1341" rel="#L1341">1341</span>
  2.2169 -<span id="L1342" rel="#L1342">1342</span>
  2.2170 -<span id="L1343" rel="#L1343">1343</span>
  2.2171 -<span id="L1344" rel="#L1344">1344</span>
  2.2172 -<span id="L1345" rel="#L1345">1345</span>
  2.2173 -<span id="L1346" rel="#L1346">1346</span>
  2.2174 -<span id="L1347" rel="#L1347">1347</span>
  2.2175 -<span id="L1348" rel="#L1348">1348</span>
  2.2176 -<span id="L1349" rel="#L1349">1349</span>
  2.2177 -<span id="L1350" rel="#L1350">1350</span>
  2.2178 -<span id="L1351" rel="#L1351">1351</span>
  2.2179 -<span id="L1352" rel="#L1352">1352</span>
  2.2180 -<span id="L1353" rel="#L1353">1353</span>
  2.2181 -<span id="L1354" rel="#L1354">1354</span>
  2.2182 -<span id="L1355" rel="#L1355">1355</span>
  2.2183 -<span id="L1356" rel="#L1356">1356</span>
  2.2184 -<span id="L1357" rel="#L1357">1357</span>
  2.2185 -<span id="L1358" rel="#L1358">1358</span>
  2.2186 -<span id="L1359" rel="#L1359">1359</span>
  2.2187 -<span id="L1360" rel="#L1360">1360</span>
  2.2188 -<span id="L1361" rel="#L1361">1361</span>
  2.2189 -<span id="L1362" rel="#L1362">1362</span>
  2.2190 -<span id="L1363" rel="#L1363">1363</span>
  2.2191 -<span id="L1364" rel="#L1364">1364</span>
  2.2192 -<span id="L1365" rel="#L1365">1365</span>
  2.2193 -<span id="L1366" rel="#L1366">1366</span>
  2.2194 -<span id="L1367" rel="#L1367">1367</span>
  2.2195 -<span id="L1368" rel="#L1368">1368</span>
  2.2196 -<span id="L1369" rel="#L1369">1369</span>
  2.2197 -<span id="L1370" rel="#L1370">1370</span>
  2.2198 -<span id="L1371" rel="#L1371">1371</span>
  2.2199 -<span id="L1372" rel="#L1372">1372</span>
  2.2200 -<span id="L1373" rel="#L1373">1373</span>
  2.2201 -<span id="L1374" rel="#L1374">1374</span>
  2.2202 -<span id="L1375" rel="#L1375">1375</span>
  2.2203 -<span id="L1376" rel="#L1376">1376</span>
  2.2204 -<span id="L1377" rel="#L1377">1377</span>
  2.2205 -<span id="L1378" rel="#L1378">1378</span>
  2.2206 -<span id="L1379" rel="#L1379">1379</span>
  2.2207 -<span id="L1380" rel="#L1380">1380</span>
  2.2208 -<span id="L1381" rel="#L1381">1381</span>
  2.2209 -<span id="L1382" rel="#L1382">1382</span>
  2.2210 -<span id="L1383" rel="#L1383">1383</span>
  2.2211 -<span id="L1384" rel="#L1384">1384</span>
  2.2212 -<span id="L1385" rel="#L1385">1385</span>
  2.2213 -<span id="L1386" rel="#L1386">1386</span>
  2.2214 -<span id="L1387" rel="#L1387">1387</span>
  2.2215 -<span id="L1388" rel="#L1388">1388</span>
  2.2216 -<span id="L1389" rel="#L1389">1389</span>
  2.2217 -<span id="L1390" rel="#L1390">1390</span>
  2.2218 -<span id="L1391" rel="#L1391">1391</span>
  2.2219 -<span id="L1392" rel="#L1392">1392</span>
  2.2220 -<span id="L1393" rel="#L1393">1393</span>
  2.2221 -<span id="L1394" rel="#L1394">1394</span>
  2.2222 -<span id="L1395" rel="#L1395">1395</span>
  2.2223 -<span id="L1396" rel="#L1396">1396</span>
  2.2224 -<span id="L1397" rel="#L1397">1397</span>
  2.2225 -<span id="L1398" rel="#L1398">1398</span>
  2.2226 -<span id="L1399" rel="#L1399">1399</span>
  2.2227 -<span id="L1400" rel="#L1400">1400</span>
  2.2228 -<span id="L1401" rel="#L1401">1401</span>
  2.2229 -<span id="L1402" rel="#L1402">1402</span>
  2.2230 -<span id="L1403" rel="#L1403">1403</span>
  2.2231 -<span id="L1404" rel="#L1404">1404</span>
  2.2232 -<span id="L1405" rel="#L1405">1405</span>
  2.2233 -<span id="L1406" rel="#L1406">1406</span>
  2.2234 -<span id="L1407" rel="#L1407">1407</span>
  2.2235 -<span id="L1408" rel="#L1408">1408</span>
  2.2236 -<span id="L1409" rel="#L1409">1409</span>
  2.2237 -<span id="L1410" rel="#L1410">1410</span>
  2.2238 -<span id="L1411" rel="#L1411">1411</span>
  2.2239 -<span id="L1412" rel="#L1412">1412</span>
  2.2240 -<span id="L1413" rel="#L1413">1413</span>
  2.2241 -<span id="L1414" rel="#L1414">1414</span>
  2.2242 -<span id="L1415" rel="#L1415">1415</span>
  2.2243 -<span id="L1416" rel="#L1416">1416</span>
  2.2244 -<span id="L1417" rel="#L1417">1417</span>
  2.2245 -<span id="L1418" rel="#L1418">1418</span>
  2.2246 -<span id="L1419" rel="#L1419">1419</span>
  2.2247 -<span id="L1420" rel="#L1420">1420</span>
  2.2248 -<span id="L1421" rel="#L1421">1421</span>
  2.2249 -<span id="L1422" rel="#L1422">1422</span>
  2.2250 -<span id="L1423" rel="#L1423">1423</span>
  2.2251 -<span id="L1424" rel="#L1424">1424</span>
  2.2252 -<span id="L1425" rel="#L1425">1425</span>
  2.2253 -<span id="L1426" rel="#L1426">1426</span>
  2.2254 -<span id="L1427" rel="#L1427">1427</span>
  2.2255 -<span id="L1428" rel="#L1428">1428</span>
  2.2256 -<span id="L1429" rel="#L1429">1429</span>
  2.2257 -<span id="L1430" rel="#L1430">1430</span>
  2.2258 -<span id="L1431" rel="#L1431">1431</span>
  2.2259 -<span id="L1432" rel="#L1432">1432</span>
  2.2260 -<span id="L1433" rel="#L1433">1433</span>
  2.2261 -<span id="L1434" rel="#L1434">1434</span>
  2.2262 -<span id="L1435" rel="#L1435">1435</span>
  2.2263 -<span id="L1436" rel="#L1436">1436</span>
  2.2264 -<span id="L1437" rel="#L1437">1437</span>
  2.2265 -<span id="L1438" rel="#L1438">1438</span>
  2.2266 -<span id="L1439" rel="#L1439">1439</span>
  2.2267 -<span id="L1440" rel="#L1440">1440</span>
  2.2268 -<span id="L1441" rel="#L1441">1441</span>
  2.2269 -<span id="L1442" rel="#L1442">1442</span>
  2.2270 -<span id="L1443" rel="#L1443">1443</span>
  2.2271 -<span id="L1444" rel="#L1444">1444</span>
  2.2272 -<span id="L1445" rel="#L1445">1445</span>
  2.2273 -<span id="L1446" rel="#L1446">1446</span>
  2.2274 -<span id="L1447" rel="#L1447">1447</span>
  2.2275 -<span id="L1448" rel="#L1448">1448</span>
  2.2276 -<span id="L1449" rel="#L1449">1449</span>
  2.2277 -<span id="L1450" rel="#L1450">1450</span>
  2.2278 -<span id="L1451" rel="#L1451">1451</span>
  2.2279 -<span id="L1452" rel="#L1452">1452</span>
  2.2280 -<span id="L1453" rel="#L1453">1453</span>
  2.2281 -<span id="L1454" rel="#L1454">1454</span>
  2.2282 -<span id="L1455" rel="#L1455">1455</span>
  2.2283 -<span id="L1456" rel="#L1456">1456</span>
  2.2284 -<span id="L1457" rel="#L1457">1457</span>
  2.2285 -<span id="L1458" rel="#L1458">1458</span>
  2.2286 -<span id="L1459" rel="#L1459">1459</span>
  2.2287 -<span id="L1460" rel="#L1460">1460</span>
  2.2288 -<span id="L1461" rel="#L1461">1461</span>
  2.2289 -<span id="L1462" rel="#L1462">1462</span>
  2.2290 -<span id="L1463" rel="#L1463">1463</span>
  2.2291 -<span id="L1464" rel="#L1464">1464</span>
  2.2292 -<span id="L1465" rel="#L1465">1465</span>
  2.2293 -<span id="L1466" rel="#L1466">1466</span>
  2.2294 -<span id="L1467" rel="#L1467">1467</span>
  2.2295 -<span id="L1468" rel="#L1468">1468</span>
  2.2296 -<span id="L1469" rel="#L1469">1469</span>
  2.2297 -<span id="L1470" rel="#L1470">1470</span>
  2.2298 -<span id="L1471" rel="#L1471">1471</span>
  2.2299 -<span id="L1472" rel="#L1472">1472</span>
  2.2300 -<span id="L1473" rel="#L1473">1473</span>
  2.2301 -<span id="L1474" rel="#L1474">1474</span>
  2.2302 -<span id="L1475" rel="#L1475">1475</span>
  2.2303 -<span id="L1476" rel="#L1476">1476</span>
  2.2304 -<span id="L1477" rel="#L1477">1477</span>
  2.2305 -<span id="L1478" rel="#L1478">1478</span>
  2.2306 -<span id="L1479" rel="#L1479">1479</span>
  2.2307 -<span id="L1480" rel="#L1480">1480</span>
  2.2308 -<span id="L1481" rel="#L1481">1481</span>
  2.2309 -<span id="L1482" rel="#L1482">1482</span>
  2.2310 -<span id="L1483" rel="#L1483">1483</span>
  2.2311 -<span id="L1484" rel="#L1484">1484</span>
  2.2312 -<span id="L1485" rel="#L1485">1485</span>
  2.2313 -<span id="L1486" rel="#L1486">1486</span>
  2.2314 -<span id="L1487" rel="#L1487">1487</span>
  2.2315 -<span id="L1488" rel="#L1488">1488</span>
  2.2316 -<span id="L1489" rel="#L1489">1489</span>
  2.2317 -<span id="L1490" rel="#L1490">1490</span>
  2.2318 -<span id="L1491" rel="#L1491">1491</span>
  2.2319 -<span id="L1492" rel="#L1492">1492</span>
  2.2320 -<span id="L1493" rel="#L1493">1493</span>
  2.2321 -<span id="L1494" rel="#L1494">1494</span>
  2.2322 -<span id="L1495" rel="#L1495">1495</span>
  2.2323 -<span id="L1496" rel="#L1496">1496</span>
  2.2324 -<span id="L1497" rel="#L1497">1497</span>
  2.2325 -<span id="L1498" rel="#L1498">1498</span>
  2.2326 -<span id="L1499" rel="#L1499">1499</span>
  2.2327 -<span id="L1500" rel="#L1500">1500</span>
  2.2328 -<span id="L1501" rel="#L1501">1501</span>
  2.2329 -<span id="L1502" rel="#L1502">1502</span>
  2.2330 -<span id="L1503" rel="#L1503">1503</span>
  2.2331 -<span id="L1504" rel="#L1504">1504</span>
  2.2332 -<span id="L1505" rel="#L1505">1505</span>
  2.2333 -<span id="L1506" rel="#L1506">1506</span>
  2.2334 -<span id="L1507" rel="#L1507">1507</span>
  2.2335 -<span id="L1508" rel="#L1508">1508</span>
  2.2336 -<span id="L1509" rel="#L1509">1509</span>
  2.2337 -<span id="L1510" rel="#L1510">1510</span>
  2.2338 -<span id="L1511" rel="#L1511">1511</span>
  2.2339 -<span id="L1512" rel="#L1512">1512</span>
  2.2340 -<span id="L1513" rel="#L1513">1513</span>
  2.2341 -<span id="L1514" rel="#L1514">1514</span>
  2.2342 -<span id="L1515" rel="#L1515">1515</span>
  2.2343 -<span id="L1516" rel="#L1516">1516</span>
  2.2344 -<span id="L1517" rel="#L1517">1517</span>
  2.2345 -<span id="L1518" rel="#L1518">1518</span>
  2.2346 -<span id="L1519" rel="#L1519">1519</span>
  2.2347 -<span id="L1520" rel="#L1520">1520</span>
  2.2348 -<span id="L1521" rel="#L1521">1521</span>
  2.2349 -<span id="L1522" rel="#L1522">1522</span>
  2.2350 -<span id="L1523" rel="#L1523">1523</span>
  2.2351 -<span id="L1524" rel="#L1524">1524</span>
  2.2352 -<span id="L1525" rel="#L1525">1525</span>
  2.2353 -<span id="L1526" rel="#L1526">1526</span>
  2.2354 -<span id="L1527" rel="#L1527">1527</span>
  2.2355 -<span id="L1528" rel="#L1528">1528</span>
  2.2356 -<span id="L1529" rel="#L1529">1529</span>
  2.2357 -<span id="L1530" rel="#L1530">1530</span>
  2.2358 -<span id="L1531" rel="#L1531">1531</span>
  2.2359 -<span id="L1532" rel="#L1532">1532</span>
  2.2360 -<span id="L1533" rel="#L1533">1533</span>
  2.2361 -<span id="L1534" rel="#L1534">1534</span>
  2.2362 -<span id="L1535" rel="#L1535">1535</span>
  2.2363 -<span id="L1536" rel="#L1536">1536</span>
  2.2364 -<span id="L1537" rel="#L1537">1537</span>
  2.2365 -<span id="L1538" rel="#L1538">1538</span>
  2.2366 -<span id="L1539" rel="#L1539">1539</span>
  2.2367 -<span id="L1540" rel="#L1540">1540</span>
  2.2368 -<span id="L1541" rel="#L1541">1541</span>
  2.2369 -<span id="L1542" rel="#L1542">1542</span>
  2.2370 -<span id="L1543" rel="#L1543">1543</span>
  2.2371 -<span id="L1544" rel="#L1544">1544</span>
  2.2372 -<span id="L1545" rel="#L1545">1545</span>
  2.2373 -<span id="L1546" rel="#L1546">1546</span>
  2.2374 -<span id="L1547" rel="#L1547">1547</span>
  2.2375 -<span id="L1548" rel="#L1548">1548</span>
  2.2376 -<span id="L1549" rel="#L1549">1549</span>
  2.2377 -<span id="L1550" rel="#L1550">1550</span>
  2.2378 -<span id="L1551" rel="#L1551">1551</span>
  2.2379 -<span id="L1552" rel="#L1552">1552</span>
  2.2380 -<span id="L1553" rel="#L1553">1553</span>
  2.2381 -<span id="L1554" rel="#L1554">1554</span>
  2.2382 -<span id="L1555" rel="#L1555">1555</span>
  2.2383 -<span id="L1556" rel="#L1556">1556</span>
  2.2384 -<span id="L1557" rel="#L1557">1557</span>
  2.2385 -<span id="L1558" rel="#L1558">1558</span>
  2.2386 -<span id="L1559" rel="#L1559">1559</span>
  2.2387 -<span id="L1560" rel="#L1560">1560</span>
  2.2388 -<span id="L1561" rel="#L1561">1561</span>
  2.2389 -<span id="L1562" rel="#L1562">1562</span>
  2.2390 -<span id="L1563" rel="#L1563">1563</span>
  2.2391 -<span id="L1564" rel="#L1564">1564</span>
  2.2392 -<span id="L1565" rel="#L1565">1565</span>
  2.2393 -<span id="L1566" rel="#L1566">1566</span>
  2.2394 -<span id="L1567" rel="#L1567">1567</span>
  2.2395 -<span id="L1568" rel="#L1568">1568</span>
  2.2396 -<span id="L1569" rel="#L1569">1569</span>
  2.2397 -<span id="L1570" rel="#L1570">1570</span>
  2.2398 -<span id="L1571" rel="#L1571">1571</span>
  2.2399 -<span id="L1572" rel="#L1572">1572</span>
  2.2400 -<span id="L1573" rel="#L1573">1573</span>
  2.2401 -<span id="L1574" rel="#L1574">1574</span>
  2.2402 -<span id="L1575" rel="#L1575">1575</span>
  2.2403 -<span id="L1576" rel="#L1576">1576</span>
  2.2404 -<span id="L1577" rel="#L1577">1577</span>
  2.2405 -<span id="L1578" rel="#L1578">1578</span>
  2.2406 -<span id="L1579" rel="#L1579">1579</span>
  2.2407 -<span id="L1580" rel="#L1580">1580</span>
  2.2408 -<span id="L1581" rel="#L1581">1581</span>
  2.2409 -<span id="L1582" rel="#L1582">1582</span>
  2.2410 -<span id="L1583" rel="#L1583">1583</span>
  2.2411 -<span id="L1584" rel="#L1584">1584</span>
  2.2412 -<span id="L1585" rel="#L1585">1585</span>
  2.2413 -<span id="L1586" rel="#L1586">1586</span>
  2.2414 -<span id="L1587" rel="#L1587">1587</span>
  2.2415 -<span id="L1588" rel="#L1588">1588</span>
  2.2416 -<span id="L1589" rel="#L1589">1589</span>
  2.2417 -<span id="L1590" rel="#L1590">1590</span>
  2.2418 -<span id="L1591" rel="#L1591">1591</span>
  2.2419 -<span id="L1592" rel="#L1592">1592</span>
  2.2420 -<span id="L1593" rel="#L1593">1593</span>
  2.2421 -<span id="L1594" rel="#L1594">1594</span>
  2.2422 -<span id="L1595" rel="#L1595">1595</span>
  2.2423 -<span id="L1596" rel="#L1596">1596</span>
  2.2424 -<span id="L1597" rel="#L1597">1597</span>
  2.2425 -<span id="L1598" rel="#L1598">1598</span>
  2.2426 -<span id="L1599" rel="#L1599">1599</span>
  2.2427 -<span id="L1600" rel="#L1600">1600</span>
  2.2428 -<span id="L1601" rel="#L1601">1601</span>
  2.2429 -<span id="L1602" rel="#L1602">1602</span>
  2.2430 -<span id="L1603" rel="#L1603">1603</span>
  2.2431 -<span id="L1604" rel="#L1604">1604</span>
  2.2432 -<span id="L1605" rel="#L1605">1605</span>
  2.2433 -<span id="L1606" rel="#L1606">1606</span>
  2.2434 -<span id="L1607" rel="#L1607">1607</span>
  2.2435 -<span id="L1608" rel="#L1608">1608</span>
  2.2436 -<span id="L1609" rel="#L1609">1609</span>
  2.2437 -<span id="L1610" rel="#L1610">1610</span>
  2.2438 -<span id="L1611" rel="#L1611">1611</span>
  2.2439 -<span id="L1612" rel="#L1612">1612</span>
  2.2440 -<span id="L1613" rel="#L1613">1613</span>
  2.2441 -<span id="L1614" rel="#L1614">1614</span>
  2.2442 -<span id="L1615" rel="#L1615">1615</span>
  2.2443 -<span id="L1616" rel="#L1616">1616</span>
  2.2444 -<span id="L1617" rel="#L1617">1617</span>
  2.2445 -<span id="L1618" rel="#L1618">1618</span>
  2.2446 -<span id="L1619" rel="#L1619">1619</span>
  2.2447 -<span id="L1620" rel="#L1620">1620</span>
  2.2448 -<span id="L1621" rel="#L1621">1621</span>
  2.2449 -<span id="L1622" rel="#L1622">1622</span>
  2.2450 -<span id="L1623" rel="#L1623">1623</span>
  2.2451 -<span id="L1624" rel="#L1624">1624</span>
  2.2452 -<span id="L1625" rel="#L1625">1625</span>
  2.2453 -<span id="L1626" rel="#L1626">1626</span>
  2.2454 -<span id="L1627" rel="#L1627">1627</span>
  2.2455 -<span id="L1628" rel="#L1628">1628</span>
  2.2456 -<span id="L1629" rel="#L1629">1629</span>
  2.2457 -<span id="L1630" rel="#L1630">1630</span>
  2.2458 -<span id="L1631" rel="#L1631">1631</span>
  2.2459 -<span id="L1632" rel="#L1632">1632</span>
  2.2460 -<span id="L1633" rel="#L1633">1633</span>
  2.2461 -<span id="L1634" rel="#L1634">1634</span>
  2.2462 -<span id="L1635" rel="#L1635">1635</span>
  2.2463 -<span id="L1636" rel="#L1636">1636</span>
  2.2464 -<span id="L1637" rel="#L1637">1637</span>
  2.2465 -<span id="L1638" rel="#L1638">1638</span>
  2.2466 -<span id="L1639" rel="#L1639">1639</span>
  2.2467 -<span id="L1640" rel="#L1640">1640</span>
  2.2468 -<span id="L1641" rel="#L1641">1641</span>
  2.2469 -<span id="L1642" rel="#L1642">1642</span>
  2.2470 -<span id="L1643" rel="#L1643">1643</span>
  2.2471 -<span id="L1644" rel="#L1644">1644</span>
  2.2472 -<span id="L1645" rel="#L1645">1645</span>
  2.2473 -<span id="L1646" rel="#L1646">1646</span>
  2.2474 -<span id="L1647" rel="#L1647">1647</span>
  2.2475 -<span id="L1648" rel="#L1648">1648</span>
  2.2476 -<span id="L1649" rel="#L1649">1649</span>
  2.2477 -<span id="L1650" rel="#L1650">1650</span>
  2.2478 -<span id="L1651" rel="#L1651">1651</span>
  2.2479 -<span id="L1652" rel="#L1652">1652</span>
  2.2480 -<span id="L1653" rel="#L1653">1653</span>
  2.2481 -<span id="L1654" rel="#L1654">1654</span>
  2.2482 -<span id="L1655" rel="#L1655">1655</span>
  2.2483 -<span id="L1656" rel="#L1656">1656</span>
  2.2484 -<span id="L1657" rel="#L1657">1657</span>
  2.2485 -<span id="L1658" rel="#L1658">1658</span>
  2.2486 -<span id="L1659" rel="#L1659">1659</span>
  2.2487 -<span id="L1660" rel="#L1660">1660</span>
  2.2488 -<span id="L1661" rel="#L1661">1661</span>
  2.2489 -<span id="L1662" rel="#L1662">1662</span>
  2.2490 -<span id="L1663" rel="#L1663">1663</span>
  2.2491 -<span id="L1664" rel="#L1664">1664</span>
  2.2492 -<span id="L1665" rel="#L1665">1665</span>
  2.2493 -</pre>
  2.2494 -          </td>
  2.2495 -          <td width="100%">
  2.2496 -                  <div class="highlight"><pre><div class='line' id='LC1'><span class="c1">;;; lua-mode.el --- a major-mode for editing Lua scripts</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="c1">;; Copyright (C) 1997, 2001, 2004, 2006, 2007, 2010, 2011 Free Software Foundation, Inc.</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'><span class="c1">;; Author: 2011 immerrr &lt;immerrr+lua@gmail.com&gt;</span></div><div class='line' id='LC6'><span class="c1">;;         2010-2011 Reuben Thomas &lt;rrt@sc3d.org&gt;</span></div><div class='line' id='LC7'><span class="c1">;;         2006 Juergen Hoetzel &lt;juergen@hoetzel.info&gt;</span></div><div class='line' id='LC8'><span class="c1">;;         2004 various (support for Lua 5 and byte compilation)</span></div><div class='line' id='LC9'><span class="c1">;;         2001 Christian Vogler &lt;cvogler@gradient.cis.upenn.edu&gt;</span></div><div class='line' id='LC10'><span class="c1">;;         1997 Bret Mogilefsky &lt;mogul-lua@gelatinous.com&gt; starting from</span></div><div class='line' id='LC11'><span class="c1">;;              tcl-mode by Gregor Schmid &lt;schmid@fb3-s7.math.tu-berlin.de&gt;</span></div><div class='line' id='LC12'><span class="c1">;;              with tons of assistance from</span></div><div class='line' id='LC13'><span class="c1">;;              Paul Du Bois &lt;pld-lua@gelatinous.com&gt; and</span></div><div class='line' id='LC14'><span class="c1">;;              Aaron Smith &lt;aaron-lua@gelatinous.com&gt;.</span></div><div class='line' id='LC15'><span class="c1">;;</span></div><div class='line' id='LC16'><span class="c1">;; URL:         http://immerrr.github.com/lua-mode</span></div><div class='line' id='LC17'><span class="c1">;; Version:     20111107</span></div><div class='line' id='LC18'><span class="c1">;;</span></div><div class='line' id='LC19'><span class="c1">;; This file is NOT part of Emacs.</span></div><div class='line' id='LC20'><span class="c1">;;</span></div><div class='line' id='LC21'><span class="c1">;; This program is free software; you can redistribute it and/or</span></div><div class='line' id='LC22'><span class="c1">;; modify it under the terms of the GNU General Public License</span></div><div class='line' id='LC23'><span class="c1">;; as published by the Free Software Foundation; either version 2</span></div><div class='line' id='LC24'><span class="c1">;; of the License, or (at your option) any later version.</span></div><div class='line' id='LC25'><span class="c1">;;</span></div><div class='line' id='LC26'><span class="c1">;; This program is distributed in the hope that it will be useful,</span></div><div class='line' id='LC27'><span class="c1">;; but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div><div class='line' id='LC28'><span class="c1">;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></div><div class='line' id='LC29'><span class="c1">;; GNU General Public License for more details.</span></div><div class='line' id='LC30'><span class="c1">;;</span></div><div class='line' id='LC31'><span class="c1">;; You should have received a copy of the GNU General Public License</span></div><div class='line' id='LC32'><span class="c1">;; along with this program; if not, write to the Free Software</span></div><div class='line' id='LC33'><span class="c1">;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,</span></div><div class='line' id='LC34'><span class="c1">;; MA 02110-1301, USA.</span></div><div class='line' id='LC35'><br/></div><div class='line' id='LC36'><span class="c1">;; Keywords: languages, processes, tools</span></div><div class='line' id='LC37'><br/></div><div class='line' id='LC38'><br/></div><div class='line' id='LC39'><span class="c1">;;; Commentary:</span></div><div class='line' id='LC40'><br/></div><div class='line' id='LC41'><span class="c1">;; Thanks to d87 &lt;github.com/d87&gt; for an idea of highlighting lua</span></div><div class='line' id='LC42'><span class="c1">;; builtins/numbers</span></div><div class='line' id='LC43'><br/></div><div class='line' id='LC44'><span class="c1">;; Thanks to Vedat Hallac &lt;github.com/vhallac&gt; for sharing some of</span></div><div class='line' id='LC45'><span class="c1">;; his fixes and updates to core indentation logics</span></div><div class='line' id='LC46'><br/></div><div class='line' id='LC47'><span class="c1">;; Thanks to Rafael Sanchez &lt;rafael@cornerdimension.com&gt; for patch</span></div><div class='line' id='LC48'><span class="c1">;; adding lua-mode to interpreter-mode-alist</span></div><div class='line' id='LC49'><br/></div><div class='line' id='LC50'><span class="c1">;; Thanks to Leonardo Etcheverry &lt;leo@kalio.net&gt; for enabling</span></div><div class='line' id='LC51'><span class="c1">;; narrow-to-defun functionality</span></div><div class='line' id='LC52'><br/></div><div class='line' id='LC53'><span class="c1">;; Thanks to Tobias Polzin &lt;polzin@gmx.de&gt; for function indenting</span></div><div class='line' id='LC54'><span class="c1">;; patch: Indent &quot;(&quot; like &quot;{&quot;</span></div><div class='line' id='LC55'><br/></div><div class='line' id='LC56'><span class="c1">;; Thanks to Fabien &lt;fleutot@gmail.com&gt; for imenu patches.</span></div><div class='line' id='LC57'><br/></div><div class='line' id='LC58'><span class="c1">;; Thanks to Simon Marshall &lt;simonm@mail.esrin.esa.it&gt; and Olivier</span></div><div class='line' id='LC59'><span class="c1">;; Andrieu &lt;oandrieu@gmail.com&gt; for font-lock patches.</span></div><div class='line' id='LC60'><br/></div><div class='line' id='LC61'><span class="c1">;; Additional font-lock highlighting and indentation tweaks by</span></div><div class='line' id='LC62'><span class="c1">;; Adam D. Moss &lt;adam@gimp.org&gt;.</span></div><div class='line' id='LC63'><br/></div><div class='line' id='LC64'><span class="c1">;; INSTALLATION:</span></div><div class='line' id='LC65'><br/></div><div class='line' id='LC66'><span class="c1">;; To install, just copy this file into a directory on your load-path</span></div><div class='line' id='LC67'><span class="c1">;; (and byte-compile it). To set up Emacs to automatically edit files</span></div><div class='line' id='LC68'><span class="c1">;; ending in &quot;.lua&quot; or with a lua hash-bang line using lua-mode add</span></div><div class='line' id='LC69'><span class="c1">;; the following to your init file:</span></div><div class='line' id='LC70'><span class="c1">;;</span></div><div class='line' id='LC71'><span class="c1">;; (autoload &#39;lua-mode &quot;lua-mode&quot; &quot;Lua editing mode.&quot; t)</span></div><div class='line' id='LC72'><span class="c1">;; (add-to-list &#39;auto-mode-alist &#39;(&quot;\\.lua$&quot; . lua-mode))</span></div><div class='line' id='LC73'><span class="c1">;; (add-to-list &#39;interpreter-mode-alist &#39;(&quot;lua&quot; . lua-mode))</span></div><div class='line' id='LC74'><br/></div><div class='line' id='LC75'><span class="c1">;; Usage</span></div><div class='line' id='LC76'><br/></div><div class='line' id='LC77'><span class="c1">;; Lua-mode supports c-mode style formatting and sending of</span></div><div class='line' id='LC78'><span class="c1">;; lines/regions/files to a Lua interpreter. An interpreter (see</span></div><div class='line' id='LC79'><span class="c1">;; variable `lua-default-application&#39;) will be started if you try to</span></div><div class='line' id='LC80'><span class="c1">;; send some code and none is running. You can use the process-buffer</span></div><div class='line' id='LC81'><span class="c1">;; (named after the application you chose) as if it were an</span></div><div class='line' id='LC82'><span class="c1">;; interactive shell. See the documentation for `comint.el&#39; for</span></div><div class='line' id='LC83'><span class="c1">;; details.</span></div><div class='line' id='LC84'><br/></div><div class='line' id='LC85'><span class="c1">;; Lua-mode works with Hide Show minor mode (see ``hs-minor-mode``).</span></div><div class='line' id='LC86'><br/></div><div class='line' id='LC87'><span class="c1">;; Key-bindings</span></div><div class='line' id='LC88'><br/></div><div class='line' id='LC89'><span class="c1">;; To see all the keybindings for Lua mode, look at `lua-setup-keymap&#39;</span></div><div class='line' id='LC90'><span class="c1">;; or start `lua-mode&#39; and type `\C-h m&#39;.</span></div><div class='line' id='LC91'><span class="c1">;; The keybindings may seem strange, since I prefer to use them with</span></div><div class='line' id='LC92'><span class="c1">;; lua-prefix-key set to nil, but since those keybindings are already used</span></div><div class='line' id='LC93'><span class="c1">;; the default for `lua-prefix-key&#39; is `\C-c&#39;, which is the conventional</span></div><div class='line' id='LC94'><span class="c1">;; prefix for major-mode commands.</span></div><div class='line' id='LC95'><br/></div><div class='line' id='LC96'><span class="c1">;; You can customise the keybindings either by setting `lua-prefix-key&#39;</span></div><div class='line' id='LC97'><span class="c1">;; or by putting the following in your .emacs</span></div><div class='line' id='LC98'><span class="c1">;;      (define-key lua-mode-map &lt;your-key&gt; &lt;function&gt;)</span></div><div class='line' id='LC99'><span class="c1">;; for all the functions you need.</span></div><div class='line' id='LC100'><br/></div><div class='line' id='LC101'><br/></div><div class='line' id='LC102'><span class="c1">;;; Code:</span></div><div class='line' id='LC103'><span class="p">(</span><span class="nf">eval-when-compile</span></div><div class='line' id='LC104'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">require</span> <span class="ss">&#39;cl</span><span class="p">))</span></div><div class='line' id='LC105'><br/></div><div class='line' id='LC106'><span class="p">(</span><span class="nf">require</span> <span class="ss">&#39;comint</span><span class="p">)</span></div><div class='line' id='LC107'><br/></div><div class='line' id='LC108'><span class="p">(</span><span class="nf">eval-and-compile</span></div><div class='line' id='LC109'>&nbsp;&nbsp;<span class="c1">;; Backward compatibility for Emacsen &lt; 24.1</span></div><div class='line' id='LC110'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">defalias</span> <span class="ss">&#39;lua--prog-mode</span></div><div class='line' id='LC111'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">fboundp</span> <span class="ss">&#39;prog-mode</span><span class="p">)</span> <span class="ss">&#39;prog-mode</span> <span class="ss">&#39;fundamental-mode</span><span class="p">))</span></div><div class='line' id='LC112'><br/></div><div class='line' id='LC113'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">defalias</span> <span class="ss">&#39;lua--cl-assert</span></div><div class='line' id='LC114'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">fboundp</span> <span class="ss">&#39;cl-assert</span><span class="p">)</span> <span class="ss">&#39;cl-assert</span> <span class="ss">&#39;assert</span><span class="p">))</span></div><div class='line' id='LC115'><br/></div><div class='line' id='LC116'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">defalias</span> <span class="ss">&#39;lua--cl-labels</span></div><div class='line' id='LC117'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">fboundp</span> <span class="ss">&#39;cl-labels</span><span class="p">)</span> <span class="ss">&#39;cl-labels</span> <span class="ss">&#39;flet</span><span class="p">))</span></div><div class='line' id='LC118'><br/></div><div class='line' id='LC119'>&nbsp;&nbsp;<span class="c1">;; for Emacsen &lt; 22.1</span></div><div class='line' id='LC120'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">defalias</span> <span class="ss">&#39;lua--with-no-warnings</span></div><div class='line' id='LC121'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">fboundp</span> <span class="ss">&#39;with-no-warnings</span><span class="p">)</span> <span class="ss">&#39;with-no-warnings</span> <span class="ss">&#39;progn</span><span class="p">))</span></div><div class='line' id='LC122'><br/></div><div class='line' id='LC123'>&nbsp;&nbsp;<span class="c1">;; provide backward compatibility for Emacs &lt; 23.2</span></div><div class='line' id='LC124'>&nbsp;&nbsp;<span class="c1">;; called-interactively-p receives an argument starting from Emacs 23.2</span></div><div class='line' id='LC125'>&nbsp;&nbsp;<span class="c1">;; In Emacs 22 &amp; Emacs 23.1 it didn&#39;t expect an argument</span></div><div class='line' id='LC126'>&nbsp;&nbsp;<span class="c1">;; In Emacs 21 it was called interactively-p</span></div><div class='line' id='LC127'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">condition-case</span> <span class="nv">nil</span></div><div class='line' id='LC128'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">progn</span> <span class="p">(</span><span class="nf">called-interactively-p</span> <span class="nv">nil</span><span class="p">)</span></div><div class='line' id='LC129'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; if first call succeeds, make lua-called-interactively-p an alias</span></div><div class='line' id='LC130'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">defalias</span> <span class="ss">&#39;lua--called-interactively-p</span> <span class="ss">&#39;called-interactively-p</span><span class="p">))</span></div><div class='line' id='LC131'><br/></div><div class='line' id='LC132'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">wrong-number-of-arguments</span></div><div class='line' id='LC133'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; wrong number of arguments means it&#39;s 22.1 &lt;= Emacs &lt; 23.2</span></div><div class='line' id='LC134'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;;</span></div><div class='line' id='LC135'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Newer and smarter Emacsen will warn about obsolete functions</span></div><div class='line' id='LC136'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; and/or wrong number of arguments. Turning these warnings off,</span></div><div class='line' id='LC137'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; since it&#39;s backward-compatibility-oriented code anyway.</span></div><div class='line' id='LC138'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua--with-no-warnings</span></div><div class='line' id='LC139'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">defun</span> <span class="nv">lua--called-interactively-p</span> <span class="p">(</span><span class="nf">kind</span><span class="p">)</span></div><div class='line' id='LC140'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;Return t if containing function was called interactively.</span></div><div class='line' id='LC141'><br/></div><div class='line' id='LC142'><span class="s">This function provides lua-mode backward compatibility for</span></div><div class='line' id='LC143'><span class="s">pre-23.2 Emacsen.&quot;</span></div><div class='line' id='LC144'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">eq</span> <span class="nv">kind</span> <span class="ss">&#39;interactive</span><span class="p">)</span></div><div class='line' id='LC145'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive-p</span><span class="p">)</span></div><div class='line' id='LC146'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">called-interactively-p</span><span class="p">)))))</span></div><div class='line' id='LC147'><br/></div><div class='line' id='LC148'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; if not, it&#39;s probably &lt; 22.1, provide partial compatibility</span></div><div class='line' id='LC149'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;;</span></div><div class='line' id='LC150'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Once again, turning obsolete-function warnings off (see above).</span></div><div class='line' id='LC151'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">error</span></div><div class='line' id='LC152'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua--with-no-warnings</span></div><div class='line' id='LC153'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">defun</span> <span class="nv">lua--called-interactively-p</span> <span class="p">(</span><span class="nf">&amp;rest</span> <span class="nv">opts</span><span class="p">)</span></div><div class='line' id='LC154'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;Return t if containing function was called interactively.</span></div><div class='line' id='LC155'><br/></div><div class='line' id='LC156'><span class="s">This function provides lua-mode backward compatibility for pre-22</span></div><div class='line' id='LC157'><span class="s">Emacsen.&quot;</span></div><div class='line' id='LC158'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive-p</span><span class="p">)))))</span></div><div class='line' id='LC159'><br/></div><div class='line' id='LC160'>&nbsp;&nbsp;<span class="c1">;; backward compatibility for Emacsen &lt; 23.3</span></div><div class='line' id='LC161'>&nbsp;&nbsp;<span class="c1">;; Emacs 23.3 introduced with-silent-modifications macro</span></div><div class='line' id='LC162'>&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">fboundp</span> <span class="ss">&#39;with-silent-modifications</span><span class="p">)</span></div><div class='line' id='LC163'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">defalias</span> <span class="ss">&#39;lua--with-silent-modifications</span> <span class="ss">&#39;with-silent-modifications</span><span class="p">)</span></div><div class='line' id='LC164'><br/></div><div class='line' id='LC165'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">defmacro</span> <span class="nv">lua--with-silent-modifications</span> <span class="p">(</span><span class="nf">&amp;rest</span> <span class="nv">body</span><span class="p">)</span></div><div class='line' id='LC166'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;Execute BODY, pretending it does not modifies the buffer.</span></div><div class='line' id='LC167'><br/></div><div class='line' id='LC168'><span class="s">This is a reimplementation of macro `with-silent-modifications&#39;</span></div><div class='line' id='LC169'><span class="s">for Emacsen that doesn&#39;t contain one (pre-23.3).&quot;</span></div><div class='line' id='LC170'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">`</span><span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">old-modified-p</span> <span class="p">(</span><span class="nf">buffer-modified-p</span><span class="p">))</span></div><div class='line' id='LC171'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">inhibit-modification-hooks</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC172'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">buffer-undo-list</span> <span class="nv">t</span><span class="p">))</span></div><div class='line' id='LC173'><br/></div><div class='line' id='LC174'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">unwind-protect</span></div><div class='line' id='LC175'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">,@</span><span class="nv">body</span></div><div class='line' id='LC176'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">set-buffer-modified-p</span> <span class="nv">old-modified-p</span><span class="p">))))))</span></div><div class='line' id='LC177'><br/></div><div class='line' id='LC178'><span class="c1">;; Local variables</span></div><div class='line' id='LC179'><span class="p">(</span><span class="nf">defgroup</span> <span class="nv">lua</span> <span class="nv">nil</span></div><div class='line' id='LC180'>&nbsp;&nbsp;<span class="s">&quot;Major mode for editing lua code.&quot;</span></div><div class='line' id='LC181'>&nbsp;&nbsp;<span class="nv">:prefix</span> <span class="s">&quot;lua-&quot;</span></div><div class='line' id='LC182'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;languages</span><span class="p">)</span></div><div class='line' id='LC183'><br/></div><div class='line' id='LC184'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-indent-level</span> <span class="mi">3</span></div><div class='line' id='LC185'>&nbsp;&nbsp;<span class="s">&quot;Amount by which Lua subexpressions are indented.&quot;</span></div><div class='line' id='LC186'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="ss">&#39;integer</span></div><div class='line' id='LC187'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span><span class="p">)</span></div><div class='line' id='LC188'><br/></div><div class='line' id='LC189'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-comment-start</span> <span class="s">&quot;-- &quot;</span></div><div class='line' id='LC190'>&nbsp;&nbsp;<span class="s">&quot;Default value of `comment-start&#39;.&quot;</span></div><div class='line' id='LC191'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="ss">&#39;string</span></div><div class='line' id='LC192'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span><span class="p">)</span></div><div class='line' id='LC193'><br/></div><div class='line' id='LC194'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-comment-start-skip</span> <span class="s">&quot;-- &quot;</span></div><div class='line' id='LC195'>&nbsp;&nbsp;<span class="s">&quot;Default value of `comment-start-skip&#39;.&quot;</span></div><div class='line' id='LC196'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="ss">&#39;string</span></div><div class='line' id='LC197'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span><span class="p">)</span></div><div class='line' id='LC198'><br/></div><div class='line' id='LC199'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-default-application</span> <span class="s">&quot;lua&quot;</span></div><div class='line' id='LC200'>&nbsp;&nbsp;<span class="s">&quot;Default application to run in lua subprocess.&quot;</span></div><div class='line' id='LC201'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="ss">&#39;string</span></div><div class='line' id='LC202'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span><span class="p">)</span></div><div class='line' id='LC203'><br/></div><div class='line' id='LC204'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-default-command-switches</span> <span class="p">(</span><span class="nb">list </span><span class="s">&quot;-i&quot;</span><span class="p">)</span></div><div class='line' id='LC205'>&nbsp;&nbsp;<span class="s">&quot;Command switches for `lua-default-application&#39;.</span></div><div class='line' id='LC206'><span class="s">Should be a list of strings.&quot;</span></div><div class='line' id='LC207'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="o">&#39;</span><span class="p">(</span><span class="nv">repeat</span> <span class="nv">string</span><span class="p">)</span></div><div class='line' id='LC208'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span><span class="p">)</span></div><div class='line' id='LC209'><br/></div><div class='line' id='LC210'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-always-show</span> <span class="nv">t</span></div><div class='line' id='LC211'>&nbsp;&nbsp;<span class="s">&quot;*Non-nil means display lua-process-buffer after sending a command.&quot;</span></div><div class='line' id='LC212'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="ss">&#39;boolean</span></div><div class='line' id='LC213'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span><span class="p">)</span></div><div class='line' id='LC214'><br/></div><div class='line' id='LC215'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-search-url-prefix</span> <span class="s">&quot;http://www.lua.org/manual/5.1/manual.html#pdf-&quot;</span></div><div class='line' id='LC216'>&nbsp;&nbsp;<span class="s">&quot;*URL at which to search for documentation on a word&quot;</span></div><div class='line' id='LC217'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="ss">&#39;string</span></div><div class='line' id='LC218'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span><span class="p">)</span></div><div class='line' id='LC219'><br/></div><div class='line' id='LC220'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-process</span> <span class="nv">nil</span></div><div class='line' id='LC221'>&nbsp;&nbsp;<span class="s">&quot;The active Lua subprocess&quot;</span><span class="p">)</span></div><div class='line' id='LC222'><br/></div><div class='line' id='LC223'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-process-buffer</span> <span class="nv">nil</span></div><div class='line' id='LC224'>&nbsp;&nbsp;<span class="s">&quot;Buffer used for communication with Lua subprocess&quot;</span><span class="p">)</span></div><div class='line' id='LC225'><br/></div><div class='line' id='LC226'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua--customize-set-prefix-key</span> <span class="p">(</span><span class="nf">prefix-key-sym</span> <span class="nv">prefix-key-val</span><span class="p">)</span></div><div class='line' id='LC227'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua--cl-assert</span> <span class="p">(</span><span class="nf">eq</span> <span class="nv">prefix-key-sym</span> <span class="ss">&#39;lua-prefix-key</span><span class="p">))</span></div><div class='line' id='LC228'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">set</span> <span class="nv">prefix-key-sym</span> <span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">and </span><span class="nv">prefix-key-val</span> <span class="p">(</span><span class="nb">&gt; </span><span class="p">(</span><span class="nb">length </span><span class="nv">prefix-key-val</span><span class="p">)</span> <span class="mi">0</span><span class="p">))</span></div><div class='line' id='LC229'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; read-kbd-macro returns a string or a vector</span></div><div class='line' id='LC230'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; in both cases (elt x 0) is ok</span></div><div class='line' id='LC231'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">elt</span> <span class="p">(</span><span class="nf">read-kbd-macro</span> <span class="nv">prefix-key-val</span><span class="p">)</span> <span class="mi">0</span><span class="p">)))</span></div><div class='line' id='LC232'>&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">fboundp</span> <span class="ss">&#39;lua-prefix-key-update-bindings</span><span class="p">)</span></div><div class='line' id='LC233'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-prefix-key-update-bindings</span><span class="p">))</span></div><div class='line' id='LC234'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">message</span> <span class="s">&quot;prefix key set to %S&quot;</span>  <span class="p">(</span><span class="nf">single-key-description</span> <span class="p">(</span><span class="nb">eval </span><span class="nv">prefix-key-sym</span><span class="p">))))</span></div><div class='line' id='LC235'><br/></div><div class='line' id='LC236'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-prefix-key</span> <span class="s">&quot;\C-c&quot;</span></div><div class='line' id='LC237'>&nbsp;&nbsp;<span class="s">&quot;Prefix for all lua-mode commands.&quot;</span></div><div class='line' id='LC238'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="ss">&#39;string</span></div><div class='line' id='LC239'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span></div><div class='line' id='LC240'>&nbsp;&nbsp;<span class="nv">:set</span> <span class="ss">&#39;lua--customize-set-prefix-key</span></div><div class='line' id='LC241'>&nbsp;&nbsp;<span class="nv">:get</span> <span class="o">&#39;</span><span class="p">(</span><span class="k">lambda </span><span class="p">(</span><span class="nf">sym</span><span class="p">)</span></div><div class='line' id='LC242'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">val</span> <span class="p">(</span><span class="nb">eval </span><span class="nv">sym</span><span class="p">)))</span> <span class="p">(</span><span class="k">if </span><span class="nv">val</span> <span class="p">(</span><span class="nf">single-key-description</span> <span class="p">(</span><span class="nb">eval </span><span class="nv">sym</span><span class="p">))</span> <span class="s">&quot;&quot;</span><span class="p">))))</span></div><div class='line' id='LC243'><br/></div><div class='line' id='LC244'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-mode-menu</span> <span class="p">(</span><span class="nf">make-sparse-keymap</span> <span class="s">&quot;Lua&quot;</span><span class="p">)</span></div><div class='line' id='LC245'>&nbsp;&nbsp;<span class="s">&quot;Keymap for lua-mode&#39;s menu.&quot;</span><span class="p">)</span></div><div class='line' id='LC246'><br/></div><div class='line' id='LC247'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-prefix-mode-map</span></div><div class='line' id='LC248'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">eval-when-compile</span></div><div class='line' id='LC249'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">result-map</span> <span class="p">(</span><span class="nf">make-sparse-keymap</span><span class="p">)))</span></div><div class='line' id='LC250'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">mapc</span> <span class="p">(</span><span class="k">lambda </span><span class="p">(</span><span class="nf">key_defn</span><span class="p">)</span></div><div class='line' id='LC251'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">define-key</span> <span class="nv">result-map</span> <span class="p">(</span><span class="nf">read-kbd-macro</span> <span class="p">(</span><span class="nb">car </span><span class="nv">key_defn</span><span class="p">))</span> <span class="p">(</span><span class="nb">cdr </span><span class="nv">key_defn</span><span class="p">)))</span></div><div class='line' id='LC252'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">((</span><span class="s">&quot;C-l&quot;</span> <span class="o">.</span> <span class="nv">lua-send-buffer</span><span class="p">)</span></div><div class='line' id='LC253'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;C-f&quot;</span> <span class="o">.</span> <span class="nv">lua-search-documentation</span><span class="p">)</span></div><div class='line' id='LC254'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;C-;&quot;</span> <span class="o">.</span> <span class="nv">lua-mark-all-multiline-literals</span><span class="p">)))</span></div><div class='line' id='LC255'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">result-map</span><span class="p">))</span></div><div class='line' id='LC256'>&nbsp;&nbsp;<span class="s">&quot;Keymap that is used to define keys accessible by `lua-prefix-key&#39;.</span></div><div class='line' id='LC257'><br/></div><div class='line' id='LC258'><span class="s">If the latter is nil, the keymap translates into `lua-mode-map&#39; verbatim.&quot;</span><span class="p">)</span></div><div class='line' id='LC259'><br/></div><div class='line' id='LC260'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-mode-map</span></div><div class='line' id='LC261'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">result-map</span> <span class="p">(</span><span class="nf">make-sparse-keymap</span><span class="p">))</span></div><div class='line' id='LC262'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">prefix-key</span><span class="p">)</span></div><div class='line' id='LC263'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">mapc</span> <span class="p">(</span><span class="k">lambda </span><span class="p">(</span><span class="nf">key_defn</span><span class="p">)</span></div><div class='line' id='LC264'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">define-key</span> <span class="nv">result-map</span> <span class="p">(</span><span class="nf">read-kbd-macro</span> <span class="p">(</span><span class="nb">car </span><span class="nv">key_defn</span><span class="p">))</span> <span class="p">(</span><span class="nb">cdr </span><span class="nv">key_defn</span><span class="p">)))</span></div><div class='line' id='LC265'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; here go all the default bindings</span></div><div class='line' id='LC266'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; backquote enables evaluating certain symbols by comma</span></div><div class='line' id='LC267'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">`</span><span class="p">((</span><span class="s">&quot;}&quot;</span> <span class="o">.</span> <span class="nv">lua-electric-match</span><span class="p">)</span></div><div class='line' id='LC268'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;]&quot;</span> <span class="o">.</span> <span class="nv">lua-electric-match</span><span class="p">)</span></div><div class='line' id='LC269'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;)&quot;</span> <span class="o">.</span> <span class="nv">lua-electric-match</span><span class="p">)))</span></div><div class='line' id='LC270'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">define-key</span> <span class="nv">result-map</span> <span class="err">[</span><span class="nv">menu-bar</span> <span class="nv">lua-mode</span><span class="err">]</span> <span class="p">(</span><span class="nb">cons </span><span class="s">&quot;Lua&quot;</span> <span class="nv">lua-mode-menu</span><span class="p">))</span></div><div class='line' id='LC271'><br/></div><div class='line' id='LC272'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; FIXME: see if the declared logic actually works</span></div><div class='line' id='LC273'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; handle prefix-keyed bindings:</span></div><div class='line' id='LC274'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; * if no prefix, set prefix-map as parent, i.e.</span></div><div class='line' id='LC275'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;;      if key is not defined look it up in prefix-map</span></div><div class='line' id='LC276'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; * if prefix is set, bind the prefix-map to that key</span></div><div class='line' id='LC277'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">boundp</span> <span class="ss">&#39;lua-prefix-key</span><span class="p">)</span></div><div class='line' id='LC278'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">define-key</span> <span class="nv">result-map</span> <span class="p">(</span><span class="nb">vector </span><span class="nv">lua-prefix-key</span><span class="p">)</span> <span class="nv">lua-prefix-mode-map</span><span class="p">)</span></div><div class='line' id='LC279'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">set-keymap-parent</span> <span class="nv">result-map</span> <span class="nv">lua-prefix-mode-map</span><span class="p">))</span></div><div class='line' id='LC280'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">result-map</span><span class="p">)</span></div><div class='line' id='LC281'>&nbsp;&nbsp;<span class="s">&quot;Keymap used in lua-mode buffers.&quot;</span><span class="p">)</span></div><div class='line' id='LC282'><br/></div><div class='line' id='LC283'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-electric-flag</span> <span class="nv">t</span></div><div class='line' id='LC284'>&nbsp;&nbsp;<span class="s">&quot;If t, electric actions (like automatic reindentation) will happen when an electric</span></div><div class='line' id='LC285'><span class="s"> key like `{&#39; is pressed&quot;</span><span class="p">)</span></div><div class='line' id='LC286'><span class="p">(</span><span class="nf">make-variable-buffer-local</span> <span class="ss">&#39;lua-electric-flag</span><span class="p">)</span></div><div class='line' id='LC287'><br/></div><div class='line' id='LC288'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-prompt-regexp</span> <span class="s">&quot;[^\n]*\\(&gt;[\t ]+\\)+$&quot;</span></div><div class='line' id='LC289'>&nbsp;&nbsp;<span class="s">&quot;Regexp which matches the Lua program&#39;s prompt.&quot;</span></div><div class='line' id='LC290'>&nbsp;&nbsp;<span class="nv">:type</span>  <span class="ss">&#39;regexp</span></div><div class='line' id='LC291'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span><span class="p">)</span></div><div class='line' id='LC292'><br/></div><div class='line' id='LC293'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-traceback-line-re</span></div><div class='line' id='LC294'>&nbsp;&nbsp;<span class="s">&quot;^\\(?:[\t ]*\\|.*&gt;[\t ]+\\)\\([^\n\t ]+\\):\\([0-9]+\\):&quot;</span></div><div class='line' id='LC295'>&nbsp;&nbsp;<span class="s">&quot;Regular expression that describes tracebacks and errors.&quot;</span></div><div class='line' id='LC296'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="ss">&#39;regexp</span></div><div class='line' id='LC297'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span><span class="p">)</span></div><div class='line' id='LC298'><br/></div><div class='line' id='LC299'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-indent-string-contents</span> <span class="nv">nil</span></div><div class='line' id='LC300'>&nbsp;&nbsp;<span class="s">&quot;If non-nil, contents of multiline string will be indented.</span></div><div class='line' id='LC301'><span class="s">Otherwise leading amount of whitespace on each line is preserved.&quot;</span></div><div class='line' id='LC302'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span></div><div class='line' id='LC303'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="ss">&#39;boolean</span><span class="p">)</span></div><div class='line' id='LC304'><br/></div><div class='line' id='LC305'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-jump-on-traceback</span> <span class="nv">t</span></div><div class='line' id='LC306'>&nbsp;&nbsp;<span class="s">&quot;*Jump to innermost traceback location in *lua* buffer.  When this</span></div><div class='line' id='LC307'><span class="s">variable is non-nil and a traceback occurs when running Lua code in a</span></div><div class='line' id='LC308'><span class="s">subprocess, jump immediately to the source code of the innermost</span></div><div class='line' id='LC309'><span class="s">traceback location.&quot;</span></div><div class='line' id='LC310'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="ss">&#39;boolean</span></div><div class='line' id='LC311'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span><span class="p">)</span></div><div class='line' id='LC312'><br/></div><div class='line' id='LC313'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-mode-hook</span> <span class="nv">nil</span></div><div class='line' id='LC314'>&nbsp;&nbsp;<span class="s">&quot;Hooks called when Lua mode fires up.&quot;</span></div><div class='line' id='LC315'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="ss">&#39;hook</span></div><div class='line' id='LC316'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span><span class="p">)</span></div><div class='line' id='LC317'><br/></div><div class='line' id='LC318'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-region-start</span> <span class="p">(</span><span class="nf">make-marker</span><span class="p">)</span></div><div class='line' id='LC319'>&nbsp;&nbsp;<span class="s">&quot;Start of special region for Lua communication.&quot;</span><span class="p">)</span></div><div class='line' id='LC320'><br/></div><div class='line' id='LC321'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-region-end</span> <span class="p">(</span><span class="nf">make-marker</span><span class="p">)</span></div><div class='line' id='LC322'>&nbsp;&nbsp;<span class="s">&quot;End of special region for Lua communication.&quot;</span><span class="p">)</span></div><div class='line' id='LC323'><br/></div><div class='line' id='LC324'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-emacs-menu</span></div><div class='line' id='LC325'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="err">[</span><span class="s">&quot;Restart With Whole File&quot;</span> <span class="nv">lua-restart-with-whole-file</span> <span class="nv">t</span><span class="err">]</span></div><div class='line' id='LC326'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="err">[</span><span class="s">&quot;Kill Process&quot;</span> <span class="nv">lua-kill-process</span> <span class="nv">t</span><span class="err">]</span></div><div class='line' id='LC327'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="err">[</span><span class="s">&quot;Hide Process Buffer&quot;</span> <span class="nv">lua-hide-process-buffer</span> <span class="nv">t</span><span class="err">]</span></div><div class='line' id='LC328'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="err">[</span><span class="s">&quot;Show Process Buffer&quot;</span> <span class="nv">lua-show-process-buffer</span> <span class="nv">t</span><span class="err">]</span></div><div class='line' id='LC329'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="err">[</span><span class="s">&quot;Beginning Of Proc&quot;</span> <span class="nv">lua-beginning-of-proc</span> <span class="nv">t</span><span class="err">]</span></div><div class='line' id='LC330'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="err">[</span><span class="s">&quot;End Of Proc&quot;</span> <span class="nv">lua-end-of-proc</span> <span class="nv">t</span><span class="err">]</span></div><div class='line' id='LC331'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="err">[</span><span class="s">&quot;Set Lua-Region Start&quot;</span> <span class="nv">lua-set-lua-region-start</span> <span class="nv">t</span><span class="err">]</span></div><div class='line' id='LC332'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="err">[</span><span class="s">&quot;Set Lua-Region End&quot;</span> <span class="nv">lua-set-lua-region-end</span> <span class="nv">t</span><span class="err">]</span></div><div class='line' id='LC333'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="err">[</span><span class="s">&quot;Send Lua-Region&quot;</span> <span class="nv">lua-send-lua-region</span> <span class="nv">t</span><span class="err">]</span></div><div class='line' id='LC334'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="err">[</span><span class="s">&quot;Send Current Line&quot;</span> <span class="nv">lua-send-current-line</span> <span class="nv">t</span><span class="err">]</span></div><div class='line' id='LC335'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="err">[</span><span class="s">&quot;Send Region&quot;</span> <span class="nv">lua-send-region</span> <span class="nv">t</span><span class="err">]</span></div><div class='line' id='LC336'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="err">[</span><span class="s">&quot;Send Proc&quot;</span> <span class="nv">lua-send-proc</span> <span class="nv">t</span><span class="err">]</span></div><div class='line' id='LC337'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="err">[</span><span class="s">&quot;Send Buffer&quot;</span> <span class="nv">lua-send-buffer</span> <span class="nv">t</span><span class="err">]</span></div><div class='line' id='LC338'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="err">[</span><span class="s">&quot;Search Documentation&quot;</span> <span class="nv">lua-search-documentation</span> <span class="nv">t</span><span class="err">]</span><span class="p">)</span></div><div class='line' id='LC339'>&nbsp;&nbsp;<span class="s">&quot;Emacs menu for Lua mode.&quot;</span><span class="p">)</span></div><div class='line' id='LC340'><br/></div><div class='line' id='LC341'><span class="c1">;; the whole defconst is inside eval-when-compile, because it&#39;s later referenced</span></div><div class='line' id='LC342'><span class="c1">;; inside another eval-and-compile block</span></div><div class='line' id='LC343'><span class="p">(</span><span class="nf">eval-and-compile</span></div><div class='line' id='LC344'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">defconst</span></div><div class='line' id='LC345'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">lua--builtins</span></div><div class='line' id='LC346'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">let*</span></div><div class='line' id='LC347'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nf">modules</span></div><div class='line' id='LC348'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;_G&quot;</span> <span class="s">&quot;_VERSION&quot;</span> <span class="s">&quot;assert&quot;</span> <span class="s">&quot;collectgarbage&quot;</span> <span class="s">&quot;dofile&quot;</span> <span class="s">&quot;error&quot;</span> <span class="s">&quot;getfenv&quot;</span> <span class="s">&quot;getmetatable&quot;</span></div><div class='line' id='LC349'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;ipairs&quot;</span> <span class="s">&quot;load&quot;</span> <span class="s">&quot;loadfile&quot;</span> <span class="s">&quot;loadstring&quot;</span> <span class="s">&quot;module&quot;</span> <span class="s">&quot;next&quot;</span> <span class="s">&quot;pairs&quot;</span> <span class="s">&quot;pcall&quot;</span> <span class="s">&quot;print&quot;</span> </div><div class='line' id='LC350'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;rawequal&quot;</span> <span class="s">&quot;rawget&quot;</span> <span class="s">&quot;rawlen&quot;</span> <span class="s">&quot;rawset&quot;</span> <span class="s">&quot;require&quot;</span> <span class="s">&quot;select&quot;</span> <span class="s">&quot;setfenv&quot;</span> <span class="s">&quot;setmetatable&quot;</span></div><div class='line' id='LC351'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;tonumber&quot;</span> <span class="s">&quot;tostring&quot;</span> <span class="s">&quot;type&quot;</span> <span class="s">&quot;unpack&quot;</span> <span class="s">&quot;xpcall&quot;</span></div><div class='line' id='LC352'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;bit32&quot;</span> <span class="o">.</span> <span class="p">(</span><span class="s">&quot;arshift&quot;</span> <span class="s">&quot;band&quot;</span> <span class="s">&quot;bnot&quot;</span> <span class="s">&quot;bor&quot;</span> <span class="s">&quot;btest&quot;</span> <span class="s">&quot;bxor&quot;</span> <span class="s">&quot;extract&quot;</span> <span class="s">&quot;lrotate&quot;</span> <span class="s">&quot;lshift&quot;</span></div><div class='line' id='LC353'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;replace&quot;</span> <span class="s">&quot;rrotate&quot;</span> <span class="s">&quot;rshift&quot;</span><span class="p">))</span></div><div class='line' id='LC354'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;coroutine&quot;</span> <span class="o">.</span> <span class="p">(</span><span class="s">&quot;create&quot;</span> <span class="s">&quot;resume&quot;</span> <span class="s">&quot;running&quot;</span> <span class="s">&quot;status&quot;</span> <span class="s">&quot;wrap&quot;</span> <span class="s">&quot;yield&quot;</span><span class="p">))</span></div><div class='line' id='LC355'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;debug&quot;</span> <span class="o">.</span> <span class="p">(</span><span class="s">&quot;debug&quot;</span> <span class="s">&quot;getfenv&quot;</span> <span class="s">&quot;gethook&quot;</span> <span class="s">&quot;getinfo&quot;</span> <span class="s">&quot;getlocal&quot;</span> <span class="s">&quot;getmetatable&quot;</span> </div><div class='line' id='LC356'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;getregistry&quot;</span> <span class="s">&quot;getupvalue&quot;</span> <span class="s">&quot;getuservalue&quot;</span> <span class="s">&quot;setfenv&quot;</span> <span class="s">&quot;sethook&quot;</span> <span class="s">&quot;setlocal&quot;</span> </div><div class='line' id='LC357'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;setmetatable&quot;</span> <span class="s">&quot;setupvalue&quot;</span> <span class="s">&quot;setuservalue&quot;</span> <span class="s">&quot;traceback&quot;</span> <span class="s">&quot;upvalueid&quot;</span></div><div class='line' id='LC358'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;upvaluejoin&quot;</span><span class="p">))</span></div><div class='line' id='LC359'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;io&quot;</span> <span class="o">.</span> <span class="p">(</span><span class="s">&quot;close&quot;</span> <span class="s">&quot;flush&quot;</span> <span class="s">&quot;input&quot;</span> <span class="s">&quot;lines&quot;</span> <span class="s">&quot;open&quot;</span> <span class="s">&quot;output&quot;</span> <span class="s">&quot;popen&quot;</span> <span class="s">&quot;read&quot;</span> <span class="s">&quot;stderr&quot;</span> </div><div class='line' id='LC360'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;stdin&quot;</span> <span class="s">&quot;stdout&quot;</span> <span class="s">&quot;tmpfile&quot;</span> <span class="s">&quot;type&quot;</span> <span class="s">&quot;write&quot;</span><span class="p">))</span></div><div class='line' id='LC361'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;math&quot;</span> <span class="o">.</span> <span class="p">(</span><span class="s">&quot;abs&quot;</span> <span class="s">&quot;acos&quot;</span> <span class="s">&quot;asin&quot;</span> <span class="s">&quot;atan&quot;</span> <span class="s">&quot;atan2&quot;</span> <span class="s">&quot;ceil&quot;</span> <span class="s">&quot;cos&quot;</span> <span class="s">&quot;cosh&quot;</span> <span class="s">&quot;deg&quot;</span> <span class="s">&quot;exp&quot;</span> <span class="s">&quot;floor&quot;</span></div><div class='line' id='LC362'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;fmod&quot;</span> <span class="s">&quot;frexp&quot;</span> <span class="s">&quot;huge&quot;</span> <span class="s">&quot;ldexp&quot;</span> <span class="s">&quot;log&quot;</span> <span class="s">&quot;log10&quot;</span> <span class="s">&quot;max&quot;</span> <span class="s">&quot;min&quot;</span> <span class="s">&quot;modf&quot;</span> <span class="s">&quot;pi&quot;</span> <span class="s">&quot;pow&quot;</span></div><div class='line' id='LC363'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;rad&quot;</span> <span class="s">&quot;random&quot;</span> <span class="s">&quot;randomseed&quot;</span> <span class="s">&quot;sin&quot;</span> <span class="s">&quot;sinh&quot;</span> <span class="s">&quot;sqrt&quot;</span> <span class="s">&quot;tan&quot;</span> <span class="s">&quot;tanh&quot;</span><span class="p">))</span></div><div class='line' id='LC364'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;os&quot;</span> <span class="o">.</span> <span class="p">(</span><span class="s">&quot;clock&quot;</span> <span class="s">&quot;date&quot;</span> <span class="s">&quot;difftime&quot;</span> <span class="s">&quot;execute&quot;</span> <span class="s">&quot;exit&quot;</span> <span class="s">&quot;getenv&quot;</span> <span class="s">&quot;remove&quot;</span> <span class="s">&quot;rename&quot;</span></div><div class='line' id='LC365'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;setlocale&quot;</span> <span class="s">&quot;time&quot;</span> <span class="s">&quot;tmpname&quot;</span><span class="p">))</span></div><div class='line' id='LC366'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;package&quot;</span> <span class="o">.</span> <span class="p">(</span><span class="s">&quot;config&quot;</span> <span class="s">&quot;cpath&quot;</span> <span class="s">&quot;loaded&quot;</span> <span class="s">&quot;loaders&quot;</span> <span class="s">&quot;loadlib&quot;</span> <span class="s">&quot;path&quot;</span> <span class="s">&quot;preload&quot;</span></div><div class='line' id='LC367'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;searchers&quot;</span> <span class="s">&quot;searchpath&quot;</span> <span class="s">&quot;seeall&quot;</span><span class="p">))</span></div><div class='line' id='LC368'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;string&quot;</span> <span class="o">.</span> <span class="p">(</span><span class="s">&quot;byte&quot;</span> <span class="s">&quot;char&quot;</span> <span class="s">&quot;dump&quot;</span> <span class="s">&quot;find&quot;</span> <span class="s">&quot;format&quot;</span> <span class="s">&quot;gmatch&quot;</span> <span class="s">&quot;gsub&quot;</span> <span class="s">&quot;len&quot;</span> <span class="s">&quot;lower&quot;</span></div><div class='line' id='LC369'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;match&quot;</span> <span class="s">&quot;rep&quot;</span> <span class="s">&quot;reverse&quot;</span> <span class="s">&quot;sub&quot;</span> <span class="s">&quot;upper&quot;</span><span class="p">))</span></div><div class='line' id='LC370'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;table&quot;</span> <span class="o">.</span> <span class="p">(</span><span class="s">&quot;concat&quot;</span> <span class="s">&quot;insert&quot;</span> <span class="s">&quot;maxn&quot;</span> <span class="s">&quot;pack&quot;</span> <span class="s">&quot;remove&quot;</span> <span class="s">&quot;sort&quot;</span> <span class="s">&quot;unpack&quot;</span><span class="p">)))))</span></div><div class='line' id='LC371'><br/></div><div class='line' id='LC372'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; This code uses \\&lt; and \\&gt; to delimit builtin symbols instead of</span></div><div class='line' id='LC373'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; \\_&lt; and \\_&gt;, because -- a necessity -- &#39;.&#39; syntax class is hacked</span></div><div class='line' id='LC374'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; to &#39;symbol&#39; and \\_&gt; won&#39;t detect a symbol boundary in &#39;foo.bar&#39; and</span></div><div class='line' id='LC375'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; -- sufficiency -- conveniently, underscore &#39;_&#39; is hacked to count as</span></div><div class='line' id='LC376'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; word constituent, but only for font-locking. Neither of these hacks</span></div><div class='line' id='LC377'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; makes sense to me, I&#39;m going to wipe them out as soon as I&#39;m sure</span></div><div class='line' id='LC378'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; that indentation won&#39;t get hurt. --immerrr</span></div><div class='line' id='LC379'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;;</span></div><div class='line' id='LC380'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua--cl-labels</span></div><div class='line' id='LC381'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nf">module-name-re</span> <span class="p">(</span><span class="nf">x</span><span class="p">)</span></div><div class='line' id='LC382'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">concat</span> <span class="s">&quot;\\(?1:\\&lt;&quot;</span></div><div class='line' id='LC383'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">listp</span> <span class="nv">x</span><span class="p">)</span> <span class="p">(</span><span class="nb">car </span><span class="nv">x</span><span class="p">)</span> <span class="nv">x</span><span class="p">)</span></div><div class='line' id='LC384'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\&gt;\\)&quot;</span><span class="p">))</span></div><div class='line' id='LC385'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">module-members-re</span> <span class="p">(</span><span class="nf">x</span><span class="p">)</span> <span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">listp</span> <span class="nv">x</span><span class="p">)</span></div><div class='line' id='LC386'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">concat</span> <span class="s">&quot;\\(?:[ \t]*\\.[ \t]*&quot;</span></div><div class='line' id='LC387'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\&lt;\\(?2:&quot;</span></div><div class='line' id='LC388'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">regexp-opt</span> <span class="p">(</span><span class="nb">cdr </span><span class="nv">x</span><span class="p">))</span></div><div class='line' id='LC389'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\)\\&gt;\\)?&quot;</span><span class="p">)</span></div><div class='line' id='LC390'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;&quot;</span><span class="p">)))</span></div><div class='line' id='LC391'><br/></div><div class='line' id='LC392'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">concat</span></div><div class='line' id='LC393'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; common prefix - beginning-of-line or neither of [ &#39;.&#39;, &#39;:&#39; ] to</span></div><div class='line' id='LC394'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; exclude &quot;foo.string.rep&quot;</span></div><div class='line' id='LC395'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\(?:\\`\\|[^:. \n\t]\\)&quot;</span></div><div class='line' id='LC396'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; optional whitespace</span></div><div class='line' id='LC397'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;[ \n\t]*&quot;</span></div><div class='line' id='LC398'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\(?:&quot;</span></div><div class='line' id='LC399'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; any of modules/functions</span></div><div class='line' id='LC400'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">mapconcat</span> <span class="p">(</span><span class="k">lambda </span><span class="p">(</span><span class="nf">x</span><span class="p">)</span> <span class="p">(</span><span class="nf">concat</span> <span class="p">(</span><span class="nf">module-name-re</span> <span class="nv">x</span><span class="p">)</span></div><div class='line' id='LC401'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">module-members-re</span> <span class="nv">x</span><span class="p">)))</span></div><div class='line' id='LC402'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">modules</span></div><div class='line' id='LC403'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\|&quot;</span><span class="p">)</span></div><div class='line' id='LC404'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\)&quot;</span><span class="p">))))</span></div><div class='line' id='LC405'><br/></div><div class='line' id='LC406'>&nbsp;&nbsp;<span class="s">&quot;A regexp that matches lua builtin functions &amp; variables.</span></div><div class='line' id='LC407'><br/></div><div class='line' id='LC408'><span class="s">This is a compilation of 5.1 and 5.2 builtins taken from the</span></div><div class='line' id='LC409'><span class="s">index of respective Lua reference manuals.&quot;</span><span class="p">)</span></div><div class='line' id='LC410'><br/></div><div class='line' id='LC411'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-font-lock-keywords</span></div><div class='line' id='LC412'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">eval-when-compile</span></div><div class='line' id='LC413'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">list</span></div><div class='line' id='LC414'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; highlight the hash-bang line &quot;#!/foo/bar/lua&quot; as comment</span></div><div class='line' id='LC415'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;^#!.*$&quot;</span> <span class="o">.</span> <span class="nv">font-lock-comment-face</span><span class="p">)</span></div><div class='line' id='LC416'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Handle variable names</span></div><div class='line' id='LC417'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;;  local blalba =</span></div><div class='line' id='LC418'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;;        ^^^^^^</span></div><div class='line' id='LC419'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;\\(local[ \t]+\\(\\sw+\\)[ \t]*=\\)&quot;</span></div><div class='line' id='LC420'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="mi">2</span> <span class="nv">font-lock-variable-name-face</span><span class="p">))</span></div><div class='line' id='LC421'><br/></div><div class='line' id='LC422'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Function name declarations.</span></div><div class='line' id='LC423'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;^[ \t]*\\_&lt;\\(\\(local[ \t]+\\)?function\\)\\_&gt;[ \t]+\\(\\(\\sw:\\|\\sw\\.\\|\\sw_\\|\\sw\\)+\\)&quot;</span></div><div class='line' id='LC424'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="mi">1</span> <span class="nv">font-lock-keyword-face</span><span class="p">)</span> <span class="p">(</span><span class="mi">3</span> <span class="nv">font-lock-function-name-face</span> <span class="nv">nil</span> <span class="nv">t</span><span class="p">))</span></div><div class='line' id='LC425'><br/></div><div class='line' id='LC426'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Highlight lua builtin functions and variables</span></div><div class='line' id='LC427'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">`</span><span class="p">(</span><span class="o">,</span><span class="nv">lua--builtins</span></div><div class='line' id='LC428'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="mi">1</span> <span class="nv">font-lock-builtin-face</span><span class="p">)</span> <span class="p">(</span><span class="mi">2</span> <span class="nv">font-lock-builtin-face</span> <span class="nv">nil</span> <span class="nv">noerror</span><span class="p">))</span></div><div class='line' id='LC429'><br/></div><div class='line' id='LC430'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Handle function names in assignments</span></div><div class='line' id='LC431'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;\\(\\(\\sw:\\|\\sw\\.\\|\\sw_\\|\\sw\\)+\\)[ \t]*=[ \t]*\\(function\\)\\_&gt;&quot;</span></div><div class='line' id='LC432'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="mi">1</span> <span class="nv">font-lock-function-name-face</span> <span class="nv">nil</span> <span class="nv">t</span><span class="p">)</span> <span class="p">(</span><span class="mi">3</span> <span class="nv">font-lock-keyword-face</span><span class="p">))</span></div><div class='line' id='LC433'><br/></div><div class='line' id='LC434'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; octal numbers</span></div><div class='line' id='LC435'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;\\_&lt;0x[[:xdigit:]]+\\_&gt;&quot;</span> <span class="o">.</span> <span class="nv">font-lock-constant-face</span><span class="p">)</span></div><div class='line' id='LC436'><br/></div><div class='line' id='LC437'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; regular numbers</span></div><div class='line' id='LC438'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;;</span></div><div class='line' id='LC439'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; This regexp relies on &#39;.&#39; being symbol constituent. Whenever this</span></div><div class='line' id='LC440'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; changes, the regexp needs revisiting --immerrr</span></div><div class='line' id='LC441'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">`</span><span class="p">(</span><span class="o">,</span><span class="p">(</span><span class="nf">concat</span> <span class="s">&quot;\\_&lt;\\(?1:&quot;</span></div><div class='line' id='LC442'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; make a digit on either side of dot mandatory</span></div><div class='line' id='LC443'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\(?:[0-9]+\\.?[0-9]*\\|[0-9]*\\.?[0-9]+\\)&quot;</span></div><div class='line' id='LC444'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\(?:[eE][+-]?[0-9]+\\)?&quot;</span></div><div class='line' id='LC445'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\)\\_&gt;&quot;</span><span class="p">)</span></div><div class='line' id='LC446'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">.</span> <span class="nv">font-lock-constant-face</span><span class="p">)</span></div><div class='line' id='LC447'><br/></div><div class='line' id='LC448'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Keywords.</span></div><div class='line' id='LC449'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">concat</span> <span class="s">&quot;\\_&lt;&quot;</span></div><div class='line' id='LC450'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">regexp-opt</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;and&quot;</span> <span class="s">&quot;break&quot;</span> <span class="s">&quot;do&quot;</span> <span class="s">&quot;else&quot;</span> <span class="s">&quot;elseif&quot;</span> <span class="s">&quot;end&quot;</span> <span class="s">&quot;false&quot;</span></div><div class='line' id='LC451'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;for&quot;</span> <span class="s">&quot;function&quot;</span> <span class="s">&quot;if&quot;</span> <span class="s">&quot;in&quot;</span> <span class="s">&quot;local&quot;</span> <span class="s">&quot;nil&quot;</span> <span class="s">&quot;not&quot;</span></div><div class='line' id='LC452'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;or&quot;</span> <span class="s">&quot;repeat&quot;</span> <span class="s">&quot;return&quot;</span> <span class="s">&quot;then&quot;</span> <span class="s">&quot;true&quot;</span> <span class="s">&quot;until&quot;</span></div><div class='line' id='LC453'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;while&quot;</span><span class="p">)</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC454'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\_&gt;&quot;</span><span class="p">)</span></div><div class='line' id='LC455'><br/></div><div class='line' id='LC456'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;Default expressions to highlight in Lua mode.&quot;</span><span class="p">)))</span></div><div class='line' id='LC457'><br/></div><div class='line' id='LC458'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-imenu-generic-expression</span></div><div class='line' id='LC459'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">((</span><span class="nf">nil</span> <span class="s">&quot;^[ \t]*\\(?:local[ \t]+\\)?function[ \t]+\\(\\(\\sw:\\|\\sw_\\|\\sw\\.\\|\\sw\\)+\\)&quot;</span> <span class="mi">1</span><span class="p">))</span></div><div class='line' id='LC460'>&nbsp;&nbsp;<span class="s">&quot;Imenu generic expression for lua-mode.  See `imenu-generic-expression&#39;.&quot;</span><span class="p">)</span></div><div class='line' id='LC461'><br/></div><div class='line' id='LC462'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-sexp-alist</span> <span class="o">&#39;</span><span class="p">((</span><span class="s">&quot;then&quot;</span> <span class="o">.</span> <span class="s">&quot;end&quot;</span><span class="p">)</span></div><div class='line' id='LC463'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;function&quot;</span> <span class="o">.</span> <span class="s">&quot;end&quot;</span><span class="p">)</span></div><div class='line' id='LC464'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;do&quot;</span> <span class="o">.</span> <span class="s">&quot;end&quot;</span><span class="p">)))</span></div><div class='line' id='LC465'><br/></div><div class='line' id='LC466'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-mode-abbrev-table</span> <span class="nv">nil</span></div><div class='line' id='LC467'>&nbsp;&nbsp;<span class="s">&quot;Abbreviation table used in lua-mode buffers.&quot;</span><span class="p">)</span></div><div class='line' id='LC468'><br/></div><div class='line' id='LC469'><span class="p">(</span><span class="nf">define-abbrev-table</span> <span class="ss">&#39;lua-mode-abbrev-table</span></div><div class='line' id='LC470'>&nbsp;&nbsp;<span class="c1">;; Emacs 23 introduced :system property that prevents abbrev</span></div><div class='line' id='LC471'>&nbsp;&nbsp;<span class="c1">;; entries from being written to file specified by abbrev-file-name</span></div><div class='line' id='LC472'>&nbsp;&nbsp;<span class="c1">;;</span></div><div class='line' id='LC473'>&nbsp;&nbsp;<span class="c1">;; Emacs 22 and earlier had this functionality implemented</span></div><div class='line' id='LC474'>&nbsp;&nbsp;<span class="c1">;; by simple nil/non-nil flag as positional parameter</span></div><div class='line' id='LC475'>&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nb">&gt;= </span><span class="nv">emacs-major-version</span> <span class="mi">23</span><span class="p">)</span></div><div class='line' id='LC476'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">((</span><span class="s">&quot;end&quot;</span>    <span class="s">&quot;end&quot;</span>    <span class="nv">lua-indent-line</span> <span class="nv">:system</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC477'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;else&quot;</span>   <span class="s">&quot;else&quot;</span>   <span class="nv">lua-indent-line</span> <span class="nv">:system</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC478'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;elseif&quot;</span> <span class="s">&quot;elseif&quot;</span> <span class="nv">lua-indent-line</span> <span class="nv">:system</span> <span class="nv">t</span><span class="p">))</span></div><div class='line' id='LC479'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">((</span><span class="s">&quot;end&quot;</span>    <span class="s">&quot;end&quot;</span>      <span class="nv">lua-indent-line</span> <span class="nv">nil</span> <span class="ss">&#39;system</span><span class="p">)</span></div><div class='line' id='LC480'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;else&quot;</span>   <span class="s">&quot;else&quot;</span>     <span class="nv">lua-indent-line</span> <span class="nv">nil</span> <span class="ss">&#39;system</span><span class="p">)</span></div><div class='line' id='LC481'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;elseif&quot;</span> <span class="s">&quot;elseif&quot;</span>   <span class="nv">lua-indent-line</span> <span class="nv">nil</span> <span class="ss">&#39;system</span><span class="p">))))</span></div><div class='line' id='LC482'><br/></div><div class='line' id='LC483'><span class="p">(</span><span class="nf">eval-and-compile</span></div><div class='line' id='LC484'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">defalias</span> <span class="ss">&#39;lua-make-temp-file</span></div><div class='line' id='LC485'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">fboundp</span> <span class="ss">&#39;make-temp-file</span><span class="p">)</span></div><div class='line' id='LC486'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="ss">&#39;make-temp-file</span></div><div class='line' id='LC487'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">lambda </span><span class="p">(</span><span class="nf">prefix</span> <span class="nv">&amp;optional</span> <span class="nv">dir-flag</span><span class="p">)</span> <span class="c1">;; Simple implementation</span></div><div class='line' id='LC488'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">expand-file-name</span></div><div class='line' id='LC489'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">make-temp-name</span> <span class="nv">prefix</span><span class="p">)</span></div><div class='line' id='LC490'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">fboundp</span> <span class="ss">&#39;temp-directory</span><span class="p">)</span></div><div class='line' id='LC491'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">temp-directory</span><span class="p">)</span></div><div class='line' id='LC492'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">temporary-file-directory</span><span class="p">))))))</span></div><div class='line' id='LC493'><br/></div><div class='line' id='LC494'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-mode-syntax-table</span></div><div class='line' id='LC495'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">with-syntax-table</span> <span class="p">(</span><span class="nf">copy-syntax-table</span><span class="p">)</span></div><div class='line' id='LC496'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">modify-syntax-entry</span> <span class="nv">?+</span> <span class="s">&quot;.&quot;</span><span class="p">)</span></div><div class='line' id='LC497'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">modify-syntax-entry</span> <span class="nv">?-</span> <span class="s">&quot;. 12&quot;</span><span class="p">)</span></div><div class='line' id='LC498'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">modify-syntax-entry</span> <span class="nv">?*</span> <span class="s">&quot;.&quot;</span><span class="p">)</span></div><div class='line' id='LC499'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">modify-syntax-entry</span> <span class="nv">?/</span> <span class="s">&quot;.&quot;</span><span class="p">)</span></div><div class='line' id='LC500'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">modify-syntax-entry</span> <span class="nv">?^</span> <span class="s">&quot;.&quot;</span><span class="p">)</span></div><div class='line' id='LC501'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; This might be better as punctuation, as for C, but this way you</span></div><div class='line' id='LC502'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; can treat table index as symbol.</span></div><div class='line' id='LC503'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">modify-syntax-entry</span> <span class="nv">?</span><span class="o">.</span> <span class="s">&quot;_&quot;</span><span class="p">)</span>        <span class="c1">; e.g. `io.string&#39;</span></div><div class='line' id='LC504'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">modify-syntax-entry</span> <span class="nv">?&gt;</span> <span class="s">&quot;.&quot;</span><span class="p">)</span></div><div class='line' id='LC505'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">modify-syntax-entry</span> <span class="nv">?&lt;</span> <span class="s">&quot;.&quot;</span><span class="p">)</span></div><div class='line' id='LC506'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">modify-syntax-entry</span> <span class="nv">?=</span> <span class="s">&quot;.&quot;</span><span class="p">)</span></div><div class='line' id='LC507'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">modify-syntax-entry</span> <span class="nv">?~</span> <span class="s">&quot;.&quot;</span><span class="p">)</span></div><div class='line' id='LC508'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">modify-syntax-entry</span> <span class="nv">?</span><span class="err">\</span><span class="nv">n</span> <span class="s">&quot;&gt;&quot;</span><span class="p">)</span></div><div class='line' id='LC509'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">modify-syntax-entry</span> <span class="nv">?</span><span class="err">\</span><span class="o">&#39;</span> <span class="s">&quot;\&quot;&quot;</span><span class="p">)</span></div><div class='line' id='LC510'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">modify-syntax-entry</span> <span class="nv">?</span><span class="err">\</span><span class="s">&quot; &quot;</span><span class="err">\</span><span class="s">&quot;&quot;</span><span class="p">)</span></div><div class='line' id='LC511'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">syntax-table</span><span class="p">))</span></div><div class='line' id='LC512'>&nbsp;&nbsp;<span class="s">&quot;Syntax table used while in `lua-mode&#39;.&quot;</span><span class="p">)</span></div><div class='line' id='LC513'><br/></div><div class='line' id='LC514'><span class="c1">;;;###autoload</span></div><div class='line' id='LC515'><span class="p">(</span><span class="nf">define-derived-mode</span> <span class="nv">lua-mode</span> <span class="nv">lua--prog-mode</span> <span class="s">&quot;Lua&quot;</span></div><div class='line' id='LC516'>&nbsp;&nbsp;<span class="s">&quot;Major mode for editing Lua code.&quot;</span></div><div class='line' id='LC517'>&nbsp;&nbsp;<span class="nv">:abbrev-table</span> <span class="nv">lua-mode-abbrev-table</span></div><div class='line' id='LC518'>&nbsp;&nbsp;<span class="nv">:syntax-table</span> <span class="nv">lua-mode-syntax-table</span></div><div class='line' id='LC519'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span></div><div class='line' id='LC520'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">switches</span> <span class="nv">nil</span><span class="p">)</span></div><div class='line' id='LC521'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">s</span><span class="p">)</span></div><div class='line' id='LC522'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">comint-prompt-regexp</span> <span class="nv">lua-prompt-regexp</span><span class="p">)</span></div><div class='line' id='LC523'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">make-local-variable</span> <span class="ss">&#39;lua-default-command-switches</span><span class="p">)</span></div><div class='line' id='LC524'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">set</span> <span class="p">(</span><span class="nf">make-local-variable</span> <span class="ss">&#39;beginning-of-defun-function</span><span class="p">)</span></div><div class='line' id='LC525'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="ss">&#39;lua-beginning-of-proc</span><span class="p">)</span></div><div class='line' id='LC526'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">set</span> <span class="p">(</span><span class="nf">make-local-variable</span> <span class="ss">&#39;end-of-defun-function</span><span class="p">)</span> <span class="ss">&#39;lua-end-of-proc</span><span class="p">)</span></div><div class='line' id='LC527'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">set</span> <span class="p">(</span><span class="nf">make-local-variable</span> <span class="ss">&#39;indent-line-function</span><span class="p">)</span> <span class="ss">&#39;lua-indent-line</span><span class="p">)</span></div><div class='line' id='LC528'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">set</span> <span class="p">(</span><span class="nf">make-local-variable</span> <span class="ss">&#39;comment-start</span><span class="p">)</span> <span class="nv">lua-comment-start</span><span class="p">)</span></div><div class='line' id='LC529'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">set</span> <span class="p">(</span><span class="nf">make-local-variable</span> <span class="ss">&#39;comment-start-skip</span><span class="p">)</span> <span class="nv">lua-comment-start-skip</span><span class="p">)</span></div><div class='line' id='LC530'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">set</span> <span class="p">(</span><span class="nf">make-local-variable</span> <span class="ss">&#39;font-lock-defaults</span><span class="p">)</span></div><div class='line' id='LC531'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="nv">lua-font-lock-keywords</span></div><div class='line' id='LC532'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">nil</span> <span class="nv">nil</span> <span class="p">((</span><span class="nf">?_</span> <span class="o">.</span> <span class="s">&quot;w&quot;</span><span class="p">))))</span></div><div class='line' id='LC533'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">set</span> <span class="p">(</span><span class="nf">make-local-variable</span> <span class="ss">&#39;imenu-generic-expression</span><span class="p">)</span></div><div class='line' id='LC534'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">lua-imenu-generic-expression</span><span class="p">)</span></div><div class='line' id='LC535'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">make-local-variable</span> <span class="ss">&#39;lua-default-eval</span><span class="p">)</span></div><div class='line' id='LC536'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; setup menu bar entry (XEmacs style)</span></div><div class='line' id='LC537'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nf">featurep</span> <span class="ss">&#39;menubar</span><span class="p">)</span></div><div class='line' id='LC538'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">boundp</span> <span class="ss">&#39;current-menubar</span><span class="p">)</span></div><div class='line' id='LC539'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">fboundp</span> <span class="ss">&#39;set-buffer-menubar</span><span class="p">)</span></div><div class='line' id='LC540'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">fboundp</span> <span class="ss">&#39;add-menu</span><span class="p">)</span></div><div class='line' id='LC541'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">not </span><span class="p">(</span><span class="nb">assoc </span><span class="s">&quot;Lua&quot;</span> <span class="nv">current-menubar</span><span class="p">)))</span></div><div class='line' id='LC542'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">progn</span></div><div class='line' id='LC543'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">set-buffer-menubar</span> <span class="p">(</span><span class="nf">copy-sequence</span> <span class="nv">current-menubar</span><span class="p">))</span></div><div class='line' id='LC544'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">add-menu</span> <span class="nv">nil</span> <span class="s">&quot;Lua&quot;</span> <span class="nv">lua-emacs-menu</span><span class="p">)))</span></div><div class='line' id='LC545'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Append Lua menu to popup menu for Emacs.</span></div><div class='line' id='LC546'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">boundp</span> <span class="ss">&#39;mode-popup-menu</span><span class="p">)</span></div><div class='line' id='LC547'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">mode-popup-menu</span></div><div class='line' id='LC548'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="p">(</span><span class="nf">concat</span> <span class="nv">mode-name</span> <span class="s">&quot; Mode Commands&quot;</span><span class="p">)</span> <span class="nv">lua-emacs-menu</span><span class="p">)))</span></div><div class='line' id='LC549'><br/></div><div class='line' id='LC550'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; hideshow setup</span></div><div class='line' id='LC551'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">unless</span> <span class="p">(</span><span class="nb">assq </span><span class="ss">&#39;lua-mode</span> <span class="nv">hs-special-modes-alist</span><span class="p">)</span></div><div class='line' id='LC552'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">add-to-list</span> <span class="ss">&#39;hs-special-modes-alist</span></div><div class='line' id='LC553'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">`</span><span class="p">(</span><span class="nf">lua-mode</span></div><div class='line' id='LC554'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">,</span><span class="p">(</span><span class="nf">regexp-opt</span> <span class="p">(</span><span class="nf">mapcar</span> <span class="ss">&#39;car</span> <span class="nv">lua-sexp-alist</span><span class="p">)</span> <span class="ss">&#39;words</span><span class="p">)</span> <span class="c1">;start</span></div><div class='line' id='LC555'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">,</span><span class="p">(</span><span class="nf">regexp-opt</span> <span class="p">(</span><span class="nf">mapcar</span> <span class="ss">&#39;cdr</span> <span class="nv">lua-sexp-alist</span><span class="p">)</span> <span class="ss">&#39;words</span><span class="p">)</span> <span class="c1">;end</span></div><div class='line' id='LC556'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">nil</span> <span class="nv">lua-forward-sexp</span><span class="p">)))</span></div><div class='line' id='LC557'><br/></div><div class='line' id='LC558'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">set</span> <span class="p">(</span><span class="nf">make-local-variable</span> <span class="ss">&#39;parse-sexp-lookup-properties</span><span class="p">)</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC559'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-mark-all-multiline-literals</span><span class="p">)</span></div><div class='line' id='LC560'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua--automark-multiline-update-timer</span><span class="p">)))</span></div><div class='line' id='LC561'><br/></div><div class='line' id='LC562'><span class="c1">;;;###autoload</span></div><div class='line' id='LC563'><span class="p">(</span><span class="nf">add-to-list</span> <span class="ss">&#39;auto-mode-alist</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;\\.lua$&quot;</span> <span class="o">.</span> <span class="nv">lua-mode</span><span class="p">))</span></div><div class='line' id='LC564'><br/></div><div class='line' id='LC565'><span class="c1">;;;###autoload</span></div><div class='line' id='LC566'><span class="p">(</span><span class="nf">add-to-list</span> <span class="ss">&#39;interpreter-mode-alist</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;lua&quot;</span> <span class="o">.</span> <span class="nv">lua-mode</span><span class="p">))</span></div><div class='line' id='LC567'><br/></div><div class='line' id='LC568'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-electric-match</span> <span class="p">(</span><span class="nf">arg</span><span class="p">)</span></div><div class='line' id='LC569'>&nbsp;&nbsp;<span class="s">&quot;Insert character and adjust indentation.&quot;</span></div><div class='line' id='LC570'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span> <span class="s">&quot;P&quot;</span><span class="p">)</span></div><div class='line' id='LC571'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">insert-char</span> <span class="nv">last-command-event</span> <span class="p">(</span><span class="nf">prefix-numeric-value</span> <span class="nv">arg</span><span class="p">))</span></div><div class='line' id='LC572'>&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">lua-electric-flag</span></div><div class='line' id='LC573'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-indent-line</span><span class="p">))</span></div><div class='line' id='LC574'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">blink-matching-open</span><span class="p">))</span></div><div class='line' id='LC575'><br/></div><div class='line' id='LC576'><span class="c1">;; private functions</span></div><div class='line' id='LC577'><br/></div><div class='line' id='LC578'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-prefix-key-update-bindings</span> <span class="p">()</span></div><div class='line' id='LC579'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">(</span><span class="nf">old-cons</span><span class="p">)</span></div><div class='line' id='LC580'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">eq</span> <span class="nv">lua-prefix-mode-map</span> <span class="p">(</span><span class="nf">keymap-parent</span> <span class="nv">lua-mode-map</span><span class="p">))</span></div><div class='line' id='LC581'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; if prefix-map is a parent, delete the parent</span></div><div class='line' id='LC582'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">set-keymap-parent</span> <span class="nv">lua-mode-map</span> <span class="nv">nil</span><span class="p">)</span></div><div class='line' id='LC583'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; otherwise, look for it among children</span></div><div class='line' id='LC584'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">setq</span> <span class="nv">old-cons</span> <span class="p">(</span><span class="nf">rassoc</span> <span class="nv">lua-prefix-mode-map</span> <span class="nv">lua-mode-map</span><span class="p">))</span></div><div class='line' id='LC585'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">delq</span> <span class="nv">old-cons</span> <span class="nv">lua-mode-map</span><span class="p">)))</span></div><div class='line' id='LC586'><br/></div><div class='line' id='LC587'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">null</span> <span class="nv">lua-prefix-key</span><span class="p">)</span></div><div class='line' id='LC588'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">set-keymap-parent</span> <span class="nv">lua-mode-map</span> <span class="nv">lua-prefix-mode-map</span><span class="p">)</span></div><div class='line' id='LC589'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-map</span> <span class="p">(</span><span class="nb">vector </span><span class="nv">lua-prefix-key</span><span class="p">)</span> <span class="nv">lua-prefix-mode-map</span><span class="p">))))</span></div><div class='line' id='LC590'><br/></div><div class='line' id='LC591'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-set-prefix-key</span> <span class="p">(</span><span class="nf">new-key-str</span><span class="p">)</span></div><div class='line' id='LC592'>&nbsp;&nbsp;<span class="s">&quot;Changes `lua-prefix-key&#39; properly and updates keymaps</span></div><div class='line' id='LC593'><br/></div><div class='line' id='LC594'><span class="s">This function replaces previous prefix-key binding with a new one.&quot;</span></div><div class='line' id='LC595'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span> <span class="s">&quot;sNew prefix key (empty string means no key): &quot;</span><span class="p">)</span></div><div class='line' id='LC596'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua--customize-set-prefix-key</span> <span class="ss">&#39;lua-prefix-key</span> <span class="nv">new-key-str</span><span class="p">)</span></div><div class='line' id='LC597'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-prefix-key-update-bindings</span><span class="p">))</span></div><div class='line' id='LC598'><br/></div><div class='line' id='LC599'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-string-p</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">pos</span><span class="p">)</span></div><div class='line' id='LC600'>&nbsp;&nbsp;<span class="s">&quot;Returns true if the point is in a string.&quot;</span></div><div class='line' id='LC601'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span> <span class="p">(</span><span class="nf">elt</span> <span class="p">(</span><span class="nf">syntax-ppss</span> <span class="nv">pos</span><span class="p">)</span> <span class="mi">3</span><span class="p">)))</span></div><div class='line' id='LC602'><br/></div><div class='line' id='LC603'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-comment-p</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">pos</span><span class="p">)</span></div><div class='line' id='LC604'>&nbsp;&nbsp;<span class="s">&quot;Returns true if the point is in a comment.&quot;</span></div><div class='line' id='LC605'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span> <span class="p">(</span><span class="nf">elt</span> <span class="p">(</span><span class="nf">syntax-ppss</span> <span class="nv">pos</span><span class="p">)</span> <span class="mi">4</span><span class="p">)))</span></div><div class='line' id='LC606'><br/></div><div class='line' id='LC607'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-comment-or-string-p</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">pos</span><span class="p">)</span></div><div class='line' id='LC608'>&nbsp;&nbsp;<span class="s">&quot;Returns true if the point is in a comment or string.&quot;</span></div><div class='line' id='LC609'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span> <span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">parse-result</span> <span class="p">(</span><span class="nf">syntax-ppss</span> <span class="nv">pos</span><span class="p">)))</span></div><div class='line' id='LC610'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="nf">elt</span> <span class="nv">parse-result</span> <span class="mi">3</span><span class="p">)</span> <span class="p">(</span><span class="nf">elt</span> <span class="nv">parse-result</span> <span class="mi">4</span><span class="p">)))))</span></div><div class='line' id='LC611'><br/></div><div class='line' id='LC612'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-comment-or-string-start</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">pos</span><span class="p">)</span></div><div class='line' id='LC613'>&nbsp;&nbsp;<span class="s">&quot;Returns start position of string or comment which contains point.</span></div><div class='line' id='LC614'><br/></div><div class='line' id='LC615'><span class="s">If point is not inside string or comment, return nil.&quot;</span></div><div class='line' id='LC616'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span> <span class="p">(</span><span class="nf">elt</span> <span class="p">(</span><span class="nf">syntax-ppss</span> <span class="nv">pos</span><span class="p">)</span> <span class="mi">8</span><span class="p">)))</span></div><div class='line' id='LC617'><br/></div><div class='line' id='LC618'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-indent-line</span> <span class="p">()</span></div><div class='line' id='LC619'>&nbsp;&nbsp;<span class="s">&quot;Indent current line for Lua mode.</span></div><div class='line' id='LC620'><span class="s">Return the amount the indentation changed by.&quot;</span></div><div class='line' id='LC621'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">(</span><span class="nf">indent</span></div><div class='line' id='LC622'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">case-fold-search</span> <span class="nv">nil</span><span class="p">)</span></div><div class='line' id='LC623'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; save point as a distance to eob - it&#39;s invariant w.r.t indentation</span></div><div class='line' id='LC624'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">pos</span> <span class="p">(</span><span class="nb">- </span><span class="p">(</span><span class="nf">point-max</span><span class="p">)</span> <span class="p">(</span><span class="nf">point</span><span class="p">))))</span></div><div class='line' id='LC625'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">back-to-indentation</span><span class="p">)</span></div><div class='line' id='LC626'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">lua-comment-or-string-p</span><span class="p">)</span></div><div class='line' id='LC627'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">indent</span> <span class="p">(</span><span class="nf">lua-calculate-string-or-comment-indentation</span><span class="p">))</span> <span class="c1">;; just restore point position</span></div><div class='line' id='LC628'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">indent</span> <span class="p">(</span><span class="nb">max </span><span class="mi">0</span> <span class="p">(</span><span class="nf">lua-calculate-indentation</span> <span class="nv">nil</span><span class="p">))))</span></div><div class='line' id='LC629'><br/></div><div class='line' id='LC630'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="p">(</span><span class="nb">not </span><span class="p">(</span><span class="nf">equal</span> <span class="nv">indent</span> <span class="p">(</span><span class="nf">current-column</span><span class="p">)))</span></div><div class='line' id='LC631'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">delete-region</span> <span class="p">(</span><span class="nf">line-beginning-position</span><span class="p">)</span> <span class="p">(</span><span class="nf">point</span><span class="p">))</span></div><div class='line' id='LC632'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">indent-to</span> <span class="nv">indent</span><span class="p">))</span></div><div class='line' id='LC633'><br/></div><div class='line' id='LC634'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; If initial point was within line&#39;s indentation,</span></div><div class='line' id='LC635'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; position after the indentation.  Else stay at same point in text.</span></div><div class='line' id='LC636'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nb">&gt; </span><span class="p">(</span><span class="nb">- </span><span class="p">(</span><span class="nf">point-max</span><span class="p">)</span> <span class="nv">pos</span><span class="p">)</span> <span class="p">(</span><span class="nf">point</span><span class="p">))</span></div><div class='line' id='LC637'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">goto-char</span> <span class="p">(</span><span class="nb">- </span><span class="p">(</span><span class="nf">point-max</span><span class="p">)</span> <span class="nv">pos</span><span class="p">)))</span></div><div class='line' id='LC638'><br/></div><div class='line' id='LC639'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">indent</span><span class="p">))</span></div><div class='line' id='LC640'><br/></div><div class='line' id='LC641'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-calculate-string-or-comment-indentation</span> <span class="p">()</span></div><div class='line' id='LC642'>&nbsp;&nbsp;<span class="s">&quot;This function should be run when point at (current-indentation) is inside string&quot;</span></div><div class='line' id='LC643'>&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nf">lua-string-p</span><span class="p">)</span> <span class="p">(</span><span class="nb">not </span><span class="nv">lua-indent-string-contents</span><span class="p">))</span></div><div class='line' id='LC644'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; if inside string and strings aren&#39;t to be indented, return current indentation</span></div><div class='line' id='LC645'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">current-indentation</span><span class="p">)</span></div><div class='line' id='LC646'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Otherwise, indent as a comment</span></div><div class='line' id='LC647'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC648'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">cond</span></div><div class='line' id='LC649'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; If it is the end of a multi-line comment, simply mirror the opening</span></div><div class='line' id='LC650'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; line&#39;s indent.</span></div><div class='line' id='LC651'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nf">looking-at</span> <span class="s">&quot;\\s *\\(?:--\\)?\\]\\(?1:=*\\)\\]&quot;</span><span class="p">)</span></div><div class='line' id='LC652'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">re-search-backward</span> <span class="p">(</span><span class="nf">format</span> <span class="s">&quot;\\[%s\\[&quot;</span></div><div class='line' id='LC653'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="nf">match-string-no-properties</span> <span class="mi">1</span><span class="p">)</span> <span class="s">&quot;&quot;</span><span class="p">))</span></div><div class='line' id='LC654'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-get-multiline-start</span><span class="p">)</span></div><div class='line' id='LC655'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="ss">&#39;noerror</span><span class="p">)</span></div><div class='line' id='LC656'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">current-indentation</span><span class="p">))</span></div><div class='line' id='LC657'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; otherwise indent by lua-indent-level relative to the line where literal starts</span></div><div class='line' id='LC658'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">t</span></div><div class='line' id='LC659'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">goto-char</span> <span class="p">(</span><span class="nf">lua-get-multiline-start</span><span class="p">))</span></div><div class='line' id='LC660'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">+ </span><span class="p">(</span><span class="nf">current-indentation</span><span class="p">)</span> <span class="nv">lua-indent-level</span><span class="p">))))))</span></div><div class='line' id='LC661'><br/></div><div class='line' id='LC662'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-find-regexp</span> <span class="p">(</span><span class="nf">direction</span> <span class="nv">regexp</span> <span class="nv">&amp;optional</span> <span class="nv">limit</span> <span class="nv">ignore-p</span><span class="p">)</span></div><div class='line' id='LC663'>&nbsp;&nbsp;<span class="s">&quot;Searches for a regular expression in the direction specified.</span></div><div class='line' id='LC664'><span class="s">Direction is one of &#39;forward and &#39;backward.</span></div><div class='line' id='LC665'><span class="s">By default, matches in comments and strings are ignored, but what to ignore is</span></div><div class='line' id='LC666'><span class="s">configurable by specifying ignore-p. If the regexp is found, returns point</span></div><div class='line' id='LC667'><span class="s">position, nil otherwise.</span></div><div class='line' id='LC668'><span class="s">ignore-p returns true if the match at the current point position should be</span></div><div class='line' id='LC669'><span class="s">ignored, nil otherwise.&quot;</span></div><div class='line' id='LC670'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">ignore-func</span> <span class="p">(</span><span class="k">or </span><span class="nv">ignore-p</span> <span class="ss">&#39;lua-comment-or-string-p</span><span class="p">))</span></div><div class='line' id='LC671'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">search-func</span> <span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">eq</span> <span class="nv">direction</span> <span class="ss">&#39;forward</span><span class="p">)</span></div><div class='line' id='LC672'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="ss">&#39;re-search-forward</span> <span class="ss">&#39;re-search-backward</span><span class="p">))</span></div><div class='line' id='LC673'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">case-fold-search</span> <span class="nv">nil</span><span class="p">))</span></div><div class='line' id='LC674'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">catch</span> <span class="ss">&#39;found</span></div><div class='line' id='LC675'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nf">funcall</span> <span class="nv">search-func</span> <span class="nv">regexp</span> <span class="nv">limit</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC676'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nb">not </span><span class="p">(</span><span class="nf">funcall</span> <span class="nv">ignore-func</span> <span class="p">(</span><span class="nf">match-beginning</span> <span class="mi">0</span><span class="p">)))</span></div><div class='line' id='LC677'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">not </span><span class="p">(</span><span class="nf">funcall</span> <span class="nv">ignore-func</span> <span class="p">(</span><span class="nf">match-end</span> <span class="mi">0</span><span class="p">))))</span></div><div class='line' id='LC678'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">throw</span> <span class="ss">&#39;found</span> <span class="p">(</span><span class="nf">point</span><span class="p">)))))))</span></div><div class='line' id='LC679'><br/></div><div class='line' id='LC680'><span class="p">(</span><span class="nf">defconst</span> <span class="nv">lua-block-regexp</span></div><div class='line' id='LC681'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">eval-when-compile</span></div><div class='line' id='LC682'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">concat</span></div><div class='line' id='LC683'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\(\\_&lt;&quot;</span></div><div class='line' id='LC684'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">regexp-opt</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;do&quot;</span> <span class="s">&quot;function&quot;</span> <span class="s">&quot;repeat&quot;</span> <span class="s">&quot;then&quot;</span></div><div class='line' id='LC685'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;else&quot;</span> <span class="s">&quot;elseif&quot;</span> <span class="s">&quot;end&quot;</span> <span class="s">&quot;until&quot;</span><span class="p">)</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC686'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\_&gt;\\)\\|&quot;</span></div><div class='line' id='LC687'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">regexp-opt</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;{&quot;</span> <span class="s">&quot;(&quot;</span> <span class="s">&quot;[&quot;</span> <span class="s">&quot;]&quot;</span> <span class="s">&quot;)&quot;</span> <span class="s">&quot;}&quot;</span><span class="p">)</span> <span class="nv">t</span><span class="p">))))</span></div><div class='line' id='LC688'><br/></div><div class='line' id='LC689'><span class="p">(</span><span class="nf">defconst</span> <span class="nv">lua-block-token-alist</span></div><div class='line' id='LC690'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">((</span><span class="s">&quot;do&quot;</span>       <span class="s">&quot;\\&lt;end\\&gt;&quot;</span>   <span class="s">&quot;\\&lt;for\\|while\\&gt;&quot;</span>                       <span class="nv">middle-or-open</span><span class="p">)</span></div><div class='line' id='LC691'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;function&quot;</span> <span class="s">&quot;\\&lt;end\\&gt;&quot;</span>   <span class="nv">nil</span>                                       <span class="nv">open</span><span class="p">)</span></div><div class='line' id='LC692'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;repeat&quot;</span>   <span class="s">&quot;\\&lt;until\\&gt;&quot;</span> <span class="nv">nil</span>                                       <span class="nv">open</span><span class="p">)</span></div><div class='line' id='LC693'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;then&quot;</span>     <span class="s">&quot;\\&lt;\\(e\\(lse\\(if\\)?\\|nd\\)\\)\\&gt;&quot;</span> <span class="s">&quot;\\&lt;\\(else\\)?if\\&gt;&quot;</span> <span class="nv">middle</span><span class="p">)</span></div><div class='line' id='LC694'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;{&quot;</span>        <span class="s">&quot;}&quot;</span>           <span class="nv">nil</span>                                       <span class="nv">open</span><span class="p">)</span></div><div class='line' id='LC695'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;[&quot;</span>        <span class="s">&quot;]&quot;</span>           <span class="nv">nil</span>                                       <span class="nv">open</span><span class="p">)</span></div><div class='line' id='LC696'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;(&quot;</span>        <span class="s">&quot;)&quot;</span>           <span class="nv">nil</span>                                       <span class="nv">open</span><span class="p">)</span></div><div class='line' id='LC697'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;if&quot;</span>       <span class="s">&quot;\\&lt;then\\&gt;&quot;</span>  <span class="nv">nil</span>                                       <span class="nv">open</span><span class="p">)</span></div><div class='line' id='LC698'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;for&quot;</span>      <span class="s">&quot;\\&lt;do\\&gt;&quot;</span>    <span class="nv">nil</span>                                       <span class="nv">open</span><span class="p">)</span></div><div class='line' id='LC699'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;while&quot;</span>    <span class="s">&quot;\\&lt;do\\&gt;&quot;</span>    <span class="nv">nil</span>                                       <span class="nv">open</span><span class="p">)</span></div><div class='line' id='LC700'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;else&quot;</span>     <span class="s">&quot;\\&lt;end\\&gt;&quot;</span>   <span class="s">&quot;\\&lt;then\\&gt;&quot;</span>                              <span class="nv">middle</span><span class="p">)</span></div><div class='line' id='LC701'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;elseif&quot;</span>   <span class="s">&quot;\\&lt;then\\&gt;&quot;</span>  <span class="s">&quot;\\&lt;then\\&gt;&quot;</span>                              <span class="nv">middle</span><span class="p">)</span></div><div class='line' id='LC702'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;end&quot;</span>      <span class="nv">nil</span>           <span class="s">&quot;\\&lt;\\(do\\|function\\|then\\|else\\)\\&gt;&quot;</span> <span class="nv">close</span><span class="p">)</span></div><div class='line' id='LC703'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;until&quot;</span>    <span class="nv">nil</span>           <span class="s">&quot;\\&lt;repeat\\&gt;&quot;</span>                            <span class="nv">close</span><span class="p">)</span></div><div class='line' id='LC704'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;}&quot;</span>        <span class="nv">nil</span>           <span class="s">&quot;{&quot;</span>                                       <span class="nv">close</span><span class="p">)</span></div><div class='line' id='LC705'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;]&quot;</span>        <span class="nv">nil</span>           <span class="s">&quot;\\[&quot;</span>                                     <span class="nv">close</span><span class="p">)</span></div><div class='line' id='LC706'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="s">&quot;)&quot;</span>        <span class="nv">nil</span>           <span class="s">&quot;(&quot;</span>                                       <span class="nv">close</span><span class="p">))</span></div><div class='line' id='LC707'>&nbsp;&nbsp;<span class="s">&quot;This is a list of block token information blocks.</span></div><div class='line' id='LC708'><span class="s">Each token information entry is of the form:</span></div><div class='line' id='LC709'><span class="s">  KEYWORD FORWARD-MATCH-REGEXP BACKWARDS-MATCH-REGEXP TOKEN-TYPE</span></div><div class='line' id='LC710'><span class="s">KEYWORD is the token.</span></div><div class='line' id='LC711'><span class="s">FORWARD-MATCH-REGEXP is a regexp that matches all possble tokens when going forward.</span></div><div class='line' id='LC712'><span class="s">BACKWARDS-MATCH-REGEXP is a regexp that matches all possble tokens when going backwards.</span></div><div class='line' id='LC713'><span class="s">TOKEN-TYPE determines where the token occurs on a statement. open indicates that the token appears at start, close indicates that it appears at end, middle indicates that it is a middle type token, and middle-or-open indicates that it can appear both as a middle or an open type.&quot;</span><span class="p">)</span></div><div class='line' id='LC714'><br/></div><div class='line' id='LC715'><span class="p">(</span><span class="nf">defconst</span> <span class="nv">lua-indentation-modifier-regexp</span></div><div class='line' id='LC716'>&nbsp;&nbsp;<span class="c1">;; The absence of else is deliberate, since it does not modify the</span></div><div class='line' id='LC717'>&nbsp;&nbsp;<span class="c1">;; indentation level per se. It only may cause the line, in which the</span></div><div class='line' id='LC718'>&nbsp;&nbsp;<span class="c1">;; else is, to be shifted to the left.</span></div><div class='line' id='LC719'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">concat</span></div><div class='line' id='LC720'>&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\(\\_&lt;&quot;</span></div><div class='line' id='LC721'>&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">regexp-opt</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;do&quot;</span> <span class="s">&quot;function&quot;</span> <span class="s">&quot;repeat&quot;</span> <span class="s">&quot;then&quot;</span> <span class="s">&quot;if&quot;</span> <span class="s">&quot;else&quot;</span> <span class="s">&quot;elseif&quot;</span> <span class="s">&quot;for&quot;</span> <span class="s">&quot;while&quot;</span><span class="p">)</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC722'>&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\_&gt;\\|&quot;</span></div><div class='line' id='LC723'>&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">regexp-opt</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;{&quot;</span> <span class="s">&quot;(&quot;</span> <span class="s">&quot;[&quot;</span><span class="p">))</span></div><div class='line' id='LC724'>&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\)\\|\\(\\_&lt;&quot;</span></div><div class='line' id='LC725'>&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">regexp-opt</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;end&quot;</span> <span class="s">&quot;until&quot;</span><span class="p">)</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC726'>&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\_&gt;\\|&quot;</span></div><div class='line' id='LC727'>&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">regexp-opt</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;]&quot;</span> <span class="s">&quot;)&quot;</span> <span class="s">&quot;}&quot;</span><span class="p">))</span></div><div class='line' id='LC728'>&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\)&quot;</span><span class="p">)</span></div><div class='line' id='LC729'>&nbsp;&nbsp;<span class="p">)</span></div><div class='line' id='LC730'><br/></div><div class='line' id='LC731'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-get-block-token-info</span> <span class="p">(</span><span class="nf">token</span><span class="p">)</span></div><div class='line' id='LC732'>&nbsp;&nbsp;<span class="s">&quot;Returns the block token info entry for TOKEN from lua-block-token-alist&quot;</span></div><div class='line' id='LC733'>&nbsp;&nbsp;<span class="p">(</span><span class="nb">assoc </span><span class="nv">token</span> <span class="nv">lua-block-token-alist</span><span class="p">))</span></div><div class='line' id='LC734'><br/></div><div class='line' id='LC735'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-get-token-match-re</span> <span class="p">(</span><span class="nf">token-info</span> <span class="nv">direction</span><span class="p">)</span></div><div class='line' id='LC736'>&nbsp;&nbsp;<span class="s">&quot;Returns the relevant match regexp from token info&quot;</span></div><div class='line' id='LC737'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">cond</span></div><div class='line' id='LC738'>&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nf">eq</span> <span class="nv">direction</span> <span class="ss">&#39;forward</span><span class="p">)</span> <span class="p">(</span><span class="nb">cadr </span><span class="nv">token-info</span><span class="p">))</span></div><div class='line' id='LC739'>&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nf">eq</span> <span class="nv">direction</span> <span class="ss">&#39;backward</span><span class="p">)</span> <span class="p">(</span><span class="nb">caddr </span><span class="nv">token-info</span><span class="p">))</span></div><div class='line' id='LC740'>&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">t</span> <span class="nv">nil</span><span class="p">)))</span></div><div class='line' id='LC741'><br/></div><div class='line' id='LC742'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-get-token-type</span> <span class="p">(</span><span class="nf">token-info</span><span class="p">)</span></div><div class='line' id='LC743'>&nbsp;&nbsp;<span class="s">&quot;Returns the relevant match regexp from token info&quot;</span></div><div class='line' id='LC744'>&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cadddr </span><span class="nv">token-info</span><span class="p">))</span></div><div class='line' id='LC745'><br/></div><div class='line' id='LC746'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-backwards-to-block-begin-or-end</span> <span class="p">()</span></div><div class='line' id='LC747'>&nbsp;&nbsp;<span class="s">&quot;Move backwards to nearest block begin or end.  Returns nil if not successful.&quot;</span></div><div class='line' id='LC748'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC749'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-find-regexp</span> <span class="ss">&#39;backward</span> <span class="nv">lua-block-regexp</span><span class="p">))</span></div><div class='line' id='LC750'><br/></div><div class='line' id='LC751'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-find-matching-token-word</span> <span class="p">(</span><span class="nf">token</span> <span class="nv">search-start</span> <span class="nv">&amp;optional</span> <span class="nv">direction</span><span class="p">)</span></div><div class='line' id='LC752'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let* </span><span class="p">((</span><span class="nf">token-info</span> <span class="p">(</span><span class="nf">lua-get-block-token-info</span> <span class="nv">token</span><span class="p">))</span></div><div class='line' id='LC753'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">match-type</span> <span class="p">(</span><span class="nf">lua-get-token-type</span> <span class="nv">token-info</span><span class="p">))</span></div><div class='line' id='LC754'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; If we are on a middle token, go backwards. If it is a middle or open,</span></div><div class='line' id='LC755'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; go forwards</span></div><div class='line' id='LC756'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">search-direction</span> <span class="p">(</span><span class="k">or </span><span class="nv">direction</span></div><div class='line' id='LC757'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="nf">eq</span> <span class="nv">match-type</span> <span class="ss">&#39;open</span><span class="p">)</span></div><div class='line' id='LC758'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">eq</span> <span class="nv">match-type</span> <span class="ss">&#39;middle-or-open</span><span class="p">))</span></div><div class='line' id='LC759'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="ss">&#39;forward</span></div><div class='line' id='LC760'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="ss">&#39;backward</span><span class="p">)</span></div><div class='line' id='LC761'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="ss">&#39;backward</span><span class="p">))</span></div><div class='line' id='LC762'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">match</span> <span class="p">(</span><span class="nf">lua-get-token-match-re</span> <span class="nv">token-info</span> <span class="nv">search-direction</span><span class="p">))</span></div><div class='line' id='LC763'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">maybe-found-pos</span><span class="p">)</span></div><div class='line' id='LC764'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; if we are searching forward from the token at the current point</span></div><div class='line' id='LC765'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; (i.e. for a closing token), need to step one character forward</span></div><div class='line' id='LC766'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; first, or the regexp will match the opening token.</span></div><div class='line' id='LC767'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">eq</span> <span class="nv">search-direction</span> <span class="ss">&#39;forward</span><span class="p">)</span> <span class="p">(</span><span class="nf">forward-char</span> <span class="mi">1</span><span class="p">))</span></div><div class='line' id='LC768'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">search-start</span> <span class="p">(</span><span class="nf">goto-char</span> <span class="nv">search-start</span><span class="p">))</span></div><div class='line' id='LC769'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">catch</span> <span class="ss">&#39;found</span></div><div class='line' id='LC770'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; If we are attempting to find a matching token for a terminating token</span></div><div class='line' id='LC771'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; (i.e. a token that starts a statement when searching back, or a token</span></div><div class='line' id='LC772'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; that ends a statement when searching forward), then we don&#39;t need to look</span></div><div class='line' id='LC773'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; any further.</span></div><div class='line' id='LC774'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nf">eq</span> <span class="nv">search-direction</span> <span class="ss">&#39;forward</span><span class="p">)</span></div><div class='line' id='LC775'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">eq</span> <span class="nv">match-type</span> <span class="ss">&#39;close</span><span class="p">))</span></div><div class='line' id='LC776'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nf">eq</span> <span class="nv">search-direction</span> <span class="ss">&#39;backward</span><span class="p">)</span></div><div class='line' id='LC777'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">eq</span> <span class="nv">match-type</span> <span class="ss">&#39;open</span><span class="p">)))</span></div><div class='line' id='LC778'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">throw</span> <span class="ss">&#39;found</span> <span class="nv">nil</span><span class="p">))</span></div><div class='line' id='LC779'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nf">lua-find-regexp</span> <span class="nv">search-direction</span> <span class="nv">lua-indentation-modifier-regexp</span><span class="p">)</span></div><div class='line' id='LC780'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; have we found a valid matching token?</span></div><div class='line' id='LC781'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">found-token</span> <span class="p">(</span><span class="nf">match-string</span> <span class="mi">0</span><span class="p">))</span></div><div class='line' id='LC782'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">found-pos</span> <span class="p">(</span><span class="nf">match-beginning</span> <span class="mi">0</span><span class="p">)))</span></div><div class='line' id='LC783'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">found-type</span> <span class="p">(</span><span class="nf">lua-get-token-type</span></div><div class='line' id='LC784'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-get-block-token-info</span> <span class="nv">found-token</span><span class="p">))))</span></div><div class='line' id='LC785'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nb">not </span><span class="p">(</span><span class="k">and </span><span class="nv">match</span> <span class="p">(</span><span class="nf">string-match</span> <span class="nv">match</span> <span class="nv">found-token</span><span class="p">)))</span></div><div class='line' id='LC786'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; no - then there is a nested block. If we were looking for</span></div><div class='line' id='LC787'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; a block begin token, found-token must be a block end</span></div><div class='line' id='LC788'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; token; likewise, if we were looking for a block end token,</span></div><div class='line' id='LC789'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; found-token must be a block begin token, otherwise there</span></div><div class='line' id='LC790'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; is a grammatical error in the code.</span></div><div class='line' id='LC791'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nb">not </span><span class="p">(</span><span class="nf">and</span></div><div class='line' id='LC792'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="nf">eq</span> <span class="nv">match-type</span> <span class="ss">&#39;middle</span><span class="p">)</span></div><div class='line' id='LC793'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">eq</span> <span class="nv">found-type</span> <span class="ss">&#39;middle</span><span class="p">)</span></div><div class='line' id='LC794'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">eq</span> <span class="nv">match-type</span> <span class="ss">&#39;middle-or-open</span><span class="p">)</span></div><div class='line' id='LC795'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">eq</span> <span class="nv">found-type</span> <span class="ss">&#39;middle-or-open</span><span class="p">)</span></div><div class='line' id='LC796'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">eq</span> <span class="nv">match-type</span> <span class="nv">found-type</span><span class="p">))</span></div><div class='line' id='LC797'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-find-matching-token-word</span> <span class="nv">found-token</span> <span class="nv">nil</span></div><div class='line' id='LC798'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">search-direction</span><span class="p">)))</span></div><div class='line' id='LC799'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="nv">maybe-found-pos</span></div><div class='line' id='LC800'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">goto-char</span> <span class="nv">maybe-found-pos</span><span class="p">)</span></div><div class='line' id='LC801'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">throw</span> <span class="ss">&#39;found</span> <span class="nv">maybe-found-pos</span><span class="p">)))</span></div><div class='line' id='LC802'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; yes.</span></div><div class='line' id='LC803'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; if it is a not a middle kind, report the location</span></div><div class='line' id='LC804'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="p">(</span><span class="nb">not </span><span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="nf">eq</span> <span class="nv">found-type</span> <span class="ss">&#39;middle</span><span class="p">)</span></div><div class='line' id='LC805'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">eq</span> <span class="nv">found-type</span> <span class="ss">&#39;middle-or-open</span><span class="p">)))</span></div><div class='line' id='LC806'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">throw</span> <span class="ss">&#39;found</span> <span class="nv">found-pos</span><span class="p">))</span></div><div class='line' id='LC807'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; if it is a middle-or-open type, record location, but keep searching.</span></div><div class='line' id='LC808'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; If we fail to complete the search, we&#39;ll report the location</span></div><div class='line' id='LC809'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="p">(</span><span class="nf">eq</span> <span class="nv">found-type</span> <span class="ss">&#39;middle-or-open</span><span class="p">)</span></div><div class='line' id='LC810'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">maybe-found-pos</span> <span class="nv">found-pos</span><span class="p">))</span></div><div class='line' id='LC811'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Cannot use tail recursion. too much nesting on long chains of</span></div><div class='line' id='LC812'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; if/elseif. Will reset variables instead.</span></div><div class='line' id='LC813'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">token</span> <span class="nv">found-token</span><span class="p">)</span></div><div class='line' id='LC814'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">token-info</span> <span class="p">(</span><span class="nf">lua-get-block-token-info</span> <span class="nv">token</span><span class="p">))</span></div><div class='line' id='LC815'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">match</span> <span class="p">(</span><span class="nf">lua-get-token-match-re</span> <span class="nv">token-info</span> <span class="nv">search-direction</span><span class="p">))</span></div><div class='line' id='LC816'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">match-type</span> <span class="p">(</span><span class="nf">lua-get-token-type</span> <span class="nv">token-info</span><span class="p">))))))</span></div><div class='line' id='LC817'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">maybe-found-pos</span><span class="p">)))</span></div><div class='line' id='LC818'><br/></div><div class='line' id='LC819'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-goto-matching-block-token</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">search-start</span> <span class="nv">parse-start</span> <span class="nv">direction</span><span class="p">)</span></div><div class='line' id='LC820'>&nbsp;&nbsp;<span class="s">&quot;Find block begion/end token matching the one at the point.</span></div><div class='line' id='LC821'><span class="s">This function moves the point to the token that matches the one</span></div><div class='line' id='LC822'><span class="s">at the current point. Returns the point position of the first character of</span></div><div class='line' id='LC823'><span class="s">the matching token if successful, nil otherwise.&quot;</span></div><div class='line' id='LC824'>&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">parse-start</span> <span class="p">(</span><span class="nf">goto-char</span> <span class="nv">parse-start</span><span class="p">))</span></div><div class='line' id='LC825'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">case-fold-search</span> <span class="nv">nil</span><span class="p">))</span></div><div class='line' id='LC826'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">looking-at</span> <span class="nv">lua-indentation-modifier-regexp</span><span class="p">)</span></div><div class='line' id='LC827'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">position</span> <span class="p">(</span><span class="nf">lua-find-matching-token-word</span> <span class="p">(</span><span class="nf">match-string</span> <span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC828'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">search-start</span> <span class="nv">direction</span><span class="p">)))</span></div><div class='line' id='LC829'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">and </span><span class="nv">position</span></div><div class='line' id='LC830'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">goto-char</span> <span class="nv">position</span><span class="p">))))))</span></div><div class='line' id='LC831'><br/></div><div class='line' id='LC832'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-goto-matching-block</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">noreport</span><span class="p">)</span></div><div class='line' id='LC833'>&nbsp;&nbsp;<span class="s">&quot;Go to the keyword balancing the one under the point.</span></div><div class='line' id='LC834'><span class="s">If the point is on a keyword/brace that starts a block, go to the</span></div><div class='line' id='LC835'><span class="s">matching keyword that ends the block, and vice versa.&quot;</span></div><div class='line' id='LC836'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC837'>&nbsp;&nbsp;<span class="c1">;; search backward to the beginning of the keyword if necessary</span></div><div class='line' id='LC838'>&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">eq</span> <span class="p">(</span><span class="nf">char-syntax</span> <span class="p">(</span><span class="nf">following-char</span><span class="p">))</span> <span class="nv">?w</span><span class="p">)</span></div><div class='line' id='LC839'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">re-search-backward</span> <span class="s">&quot;\\_&lt;&quot;</span> <span class="nv">nil</span> <span class="nv">t</span><span class="p">))</span></div><div class='line' id='LC840'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">position</span> <span class="p">(</span><span class="nf">lua-goto-matching-block-token</span><span class="p">)))</span></div><div class='line' id='LC841'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nb">not </span><span class="nv">position</span><span class="p">)</span></div><div class='line' id='LC842'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">not </span><span class="nv">noreport</span><span class="p">))</span></div><div class='line' id='LC843'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">error</span> <span class="s">&quot;Not on a block control keyword or brace&quot;</span><span class="p">)</span></div><div class='line' id='LC844'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">position</span><span class="p">)))</span></div><div class='line' id='LC845'><br/></div><div class='line' id='LC846'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-forward-line-skip-blanks</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">back</span><span class="p">)</span></div><div class='line' id='LC847'>&nbsp;&nbsp;<span class="s">&quot;Move 1 line forward (back if BACK is non-nil) skipping blank lines.</span></div><div class='line' id='LC848'><br/></div><div class='line' id='LC849'><span class="s">Moves point 1 line forward (or backward) skipping lines that contain</span></div><div class='line' id='LC850'><span class="s">no Lua code besides comments. The point is put to the beginning of</span></div><div class='line' id='LC851'><span class="s">the line.</span></div><div class='line' id='LC852'><br/></div><div class='line' id='LC853'><span class="s">Returns final value of point as integer or nil if operation failed.&quot;</span></div><div class='line' id='LC854'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">catch</span> <span class="ss">&#39;found</span></div><div class='line' id='LC855'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="nv">t</span></div><div class='line' id='LC856'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">unless</span> <span class="p">(</span><span class="nf">eql</span> <span class="p">(</span><span class="nf">forward-line</span> <span class="p">(</span><span class="k">if </span><span class="nv">back</span> <span class="mi">-1</span> <span class="mi">1</span><span class="p">))</span> <span class="mi">0</span><span class="p">)</span>    <span class="c1">;; 0 means success</span></div><div class='line' id='LC857'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">throw</span> <span class="ss">&#39;found</span> <span class="nv">nil</span><span class="p">))</span></div><div class='line' id='LC858'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">unless</span> <span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="nf">looking-at</span> <span class="s">&quot;\\s *\\(--.*\\)?$&quot;</span><span class="p">)</span></div><div class='line' id='LC859'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-comment-or-string-p</span><span class="p">))</span></div><div class='line' id='LC860'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">throw</span> <span class="ss">&#39;found</span> <span class="p">(</span><span class="nf">point</span><span class="p">))))))</span></div><div class='line' id='LC861'><br/></div><div class='line' id='LC862'><span class="p">(</span><span class="nf">eval-when-compile</span></div><div class='line' id='LC863'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">defconst</span> <span class="nv">lua-operator-class</span></div><div class='line' id='LC864'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;-+*/^.=&lt;&gt;~&quot;</span><span class="p">))</span></div><div class='line' id='LC865'><br/></div><div class='line' id='LC866'><span class="p">(</span><span class="nf">defconst</span> <span class="nv">lua-cont-eol-regexp</span></div><div class='line' id='LC867'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">eval-when-compile</span></div><div class='line' id='LC868'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">concat</span></div><div class='line' id='LC869'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\(\\_&lt;&quot;</span></div><div class='line' id='LC870'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">regexp-opt</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;and&quot;</span> <span class="s">&quot;or&quot;</span> <span class="s">&quot;not&quot;</span> <span class="s">&quot;in&quot;</span> <span class="s">&quot;for&quot;</span> <span class="s">&quot;while&quot;</span></div><div class='line' id='LC871'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;local&quot;</span> <span class="s">&quot;function&quot;</span> <span class="s">&quot;if&quot;</span> <span class="s">&quot;until&quot;</span> <span class="s">&quot;elseif&quot;</span> <span class="s">&quot;return&quot;</span><span class="p">)</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC872'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\_&gt;\\|&quot;</span></div><div class='line' id='LC873'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\(^\\|[^&quot;</span> <span class="nv">lua-operator-class</span> <span class="s">&quot;]\\)&quot;</span></div><div class='line' id='LC874'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">regexp-opt</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;+&quot;</span> <span class="s">&quot;-&quot;</span> <span class="s">&quot;*&quot;</span> <span class="s">&quot;/&quot;</span> <span class="s">&quot;^&quot;</span> <span class="s">&quot;..&quot;</span> <span class="s">&quot;==&quot;</span> <span class="s">&quot;=&quot;</span> <span class="s">&quot;&lt;&quot;</span> <span class="s">&quot;&gt;&quot;</span> <span class="s">&quot;&lt;=&quot;</span> <span class="s">&quot;&gt;=&quot;</span> <span class="s">&quot;~=&quot;</span><span class="p">)</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC875'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\)&quot;</span></div><div class='line' id='LC876'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\s *\\=&quot;</span><span class="p">)</span></div><div class='line' id='LC877'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">)</span></div><div class='line' id='LC878'>&nbsp;&nbsp;<span class="s">&quot;Regexp that matches the ending of a line that needs continuation</span></div><div class='line' id='LC879'><br/></div><div class='line' id='LC880'><span class="s">This regexp starts from eol and looks for a binary operator or an unclosed</span></div><div class='line' id='LC881'><span class="s">block intro (i.e. &#39;for&#39; without &#39;do&#39; or &#39;if&#39; without &#39;then&#39;) followed by</span></div><div class='line' id='LC882'><span class="s">an optional whitespace till the end of the line.&quot;</span><span class="p">)</span></div><div class='line' id='LC883'><br/></div><div class='line' id='LC884'><span class="p">(</span><span class="nf">defconst</span> <span class="nv">lua-cont-bol-regexp</span></div><div class='line' id='LC885'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">eval-when-compile</span></div><div class='line' id='LC886'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">concat</span></div><div class='line' id='LC887'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\=\\s *&quot;</span></div><div class='line' id='LC888'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\(\\_&lt;&quot;</span></div><div class='line' id='LC889'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">regexp-opt</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;and&quot;</span> <span class="s">&quot;or&quot;</span> <span class="s">&quot;not&quot;</span><span class="p">)</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC890'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\_&gt;\\|&quot;</span></div><div class='line' id='LC891'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">regexp-opt</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;+&quot;</span> <span class="s">&quot;-&quot;</span> <span class="s">&quot;*&quot;</span> <span class="s">&quot;/&quot;</span> <span class="s">&quot;^&quot;</span> <span class="s">&quot;..&quot;</span> <span class="s">&quot;==&quot;</span> <span class="s">&quot;=&quot;</span> <span class="s">&quot;&lt;&quot;</span> <span class="s">&quot;&gt;&quot;</span> <span class="s">&quot;&lt;=&quot;</span> <span class="s">&quot;&gt;=&quot;</span> <span class="s">&quot;~=&quot;</span><span class="p">)</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC892'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\($\\|[^&quot;</span> <span class="nv">lua-operator-class</span> <span class="s">&quot;]\\)&quot;</span></div><div class='line' id='LC893'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;\\)&quot;</span><span class="p">)</span></div><div class='line' id='LC894'><br/></div><div class='line' id='LC895'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">)</span></div><div class='line' id='LC896'>&nbsp;&nbsp;<span class="s">&quot;Regexp that matches a line that continues previous one</span></div><div class='line' id='LC897'><br/></div><div class='line' id='LC898'><span class="s">This regexp means, starting from point there is an optional whitespace followed</span></div><div class='line' id='LC899'><span class="s">by Lua binary operator. Lua is very liberal when it comes to continuation line,</span></div><div class='line' id='LC900'><span class="s">so we&#39;re safe to assume that every line that starts with a binop continues</span></div><div class='line' id='LC901'><span class="s">previous one even though it looked like an end-of-statement.&quot;</span><span class="p">)</span></div><div class='line' id='LC902'><br/></div><div class='line' id='LC903'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-last-token-continues-p</span> <span class="p">()</span></div><div class='line' id='LC904'>&nbsp;&nbsp;<span class="s">&quot;Returns true if the last token on this line is a continuation token.&quot;</span></div><div class='line' id='LC905'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">line-begin</span> <span class="p">(</span><span class="nf">line-beginning-position</span><span class="p">))</span></div><div class='line' id='LC906'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">line-end</span> <span class="p">(</span><span class="nf">line-end-position</span><span class="p">)))</span></div><div class='line' id='LC907'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC908'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">end-of-line</span><span class="p">)</span></div><div class='line' id='LC909'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; we need to check whether the line ends in a comment and</span></div><div class='line' id='LC910'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; skip that one.</span></div><div class='line' id='LC911'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nf">lua-find-regexp</span> <span class="ss">&#39;backward</span> <span class="s">&quot;-&quot;</span> <span class="nv">line-begin</span> <span class="ss">&#39;lua-string-p</span><span class="p">)</span></div><div class='line' id='LC912'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">looking-at</span> <span class="s">&quot;--&quot;</span><span class="p">)</span></div><div class='line' id='LC913'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">line-end</span> <span class="p">(</span><span class="nf">point</span><span class="p">))))</span></div><div class='line' id='LC914'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">goto-char</span> <span class="nv">line-end</span><span class="p">)</span></div><div class='line' id='LC915'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">re-search-backward</span> <span class="nv">lua-cont-eol-regexp</span> <span class="nv">line-begin</span> <span class="nv">t</span><span class="p">))))</span></div><div class='line' id='LC916'><br/></div><div class='line' id='LC917'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-first-token-continues-p</span> <span class="p">()</span></div><div class='line' id='LC918'>&nbsp;&nbsp;<span class="s">&quot;Returns true if the first token on this line is a continuation token.&quot;</span></div><div class='line' id='LC919'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">line-end</span> <span class="p">(</span><span class="nf">line-end-position</span><span class="p">)))</span></div><div class='line' id='LC920'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC921'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">beginning-of-line</span><span class="p">)</span></div><div class='line' id='LC922'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; if first character of the line is inside string, it&#39;s a continuation</span></div><div class='line' id='LC923'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; if strings aren&#39;t supposed to be indented, `lua-calculate-indentation&#39; won&#39;t even let</span></div><div class='line' id='LC924'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; the control inside this function</span></div><div class='line' id='LC925'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">re-search-forward</span> <span class="nv">lua-cont-bol-regexp</span> <span class="nv">line-end</span> <span class="nv">t</span><span class="p">))))</span></div><div class='line' id='LC926'><br/></div><div class='line' id='LC927'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-is-continuing-statement-p</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">parse-start</span><span class="p">)</span></div><div class='line' id='LC928'>&nbsp;&nbsp;<span class="s">&quot;Return non-nil if the line continues a statement.</span></div><div class='line' id='LC929'><span class="s">More specifically, return the point in the line that is continued.</span></div><div class='line' id='LC930'><span class="s">The criteria for a continuing statement are:</span></div><div class='line' id='LC931'><br/></div><div class='line' id='LC932'><span class="s">* the last token of the previous line is a continuing op,</span></div><div class='line' id='LC933'><span class="s">  OR the first token of the current line is a continuing op</span></div><div class='line' id='LC934'><br/></div><div class='line' id='LC935'><span class="s">&quot;</span></div><div class='line' id='LC936'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">prev-line</span> <span class="nv">nil</span><span class="p">))</span></div><div class='line' id='LC937'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC938'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">parse-start</span> <span class="p">(</span><span class="nf">goto-char</span> <span class="nv">parse-start</span><span class="p">))</span></div><div class='line' id='LC939'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span> <span class="p">(</span><span class="nf">setq</span> <span class="nv">prev-line</span> <span class="p">(</span><span class="nf">lua-forward-line-skip-blanks</span> <span class="ss">&#39;back</span><span class="p">)))</span></div><div class='line' id='LC940'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">and </span><span class="nv">prev-line</span></div><div class='line' id='LC941'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="nf">lua-first-token-continues-p</span><span class="p">)</span></div><div class='line' id='LC942'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nf">goto-char</span> <span class="nv">prev-line</span><span class="p">)</span></div><div class='line' id='LC943'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; check last token of previous nonblank line</span></div><div class='line' id='LC944'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-last-token-continues-p</span><span class="p">)))))))</span></div><div class='line' id='LC945'><br/></div><div class='line' id='LC946'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-make-indentation-info-pair</span> <span class="p">(</span><span class="nf">found-token</span> <span class="nv">found-pos</span><span class="p">)</span></div><div class='line' id='LC947'>&nbsp;&nbsp;<span class="s">&quot;This is a helper function to lua-calculate-indentation-info. Don&#39;t</span></div><div class='line' id='LC948'><span class="s">use standalone.&quot;</span></div><div class='line' id='LC949'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">cond</span></div><div class='line' id='LC950'>&nbsp;&nbsp;&nbsp;<span class="c1">;; function is a bit tricky to indent right. They can appear in a lot ot</span></div><div class='line' id='LC951'>&nbsp;&nbsp;&nbsp;<span class="c1">;; different contexts. Until I find a shortcut, I&#39;ll leave it with a simple</span></div><div class='line' id='LC952'>&nbsp;&nbsp;&nbsp;<span class="c1">;; relative indentation.</span></div><div class='line' id='LC953'>&nbsp;&nbsp;&nbsp;<span class="c1">;; The special cases are for indenting according to the location of the</span></div><div class='line' id='LC954'>&nbsp;&nbsp;&nbsp;<span class="c1">;; function. i.e.:</span></div><div class='line' id='LC955'>&nbsp;&nbsp;&nbsp;<span class="c1">;;       (cons &#39;absolute (+ (current-column) lua-indent-level))</span></div><div class='line' id='LC956'>&nbsp;&nbsp;&nbsp;<span class="c1">;; TODO: Fix this. It causes really ugly indentations for in-line functions.</span></div><div class='line' id='LC957'>&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nf">string-equal</span> <span class="nv">found-token</span> <span class="s">&quot;function&quot;</span><span class="p">)</span></div><div class='line' id='LC958'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="ss">&#39;relative</span> <span class="nv">lua-indent-level</span><span class="p">))</span></div><div class='line' id='LC959'><br/></div><div class='line' id='LC960'>&nbsp;&nbsp;&nbsp;<span class="c1">;; block openers</span></div><div class='line' id='LC961'>&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nb">member </span><span class="nv">found-token</span> <span class="p">(</span><span class="nb">list </span><span class="s">&quot;{&quot;</span> <span class="s">&quot;(&quot;</span> <span class="s">&quot;[&quot;</span><span class="p">))</span></div><div class='line' id='LC962'>	 <span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC963'>	   <span class="c1">;; expression follows -&gt; indent at start of next expression</span></div><div class='line' id='LC964'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Last token on the line -&gt; simple relative indent</span></div><div class='line' id='LC965'>	   <span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nb">not </span><span class="p">(</span><span class="nf">search-forward-regexp</span> <span class="s">&quot;[[:space:]]--&quot;</span> <span class="p">(</span><span class="nf">line-end-position</span><span class="p">)</span> <span class="nv">t</span><span class="p">))</span></div><div class='line' id='LC966'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">search-forward-regexp</span> <span class="s">&quot;[^[:space:]]&quot;</span> <span class="p">(</span><span class="nf">line-end-position</span><span class="p">)</span> <span class="nv">t</span><span class="p">))</span></div><div class='line' id='LC967'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="ss">&#39;absolute</span> <span class="p">(</span><span class="mi">1</span><span class="nv">-</span> <span class="p">(</span><span class="nf">current-column</span><span class="p">)))</span></div><div class='line' id='LC968'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="ss">&#39;relative</span> <span class="nv">lua-indent-level</span><span class="p">))))</span></div><div class='line' id='LC969'><br/></div><div class='line' id='LC970'>&nbsp;&nbsp;&nbsp;<span class="c1">;; These are not really block starters. They should not add to indentation.</span></div><div class='line' id='LC971'>&nbsp;&nbsp;&nbsp;<span class="c1">;; The corresponding &quot;then&quot; and &quot;do&quot; handle the indentation.</span></div><div class='line' id='LC972'>&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nb">member </span><span class="nv">found-token</span> <span class="p">(</span><span class="nb">list </span><span class="s">&quot;if&quot;</span> <span class="s">&quot;for&quot;</span> <span class="s">&quot;while&quot;</span><span class="p">))</span></div><div class='line' id='LC973'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="ss">&#39;relative</span> <span class="mi">0</span><span class="p">))</span></div><div class='line' id='LC974'>&nbsp;&nbsp;&nbsp;<span class="c1">;; closing tokens follow: These are usually taken care of by</span></div><div class='line' id='LC975'>&nbsp;&nbsp;&nbsp;<span class="c1">;; lua-calculate-indentation-override.</span></div><div class='line' id='LC976'>&nbsp;&nbsp;&nbsp;<span class="c1">;; elseif is a bit of a hack. It is not handled separately, but it needs to</span></div><div class='line' id='LC977'>&nbsp;&nbsp;&nbsp;<span class="c1">;; nullify a previous then if on the same line.</span></div><div class='line' id='LC978'>&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nb">member </span><span class="nv">found-token</span> <span class="p">(</span><span class="nb">list </span><span class="s">&quot;until&quot;</span> <span class="s">&quot;elseif&quot;</span><span class="p">))</span></div><div class='line' id='LC979'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC980'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">line</span> <span class="p">(</span><span class="nf">line-number-at-pos</span><span class="p">)))</span></div><div class='line' id='LC981'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nf">lua-goto-matching-block-token</span> <span class="nv">nil</span> <span class="nv">found-pos</span> <span class="ss">&#39;backward</span><span class="p">)</span></div><div class='line' id='LC982'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">= </span><span class="nv">line</span> <span class="p">(</span><span class="nf">line-number-at-pos</span><span class="p">)))</span></div><div class='line' id='LC983'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="ss">&#39;remove-matching</span> <span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC984'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="ss">&#39;relative</span> <span class="mi">0</span><span class="p">)))))</span></div><div class='line' id='LC985'><br/></div><div class='line' id='LC986'>&nbsp;&nbsp;&nbsp;<span class="c1">;; else is a special case; if its matching block token is on the same line,</span></div><div class='line' id='LC987'>&nbsp;&nbsp;&nbsp;<span class="c1">;; instead of removing the matching token, it has to replace it, so that</span></div><div class='line' id='LC988'>&nbsp;&nbsp;&nbsp;<span class="c1">;; either the next line will be indented correctly, or the end on the same</span></div><div class='line' id='LC989'>&nbsp;&nbsp;&nbsp;<span class="c1">;; line will remove the effect of the else.</span></div><div class='line' id='LC990'>&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nf">string-equal</span> <span class="nv">found-token</span> <span class="s">&quot;else&quot;</span><span class="p">)</span></div><div class='line' id='LC991'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC992'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">line</span> <span class="p">(</span><span class="nf">line-number-at-pos</span><span class="p">)))</span></div><div class='line' id='LC993'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nf">lua-goto-matching-block-token</span> <span class="nv">nil</span> <span class="nv">found-pos</span> <span class="ss">&#39;backward</span><span class="p">)</span></div><div class='line' id='LC994'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">= </span><span class="nv">line</span> <span class="p">(</span><span class="nf">line-number-at-pos</span><span class="p">)))</span></div><div class='line' id='LC995'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="ss">&#39;replace-matching</span> <span class="p">(</span><span class="nb">cons </span><span class="ss">&#39;relative</span> <span class="nv">lua-indent-level</span><span class="p">))</span></div><div class='line' id='LC996'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="ss">&#39;relative</span> <span class="nv">lua-indent-level</span><span class="p">)))))</span></div><div class='line' id='LC997'><br/></div><div class='line' id='LC998'>&nbsp;&nbsp;&nbsp;<span class="c1">;; Block closers. If they are on the same line as their openers, they simply</span></div><div class='line' id='LC999'>&nbsp;&nbsp;&nbsp;<span class="c1">;; eat up the matching indentation modifier. Otherwise, they pull</span></div><div class='line' id='LC1000'>&nbsp;&nbsp;&nbsp;<span class="c1">;; indentation back to the matching block opener.</span></div><div class='line' id='LC1001'>&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nb">member </span><span class="nv">found-token</span> <span class="p">(</span><span class="nb">list </span><span class="s">&quot;)&quot;</span> <span class="s">&quot;}&quot;</span> <span class="s">&quot;]&quot;</span> <span class="s">&quot;end&quot;</span><span class="p">))</span></div><div class='line' id='LC1002'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC1003'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">line</span> <span class="p">(</span><span class="nf">line-number-at-pos</span><span class="p">)))</span></div><div class='line' id='LC1004'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-goto-matching-block-token</span> <span class="nv">nil</span> <span class="nv">found-pos</span> <span class="ss">&#39;backward</span><span class="p">)</span></div><div class='line' id='LC1005'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">/=</span> <span class="nv">line</span> <span class="p">(</span><span class="nf">line-number-at-pos</span><span class="p">))</span></div><div class='line' id='LC1006'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="ss">&#39;absolute</span></div><div class='line' id='LC1007'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">+ </span><span class="p">(</span><span class="nf">current-indentation</span><span class="p">)</span></div><div class='line' id='LC1008'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-calculate-indentation-block-modifier</span></div><div class='line' id='LC1009'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">nil</span> <span class="p">(</span><span class="nf">point</span><span class="p">))))</span></div><div class='line' id='LC1010'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="ss">&#39;remove-matching</span> <span class="mi">0</span><span class="p">)))))</span></div><div class='line' id='LC1011'><br/></div><div class='line' id='LC1012'>&nbsp;&nbsp;&nbsp;<span class="c1">;; Everything else. This is from the original code: If opening a block</span></div><div class='line' id='LC1013'>&nbsp;&nbsp;&nbsp;<span class="c1">;; (match-data 1 exists), then push indentation one level up, if it is</span></div><div class='line' id='LC1014'>&nbsp;&nbsp;&nbsp;<span class="c1">;; closing a block, pull it one level down.</span></div><div class='line' id='LC1015'>&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="ss">&#39;other-indentation-modifier</span></div><div class='line' id='LC1016'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="ss">&#39;relative</span> <span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">nth</span> <span class="mi">2</span> <span class="p">(</span><span class="nf">match-data</span><span class="p">))</span></div><div class='line' id='LC1017'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; beginning of a block matched</span></div><div class='line' id='LC1018'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">lua-indent-level</span></div><div class='line' id='LC1019'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; end of a block matched</span></div><div class='line' id='LC1020'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">- </span><span class="nv">lua-indent-level</span><span class="p">))))))</span></div><div class='line' id='LC1021'><br/></div><div class='line' id='LC1022'><span class="p">(</span><span class="nf">defun</span>  <span class="nv">lua-add-indentation-info-pair</span> <span class="p">(</span><span class="nf">pair</span> <span class="nv">info</span><span class="p">)</span></div><div class='line' id='LC1023'>&nbsp;&nbsp;<span class="s">&quot;Add the given indentation info pair to the list of indentation information.</span></div><div class='line' id='LC1024'><span class="s">This function has special case handling for two tokens: remove-matching,</span></div><div class='line' id='LC1025'><span class="s">and replace-matching. These two tokens are cleanup tokens that remove or</span></div><div class='line' id='LC1026'><span class="s">alter the effect of a previously recorded indentation info.</span></div><div class='line' id='LC1027'><br/></div><div class='line' id='LC1028'><span class="s">When a remove-matching token is encountered, the last recorded info, i.e.</span></div><div class='line' id='LC1029'><span class="s">the car of the list is removed. This is used to roll-back an indentation of a</span></div><div class='line' id='LC1030'><span class="s">block opening statement when it is closed.</span></div><div class='line' id='LC1031'><br/></div><div class='line' id='LC1032'><span class="s">When a replace-matching token is seen, the last recorded info is removed,</span></div><div class='line' id='LC1033'><span class="s">and the cdr of the replace-matching info is added in its place. This is used</span></div><div class='line' id='LC1034'><span class="s">when a middle-of the block (the only case is &#39;else&#39;) is seen on the same line</span></div><div class='line' id='LC1035'><span class="s">the block is opened.&quot;</span></div><div class='line' id='LC1036'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">cond</span></div><div class='line' id='LC1037'>&nbsp;&nbsp;&nbsp;<span class="p">(</span> <span class="p">(</span><span class="nf">eq</span> <span class="ss">&#39;remove-matching</span> <span class="p">(</span><span class="nb">car </span><span class="nv">pair</span><span class="p">))</span></div><div class='line' id='LC1038'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">; Remove head of list</span></div><div class='line' id='LC1039'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cdr </span><span class="nv">info</span><span class="p">))</span></div><div class='line' id='LC1040'>&nbsp;&nbsp;&nbsp;<span class="p">(</span> <span class="p">(</span><span class="nf">eq</span> <span class="ss">&#39;replace-matching</span> <span class="p">(</span><span class="nb">car </span><span class="nv">pair</span><span class="p">))</span></div><div class='line' id='LC1041'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">; remove head of list, and add the cdr of pair instead</span></div><div class='line' id='LC1042'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="p">(</span><span class="nb">cdr </span><span class="nv">pair</span><span class="p">)</span> <span class="p">(</span><span class="nb">cdr </span><span class="nv">info</span><span class="p">)))</span></div><div class='line' id='LC1043'>&nbsp;&nbsp;&nbsp;<span class="p">(</span> <span class="nv">t</span></div><div class='line' id='LC1044'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">; Just add the pair</span></div><div class='line' id='LC1045'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="nv">pair</span> <span class="nv">info</span><span class="p">))))</span></div><div class='line' id='LC1046'><br/></div><div class='line' id='LC1047'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-calculate-indentation-info</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">parse-start</span> <span class="nv">parse-end</span><span class="p">)</span></div><div class='line' id='LC1048'>&nbsp;&nbsp;<span class="s">&quot;For each block token on the line, computes how it affects the indentation.</span></div><div class='line' id='LC1049'><span class="s">The effect of each token can be either a shift relative to the current</span></div><div class='line' id='LC1050'><span class="s">indentation level, or indentation to some absolute column. This information</span></div><div class='line' id='LC1051'><span class="s">is collected in a list of indentation info pairs, which denote absolute</span></div><div class='line' id='LC1052'><span class="s">and relative each, and the shift/column to indent to.&quot;</span></div><div class='line' id='LC1053'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">combined-line-end</span> <span class="p">(</span><span class="nf">line-end-position</span><span class="p">))</span></div><div class='line' id='LC1054'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">start-indentation</span> <span class="p">(</span><span class="nf">current-indentation</span><span class="p">)))</span></div><div class='line' id='LC1055'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC1056'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nf">lua-last-token-continues-p</span><span class="p">)</span></div><div class='line' id='LC1057'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-forward-line-skip-blanks</span><span class="p">)</span></div><div class='line' id='LC1058'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">combined-line-end</span> <span class="p">(</span><span class="nf">line-end-position</span><span class="p">))))</span></div><div class='line' id='LC1059'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">search-stop</span> <span class="p">(</span><span class="k">if </span><span class="nv">parse-end</span></div><div class='line' id='LC1060'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">min </span><span class="nv">parse-end</span> <span class="nv">combined-line-end</span><span class="p">)</span></div><div class='line' id='LC1061'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">combined-line-end</span><span class="p">))</span></div><div class='line' id='LC1062'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">indentation-info</span> <span class="nv">nil</span><span class="p">))</span></div><div class='line' id='LC1063'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">parse-start</span> <span class="p">(</span><span class="nf">goto-char</span> <span class="nv">parse-start</span><span class="p">))</span></div><div class='line' id='LC1064'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC1065'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">beginning-of-line</span><span class="p">)</span></div><div class='line' id='LC1066'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nf">lua-find-regexp</span> <span class="ss">&#39;forward</span> <span class="nv">lua-indentation-modifier-regexp</span></div><div class='line' id='LC1067'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">search-stop</span><span class="p">)</span></div><div class='line' id='LC1068'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">found-token</span> <span class="p">(</span><span class="nf">match-string</span> <span class="mi">0</span><span class="p">))</span></div><div class='line' id='LC1069'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">found-pos</span> <span class="p">(</span><span class="nf">match-beginning</span> <span class="mi">0</span><span class="p">))</span></div><div class='line' id='LC1070'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">found-end</span> <span class="p">(</span><span class="nf">match-end</span> <span class="mi">0</span><span class="p">))</span></div><div class='line' id='LC1071'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">data</span> <span class="p">(</span><span class="nf">match-data</span><span class="p">)))</span></div><div class='line' id='LC1072'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">indentation-info</span></div><div class='line' id='LC1073'>		  <span class="p">(</span><span class="nf">lua-add-indentation-info-pair</span></div><div class='line' id='LC1074'>		   <span class="p">(</span><span class="nf">lua-make-indentation-info-pair</span> <span class="nv">found-token</span> <span class="nv">found-pos</span><span class="p">)</span></div><div class='line' id='LC1075'>		   <span class="nv">indentation-info</span><span class="p">))))</span></div><div class='line' id='LC1076'>	<span class="p">(</span><span class="k">or </span><span class="nv">indentation-info</span></div><div class='line' id='LC1077'>	    <span class="p">(</span><span class="nb">list </span><span class="p">(</span><span class="nb">cons </span><span class="ss">&#39;absolute</span> <span class="nv">start-indentation</span><span class="p">)))))))</span></div><div class='line' id='LC1078'><br/></div><div class='line' id='LC1079'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-accumulate-indentation-info</span> <span class="p">(</span><span class="nf">info</span><span class="p">)</span></div><div class='line' id='LC1080'>&nbsp;&nbsp;<span class="s">&quot;Accumulates the indentation information previously calculated by</span></div><div class='line' id='LC1081'><span class="s">lua-calculate-indentation-info. Returns either the relative indentation</span></div><div class='line' id='LC1082'><span class="s">shift, or the absolute column to indent to.&quot;</span></div><div class='line' id='LC1083'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">info-list</span> <span class="p">(</span><span class="nb">reverse </span><span class="nv">info</span><span class="p">))</span></div><div class='line' id='LC1084'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">type</span> <span class="ss">&#39;relative</span><span class="p">)</span></div><div class='line' id='LC1085'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">accu</span> <span class="mi">0</span><span class="p">))</span></div><div class='line' id='LC1086'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">mapc</span> <span class="p">(</span><span class="k">lambda </span><span class="p">(</span><span class="nf">x</span><span class="p">)</span></div><div class='line' id='LC1087'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">accu</span> <span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">eq</span> <span class="ss">&#39;absolute</span> <span class="p">(</span><span class="nb">car </span><span class="nv">x</span><span class="p">))</span></div><div class='line' id='LC1088'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">progn</span> <span class="p">(</span><span class="nf">setq</span> <span class="nv">type</span> <span class="ss">&#39;absolute</span><span class="p">)</span></div><div class='line' id='LC1089'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cdr </span><span class="nv">x</span><span class="p">))</span></div><div class='line' id='LC1090'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">+ </span><span class="nv">accu</span> <span class="p">(</span><span class="nb">cdr </span><span class="nv">x</span><span class="p">)))))</span></div><div class='line' id='LC1091'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">info-list</span><span class="p">)</span></div><div class='line' id='LC1092'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cons </span><span class="nv">type</span> <span class="nv">accu</span><span class="p">)))</span></div><div class='line' id='LC1093'><br/></div><div class='line' id='LC1094'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-calculate-indentation-block-modifier</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">parse-start</span></div><div class='line' id='LC1095'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">parse-end</span><span class="p">)</span></div><div class='line' id='LC1096'>&nbsp;&nbsp;<span class="s">&quot;Return amount by which this line modifies the indentation.</span></div><div class='line' id='LC1097'><span class="s">Beginnings of blocks add lua-indent-level once each, and endings</span></div><div class='line' id='LC1098'><span class="s">of blocks subtract lua-indent-level once each. This function is used</span></div><div class='line' id='LC1099'><span class="s">to determine how the indentation of the following line relates to this</span></div><div class='line' id='LC1100'><span class="s">one.&quot;</span></div><div class='line' id='LC1101'>&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">parse-start</span> <span class="p">(</span><span class="nf">goto-char</span> <span class="nv">parse-start</span><span class="p">))</span></div><div class='line' id='LC1102'>&nbsp;&nbsp;<span class="c1">;; First go back to the line that starts it all</span></div><div class='line' id='LC1103'>&nbsp;&nbsp;<span class="c1">;; lua-calculate-indentation-info will scan through the whole thing</span></div><div class='line' id='LC1104'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nf">lua-is-continuing-statement-p</span><span class="p">)</span></div><div class='line' id='LC1105'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-forward-line-skip-blanks</span> <span class="ss">&#39;back</span><span class="p">))</span></div><div class='line' id='LC1106'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">case-fold-search</span> <span class="nv">nil</span><span class="p">)</span></div><div class='line' id='LC1107'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">indentation-info</span> <span class="p">(</span><span class="nf">lua-accumulate-indentation-info</span></div><div class='line' id='LC1108'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-calculate-indentation-info</span> <span class="nv">nil</span> <span class="nv">parse-end</span><span class="p">))))</span></div><div class='line' id='LC1109'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">eq</span> <span class="p">(</span><span class="nb">car </span><span class="nv">indentation-info</span><span class="p">)</span> <span class="ss">&#39;absolute</span><span class="p">)</span></div><div class='line' id='LC1110'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">- </span><span class="p">(</span><span class="nb">cdr </span><span class="nv">indentation-info</span><span class="p">)</span> <span class="p">(</span><span class="nf">current-indentation</span><span class="p">))</span></div><div class='line' id='LC1111'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">cdr </span><span class="nv">indentation-info</span><span class="p">))))</span></div><div class='line' id='LC1112'><br/></div><div class='line' id='LC1113'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-point-is-after-left-shifter-p</span> <span class="p">()</span></div><div class='line' id='LC1114'>&nbsp;&nbsp;<span class="s">&quot;Check if point is at a left-shifter.</span></div><div class='line' id='LC1115'><span class="s">A left-shifter is a partial lua expression which should be ignored for line up purposes when closing a block. An example of this is:</span></div><div class='line' id='LC1116'><span class="s">   local a = function()</span></div><div class='line' id='LC1117'><span class="s">      ....</span></div><div class='line' id='LC1118'><span class="s">   end</span></div><div class='line' id='LC1119'><span class="s">   ^         ^</span></div><div class='line' id='LC1120'><span class="s">   |         +- not here</span></div><div class='line' id='LC1121'><span class="s">   +- Close here&quot;</span></div><div class='line' id='LC1122'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC1123'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">old-point</span> <span class="p">(</span><span class="nf">point</span><span class="p">)))</span></div><div class='line' id='LC1124'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">back-to-indentation</span><span class="p">)</span></div><div class='line' id='LC1125'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">and</span></div><div class='line' id='LC1126'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="nf">looking-at</span> <span class="s">&quot;local\\s +\\(?:\\(?:\\sw\\|\\s_\\)+\\s *\\(,\\s *\\(?:\\sw\\|\\s_\\)+\\s *\\)*=\\s *\\)?&quot;</span><span class="p">)</span></div><div class='line' id='LC1127'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; This is too generic, and will screw up a lot of indentations. Will need</span></div><div class='line' id='LC1128'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; a better regexp for assignments</span></div><div class='line' id='LC1129'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">looking-at</span> <span class="s">&quot;[^=]*=\\s *&quot;</span><span class="p">))</span></div><div class='line' id='LC1130'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">= </span><span class="nv">old-point</span> <span class="p">(</span><span class="nf">match-end</span> <span class="mi">0</span><span class="p">))))))</span></div><div class='line' id='LC1131'><br/></div><div class='line' id='LC1132'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-calculate-indentation-override</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">parse-start</span><span class="p">)</span></div><div class='line' id='LC1133'>&nbsp;&nbsp;<span class="s">&quot;Return overriding indentation amount for special cases.</span></div><div class='line' id='LC1134'><span class="s">Look for an uninterrupted sequence of block-closing tokens that starts</span></div><div class='line' id='LC1135'><span class="s">at the beginning of the line. For each of these tokens, shift indentation</span></div><div class='line' id='LC1136'><span class="s">to the left by the amount specified in lua-indent-level.&quot;</span></div><div class='line' id='LC1137'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">indentation-modifier</span> <span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC1138'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">case-fold-search</span> <span class="nv">nil</span><span class="p">)</span></div><div class='line' id='LC1139'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">block-token</span> <span class="nv">nil</span><span class="p">))</span></div><div class='line' id='LC1140'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC1141'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">parse-start</span> <span class="p">(</span><span class="nf">goto-char</span> <span class="nv">parse-start</span><span class="p">))</span></div><div class='line' id='LC1142'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Look for the last block closing token</span></div><div class='line' id='LC1143'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">back-to-indentation</span><span class="p">)</span></div><div class='line' id='LC1144'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nb">not </span><span class="p">(</span><span class="nf">lua-comment-or-string-p</span><span class="p">))</span></div><div class='line' id='LC1145'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">looking-at</span> <span class="nv">lua-indentation-modifier-regexp</span><span class="p">)</span></div><div class='line' id='LC1146'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">token-info</span> <span class="p">(</span><span class="nf">lua-get-block-token-info</span> <span class="p">(</span><span class="nf">match-string</span> <span class="mi">0</span><span class="p">))))</span></div><div class='line' id='LC1147'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">and </span><span class="nv">token-info</span></div><div class='line' id='LC1148'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">not </span><span class="p">(</span><span class="nf">eq</span> <span class="ss">&#39;open</span> <span class="p">(</span><span class="nf">lua-get-token-type</span> <span class="nv">token-info</span><span class="p">))))))</span></div><div class='line' id='LC1149'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="p">(</span><span class="nf">lua-goto-matching-block-token</span> <span class="nv">nil</span> <span class="nv">nil</span> <span class="ss">&#39;backward</span><span class="p">)</span></div><div class='line' id='LC1150'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Exception cases: when the start of the line is an assignment,</span></div><div class='line' id='LC1151'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; go to the start of the assignment instead of the matching item</span></div><div class='line' id='LC1152'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">block-start-column</span> <span class="p">(</span><span class="nf">current-column</span><span class="p">))</span></div><div class='line' id='LC1153'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">block-start-point</span> <span class="p">(</span><span class="nf">point</span><span class="p">)))</span></div><div class='line' id='LC1154'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">lua-point-is-after-left-shifter-p</span><span class="p">)</span></div><div class='line' id='LC1155'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">current-indentation</span><span class="p">)</span></div><div class='line' id='LC1156'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">block-start-column</span><span class="p">)))))))</span></div><div class='line' id='LC1157'><br/></div><div class='line' id='LC1158'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-calculate-indentation</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">parse-start</span><span class="p">)</span></div><div class='line' id='LC1159'>&nbsp;&nbsp;<span class="s">&quot;Return appropriate indentation for current line as Lua code.&quot;</span></div><div class='line' id='LC1160'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC1161'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">continuing-p</span> <span class="p">(</span><span class="nf">lua-is-continuing-statement-p</span><span class="p">)))</span></div><div class='line' id='LC1162'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">or</span></div><div class='line' id='LC1163'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; when calculating indentation, do the following:</span></div><div class='line' id='LC1164'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; 1. check, if the line starts with indentation-modifier (open/close brace)</span></div><div class='line' id='LC1165'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;;    and if it should be indented/unindented in special way</span></div><div class='line' id='LC1166'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-calculate-indentation-override</span><span class="p">)</span></div><div class='line' id='LC1167'><br/></div><div class='line' id='LC1168'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; 2. otherwise, use indentation modifiers from previous line + it&#39;s own indentation</span></div><div class='line' id='LC1169'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; 3. if previous line doesn&#39;t contain indentation modifiers, additionally check</span></div><div class='line' id='LC1170'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;;    if current line is a continuation line and add lua-indent-level if it is</span></div><div class='line' id='LC1171'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="p">(</span><span class="nf">lua-forward-line-skip-blanks</span> <span class="ss">&#39;back</span><span class="p">)</span></div><div class='line' id='LC1172'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; the order of function calls here is important. block modifier</span></div><div class='line' id='LC1173'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; call may change the point to another line</span></div><div class='line' id='LC1174'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">modifier</span></div><div class='line' id='LC1175'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-calculate-indentation-block-modifier</span> <span class="nv">nil</span> <span class="p">(</span><span class="nf">line-end-position</span><span class="p">))))</span></div><div class='line' id='LC1176'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">+ </span><span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">and </span><span class="nv">continuing-p</span> <span class="p">(</span><span class="nb">= </span><span class="mi">0</span> <span class="nv">modifier</span><span class="p">))</span></div><div class='line' id='LC1177'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">lua-indent-level</span></div><div class='line' id='LC1178'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">modifier</span><span class="p">)</span></div><div class='line' id='LC1179'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">current-indentation</span><span class="p">))))</span></div><div class='line' id='LC1180'><br/></div><div class='line' id='LC1181'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; 4. if there&#39;s no previous line, indentation is 0</span></div><div class='line' id='LC1182'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="mi">0</span><span class="p">))))</span></div><div class='line' id='LC1183'><br/></div><div class='line' id='LC1184'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-beginning-of-proc</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">arg</span><span class="p">)</span></div><div class='line' id='LC1185'>&nbsp;&nbsp;<span class="s">&quot;Move backward to the beginning of a lua proc (or similar).</span></div><div class='line' id='LC1186'><span class="s">With argument, do it that many times.  Negative arg -N</span></div><div class='line' id='LC1187'><span class="s">means move forward to Nth following beginning of proc.</span></div><div class='line' id='LC1188'><span class="s">Returns t unless search stops due to beginning or end of buffer.&quot;</span></div><div class='line' id='LC1189'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span> <span class="s">&quot;P&quot;</span><span class="p">)</span></div><div class='line' id='LC1190'>&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="nv">arg</span></div><div class='line' id='LC1191'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">arg</span> <span class="mi">1</span><span class="p">))</span></div><div class='line' id='LC1192'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">found</span> <span class="nv">nil</span><span class="p">)</span></div><div class='line' id='LC1193'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">ret</span> <span class="nv">t</span><span class="p">))</span></div><div class='line' id='LC1194'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nb">&lt; </span><span class="nv">arg</span> <span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC1195'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">re-search-forward</span> <span class="s">&quot;^function[ \t]&quot;</span> <span class="nv">nil</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC1196'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">arg</span> <span class="p">(</span><span class="mi">1</span><span class="nv">+</span> <span class="nv">arg</span><span class="p">)</span></div><div class='line' id='LC1197'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">found</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC1198'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">ret</span> <span class="nv">nil</span></div><div class='line' id='LC1199'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">arg</span> <span class="mi">0</span><span class="p">)))</span></div><div class='line' id='LC1200'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">found</span></div><div class='line' id='LC1201'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">beginning-of-line</span><span class="p">))</span></div><div class='line' id='LC1202'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nb">&gt; </span><span class="nv">arg</span> <span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC1203'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">re-search-forward</span> <span class="s">&quot;^function[ \t]&quot;</span> <span class="nv">nil</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC1204'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">arg</span> <span class="p">(</span><span class="mi">1</span><span class="nv">+</span> <span class="nv">arg</span><span class="p">))</span></div><div class='line' id='LC1205'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">goto-char</span> <span class="p">(</span><span class="nf">point-max</span><span class="p">))))</span></div><div class='line' id='LC1206'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nb">&gt; </span><span class="nv">arg</span> <span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC1207'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">re-search-backward</span> <span class="s">&quot;^function[ \t]&quot;</span> <span class="nv">nil</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC1208'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">arg</span> <span class="p">(</span><span class="mi">1</span><span class="nv">-</span> <span class="nv">arg</span><span class="p">))</span></div><div class='line' id='LC1209'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">ret</span> <span class="nv">nil</span></div><div class='line' id='LC1210'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">arg</span> <span class="mi">0</span><span class="p">)))</span></div><div class='line' id='LC1211'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">ret</span><span class="p">))</span></div><div class='line' id='LC1212'><br/></div><div class='line' id='LC1213'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-end-of-proc</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">arg</span><span class="p">)</span></div><div class='line' id='LC1214'>&nbsp;&nbsp;<span class="s">&quot;Move forward to next end of lua proc (or similar).</span></div><div class='line' id='LC1215'><span class="s">With argument, do it that many times.  Negative argument -N means move</span></div><div class='line' id='LC1216'><span class="s">back to Nth preceding end of proc.</span></div><div class='line' id='LC1217'><br/></div><div class='line' id='LC1218'><span class="s">This function just searches for a `end&#39; at the beginning of a line.&quot;</span></div><div class='line' id='LC1219'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span> <span class="s">&quot;P&quot;</span><span class="p">)</span></div><div class='line' id='LC1220'>&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="nv">arg</span></div><div class='line' id='LC1221'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">arg</span> <span class="mi">1</span><span class="p">))</span></div><div class='line' id='LC1222'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">found</span> <span class="nv">nil</span><span class="p">)</span></div><div class='line' id='LC1223'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">ret</span> <span class="nv">t</span><span class="p">))</span></div><div class='line' id='LC1224'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nb">&lt; </span><span class="nv">arg</span> <span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC1225'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nb">not </span><span class="p">(</span><span class="nf">bolp</span><span class="p">))</span></div><div class='line' id='LC1226'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC1227'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">beginning-of-line</span><span class="p">)</span></div><div class='line' id='LC1228'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">eq</span> <span class="p">(</span><span class="nf">following-char</span><span class="p">)</span> <span class="nv">?</span><span class="err">}</span><span class="p">)))</span></div><div class='line' id='LC1229'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">forward-char</span> <span class="mi">-1</span><span class="p">))</span></div><div class='line' id='LC1230'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nb">&gt; </span><span class="nv">arg</span> <span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC1231'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">re-search-forward</span> <span class="s">&quot;^end&quot;</span> <span class="nv">nil</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC1232'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">arg</span> <span class="p">(</span><span class="mi">1</span><span class="nv">-</span> <span class="nv">arg</span><span class="p">)</span></div><div class='line' id='LC1233'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">found</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC1234'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">ret</span> <span class="nv">nil</span></div><div class='line' id='LC1235'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">arg</span> <span class="mi">0</span><span class="p">)))</span></div><div class='line' id='LC1236'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nb">&lt; </span><span class="nv">arg</span> <span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC1237'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">re-search-backward</span> <span class="s">&quot;^end&quot;</span> <span class="nv">nil</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC1238'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">arg</span> <span class="p">(</span><span class="mi">1</span><span class="nv">+</span> <span class="nv">arg</span><span class="p">)</span></div><div class='line' id='LC1239'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">found</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC1240'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">ret</span> <span class="nv">nil</span></div><div class='line' id='LC1241'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">arg</span> <span class="mi">0</span><span class="p">)))</span></div><div class='line' id='LC1242'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">found</span></div><div class='line' id='LC1243'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">progn</span></div><div class='line' id='LC1244'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">beginning-of-line</span><span class="p">)</span></div><div class='line' id='LC1245'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">forward-line</span><span class="p">)))</span></div><div class='line' id='LC1246'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">ret</span><span class="p">))</span></div><div class='line' id='LC1247'><br/></div><div class='line' id='LC1248'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-start-process</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">name</span> <span class="nv">program</span> <span class="nv">startfile</span> <span class="nv">&amp;rest</span> <span class="nv">switches</span><span class="p">)</span></div><div class='line' id='LC1249'>&nbsp;&nbsp;<span class="s">&quot;Start a lua process named NAME, running PROGRAM.</span></div><div class='line' id='LC1250'><span class="s">PROGRAM defaults to NAME, which defaults to `lua-default-application&#39;.</span></div><div class='line' id='LC1251'><span class="s">When called interactively, switch to the process buffer.&quot;</span></div><div class='line' id='LC1252'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1253'>&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="nv">switches</span></div><div class='line' id='LC1254'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">switches</span> <span class="nv">lua-default-command-switches</span><span class="p">))</span></div><div class='line' id='LC1255'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">name</span> <span class="p">(</span><span class="k">or </span><span class="nv">name</span> <span class="nv">lua-default-application</span><span class="p">))</span></div><div class='line' id='LC1256'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">program</span> <span class="p">(</span><span class="k">or </span><span class="nv">program</span> <span class="nv">name</span><span class="p">))</span></div><div class='line' id='LC1257'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">lua-process-buffer</span> <span class="p">(</span><span class="nb">apply </span><span class="ss">&#39;make-comint</span> <span class="nv">name</span> <span class="nv">program</span> <span class="nv">startfile</span> <span class="nv">switches</span><span class="p">))</span></div><div class='line' id='LC1258'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">lua-process</span> <span class="p">(</span><span class="nf">get-buffer-process</span> <span class="nv">lua-process-buffer</span><span class="p">))</span></div><div class='line' id='LC1259'>&nbsp;&nbsp;<span class="c1">;; wait for prompt</span></div><div class='line' id='LC1260'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">with-current-buffer</span> <span class="nv">lua-process-buffer</span></div><div class='line' id='LC1261'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nb">not </span><span class="p">(</span><span class="nf">lua-prompt-line</span><span class="p">))</span></div><div class='line' id='LC1262'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">accept-process-output</span> <span class="p">(</span><span class="nf">get-buffer-process</span> <span class="p">(</span><span class="nf">current-buffer</span><span class="p">)))</span></div><div class='line' id='LC1263'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">goto-char</span> <span class="p">(</span><span class="nf">point-max</span><span class="p">))))</span></div><div class='line' id='LC1264'>&nbsp;&nbsp;<span class="c1">;; when called interactively, switch to process buffer</span></div><div class='line' id='LC1265'>&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">lua--called-interactively-p</span> <span class="ss">&#39;any</span><span class="p">)</span></div><div class='line' id='LC1266'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">switch-to-buffer</span> <span class="nv">lua-process-buffer</span><span class="p">)))</span></div><div class='line' id='LC1267'><br/></div><div class='line' id='LC1268'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-kill-process</span> <span class="p">()</span></div><div class='line' id='LC1269'>&nbsp;&nbsp;<span class="s">&quot;Kill lua subprocess and its buffer.&quot;</span></div><div class='line' id='LC1270'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1271'>&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">lua-process-buffer</span></div><div class='line' id='LC1272'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">kill-buffer</span> <span class="nv">lua-process-buffer</span><span class="p">)))</span></div><div class='line' id='LC1273'><br/></div><div class='line' id='LC1274'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-set-lua-region-start</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">arg</span><span class="p">)</span></div><div class='line' id='LC1275'>&nbsp;&nbsp;<span class="s">&quot;Set start of region for use with `lua-send-lua-region&#39;.&quot;</span></div><div class='line' id='LC1276'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1277'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">set-marker</span> <span class="nv">lua-region-start</span> <span class="p">(</span><span class="k">or </span><span class="nv">arg</span> <span class="p">(</span><span class="nf">point</span><span class="p">))))</span></div><div class='line' id='LC1278'><br/></div><div class='line' id='LC1279'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-set-lua-region-end</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">arg</span><span class="p">)</span></div><div class='line' id='LC1280'>&nbsp;&nbsp;<span class="s">&quot;Set end of region for use with `lua-send-lua-region&#39;.&quot;</span></div><div class='line' id='LC1281'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1282'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">set-marker</span> <span class="nv">lua-region-end</span> <span class="p">(</span><span class="k">or </span><span class="nv">arg</span> <span class="p">(</span><span class="nf">point</span><span class="p">))))</span></div><div class='line' id='LC1283'><br/></div><div class='line' id='LC1284'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-send-current-line</span> <span class="p">()</span></div><div class='line' id='LC1285'>&nbsp;&nbsp;<span class="s">&quot;Send current line to lua subprocess, found in `lua-process&#39;.</span></div><div class='line' id='LC1286'><span class="s">If `lua-process&#39; is nil or dead, start a new process first.&quot;</span></div><div class='line' id='LC1287'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1288'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-send-region</span> <span class="p">(</span><span class="nf">line-beginning-position</span><span class="p">)</span> <span class="p">(</span><span class="nf">line-end-position</span><span class="p">)))</span></div><div class='line' id='LC1289'><br/></div><div class='line' id='LC1290'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-send-region</span> <span class="p">(</span><span class="nf">start</span> <span class="nv">end</span><span class="p">)</span></div><div class='line' id='LC1291'>&nbsp;&nbsp;<span class="s">&quot;Send region to lua subprocess.&quot;</span></div><div class='line' id='LC1292'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span> <span class="s">&quot;r&quot;</span><span class="p">)</span></div><div class='line' id='LC1293'>&nbsp;&nbsp;<span class="c1">;; make temporary lua file</span></div><div class='line' id='LC1294'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">tempfile</span> <span class="p">(</span><span class="nf">lua-make-temp-file</span> <span class="s">&quot;lua-&quot;</span><span class="p">))</span></div><div class='line' id='LC1295'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">last-prompt</span> <span class="nv">nil</span><span class="p">)</span></div><div class='line' id='LC1296'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">prompt-found</span> <span class="nv">nil</span><span class="p">)</span></div><div class='line' id='LC1297'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-stdin-line-offset</span> <span class="p">(</span><span class="nf">count-lines</span> <span class="p">(</span><span class="nf">point-min</span><span class="p">)</span> <span class="nv">start</span><span class="p">))</span></div><div class='line' id='LC1298'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-stdin-buffer</span> <span class="p">(</span><span class="nf">current-buffer</span><span class="p">))</span></div><div class='line' id='LC1299'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">current-prompt</span> <span class="p">)</span></div><div class='line' id='LC1300'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">write-region</span> <span class="nv">start</span> <span class="nv">end</span> <span class="nv">tempfile</span><span class="p">)</span></div><div class='line' id='LC1301'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="k">and </span><span class="nv">lua-process</span></div><div class='line' id='LC1302'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">comint-check-proc</span> <span class="nv">lua-process-buffer</span><span class="p">))</span></div><div class='line' id='LC1303'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-start-process</span> <span class="nv">lua-default-application</span><span class="p">))</span></div><div class='line' id='LC1304'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; kill lua process without query</span></div><div class='line' id='LC1305'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">fboundp</span> <span class="ss">&#39;process-kill-without-query</span><span class="p">)</span></div><div class='line' id='LC1306'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">process-kill-without-query</span> <span class="nv">lua-process</span><span class="p">))</span></div><div class='line' id='LC1307'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; send dofile(tempfile)</span></div><div class='line' id='LC1308'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">with-current-buffer</span> <span class="nv">lua-process-buffer</span></div><div class='line' id='LC1309'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">goto-char</span> <span class="p">(</span><span class="nf">point-max</span><span class="p">))</span></div><div class='line' id='LC1310'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">last-prompt</span> <span class="p">(</span><span class="nf">point-max</span><span class="p">))</span></div><div class='line' id='LC1311'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">comint-simple-send</span> <span class="p">(</span><span class="nf">get-buffer-process</span> <span class="p">(</span><span class="nf">current-buffer</span><span class="p">))</span></div><div class='line' id='LC1312'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">format</span> <span class="s">&quot;dofile(\&quot;%s\&quot;)&quot;</span></div><div class='line' id='LC1313'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">replace-regexp-in-string</span> <span class="s">&quot;\\\\&quot;</span> <span class="s">&quot;\\\\\\\\&quot;</span> <span class="nv">tempfile</span><span class="p">)))</span></div><div class='line' id='LC1314'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; wait for prompt</span></div><div class='line' id='LC1315'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nb">not </span><span class="nv">prompt-found</span><span class="p">)</span></div><div class='line' id='LC1316'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">accept-process-output</span> <span class="p">(</span><span class="nf">get-buffer-process</span> <span class="p">(</span><span class="nf">current-buffer</span><span class="p">)))</span></div><div class='line' id='LC1317'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">goto-char</span> <span class="p">(</span><span class="nf">point-max</span><span class="p">))</span></div><div class='line' id='LC1318'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">prompt-found</span> <span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nf">lua-prompt-line</span><span class="p">)</span> <span class="p">(</span><span class="nb">&lt; </span><span class="nv">last-prompt</span> <span class="p">(</span><span class="nf">point-max</span><span class="p">)))))</span></div><div class='line' id='LC1319'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; remove temp. lua file</span></div><div class='line' id='LC1320'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">delete-file</span> <span class="nv">tempfile</span><span class="p">)</span></div><div class='line' id='LC1321'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-postprocess-output-buffer</span> <span class="nv">lua-process-buffer</span> <span class="nv">last-prompt</span> <span class="nv">lua-stdin-line-offset</span><span class="p">)</span></div><div class='line' id='LC1322'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">lua-always-show</span></div><div class='line' id='LC1323'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">display-buffer</span> <span class="nv">lua-process-buffer</span><span class="p">)))))</span></div><div class='line' id='LC1324'><br/></div><div class='line' id='LC1325'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-postprocess-output-buffer</span> <span class="p">(</span><span class="nf">buf</span> <span class="nv">start</span> <span class="nv">&amp;optional</span> <span class="nv">lua-stdin-line-offset</span><span class="p">)</span></div><div class='line' id='LC1326'>&nbsp;&nbsp;<span class="s">&quot;Highlight tracebacks found in buf. If an traceback occurred return</span></div><div class='line' id='LC1327'><span class="s">t, otherwise return nil.  BUF must exist.&quot;</span></div><div class='line' id='LC1328'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">lua-stdin-line-offset</span> <span class="p">(</span><span class="k">or </span><span class="nv">lua-stdin-line-offset</span> <span class="mi">0</span><span class="p">))</span></div><div class='line' id='LC1329'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">line</span> <span class="nv">file</span> <span class="nv">bol</span> <span class="nv">err-p</span><span class="p">)</span></div><div class='line' id='LC1330'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">with-current-buffer</span> <span class="nv">buf</span></div><div class='line' id='LC1331'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">goto-char</span> <span class="nv">start</span><span class="p">)</span></div><div class='line' id='LC1332'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">beginning-of-line</span><span class="p">)</span></div><div class='line' id='LC1333'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">re-search-forward</span> <span class="nv">lua-traceback-line-re</span> <span class="nv">nil</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC1334'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">file</span> <span class="p">(</span><span class="nf">match-string</span> <span class="mi">1</span><span class="p">)</span></div><div class='line' id='LC1335'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">line</span> <span class="p">(</span><span class="nf">string-to-number</span> <span class="p">(</span><span class="nf">match-string</span> <span class="mi">2</span><span class="p">)))))</span></div><div class='line' id='LC1336'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="p">(</span><span class="k">and </span><span class="nv">lua-jump-on-traceback</span> <span class="nv">line</span><span class="p">)</span></div><div class='line' id='LC1337'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">beep</span><span class="p">)</span></div><div class='line' id='LC1338'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; FIXME: highlight</span></div><div class='line' id='LC1339'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-jump-to-traceback</span> <span class="nv">file</span> <span class="nv">line</span> <span class="nv">lua-stdin-line-offset</span><span class="p">)</span></div><div class='line' id='LC1340'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">err-p</span> <span class="nv">t</span><span class="p">))</span></div><div class='line' id='LC1341'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">err-p</span><span class="p">))</span></div><div class='line' id='LC1342'><br/></div><div class='line' id='LC1343'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-jump-to-traceback</span> <span class="p">(</span><span class="nf">file</span> <span class="nv">line</span> <span class="nv">lua-stdin-line-offset</span><span class="p">)</span></div><div class='line' id='LC1344'>&nbsp;&nbsp;<span class="s">&quot;Jump to the Lua code in FILE at LINE.&quot;</span></div><div class='line' id='LC1345'>&nbsp;&nbsp;<span class="c1">;; sanity check: temporary-file-directory</span></div><div class='line' id='LC1346'>&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">string=</span> <span class="p">(</span><span class="nb">substring </span><span class="nv">file</span> <span class="mi">0</span> <span class="mi">3</span><span class="p">)</span>  <span class="s">&quot;...&quot;</span><span class="p">)</span></div><div class='line' id='LC1347'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">message</span> <span class="s">&quot;Lua traceback output truncated: customize &#39;temporary-file-directory&#39; or increase &#39;LUA_IDSIZE&#39; in &#39;luaconf.h&#39;.&quot;</span><span class="p">)</span></div><div class='line' id='LC1348'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">buffer</span> <span class="p">(</span><span class="k">cond </span><span class="p">((</span><span class="k">or </span><span class="p">(</span><span class="nf">string-equal</span> <span class="nv">file</span> <span class="nv">tempfile</span><span class="p">)</span> <span class="p">(</span><span class="nf">string-equal</span> <span class="nv">file</span> <span class="s">&quot;stdin&quot;</span><span class="p">))</span></div><div class='line' id='LC1349'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">line</span> <span class="p">(</span><span class="nb">+ </span><span class="nv">line</span> <span class="nv">lua-stdin-line-offset</span><span class="p">))</span></div><div class='line' id='LC1350'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">lua-stdin-buffer</span><span class="p">)</span></div><div class='line' id='LC1351'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">t</span> <span class="p">(</span><span class="nf">find-file-noselect</span> <span class="nv">file</span><span class="p">)))))</span></div><div class='line' id='LC1352'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">pop-to-buffer</span> <span class="nv">buffer</span><span class="p">)</span></div><div class='line' id='LC1353'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; Force Lua mode</span></div><div class='line' id='LC1354'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nb">not </span><span class="p">(</span><span class="nf">eq</span> <span class="nv">major-mode</span> <span class="ss">&#39;lua-mode</span><span class="p">))</span></div><div class='line' id='LC1355'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-mode</span><span class="p">))</span></div><div class='line' id='LC1356'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; FIXME: fix offset when executing region</span></div><div class='line' id='LC1357'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">goto-char</span> <span class="p">(</span><span class="nf">point-min</span><span class="p">))</span> <span class="p">(</span><span class="nf">forward-line</span> <span class="p">(</span><span class="mi">1</span><span class="nv">-</span> <span class="nv">line</span><span class="p">))</span></div><div class='line' id='LC1358'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">message</span> <span class="s">&quot;Jumping to error in file %s on line %d&quot;</span> <span class="nv">file</span> <span class="nv">line</span><span class="p">))))</span></div><div class='line' id='LC1359'><br/></div><div class='line' id='LC1360'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-prompt-line</span> <span class="p">()</span></div><div class='line' id='LC1361'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC1362'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-match-data</span></div><div class='line' id='LC1363'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">forward-line</span> <span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC1364'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">looking-at</span> <span class="nv">comint-prompt-regexp</span><span class="p">)</span></div><div class='line' id='LC1365'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">match-end</span> <span class="mi">0</span><span class="p">)))))</span></div><div class='line' id='LC1366'><br/></div><div class='line' id='LC1367'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-send-lua-region</span> <span class="p">()</span></div><div class='line' id='LC1368'>&nbsp;&nbsp;<span class="s">&quot;Send preset lua region to lua subprocess.&quot;</span></div><div class='line' id='LC1369'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1370'>&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="k">and </span><span class="nv">lua-region-start</span> <span class="nv">lua-region-end</span><span class="p">)</span></div><div class='line' id='LC1371'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">error</span> <span class="s">&quot;lua-region not set&quot;</span><span class="p">))</span></div><div class='line' id='LC1372'>&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="k">and </span><span class="nv">lua-process</span></div><div class='line' id='LC1373'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">comint-check-proc</span> <span class="nv">lua-process-buffer</span><span class="p">))</span></div><div class='line' id='LC1374'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-start-process</span> <span class="nv">lua-default-application</span><span class="p">))</span></div><div class='line' id='LC1375'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">comint-simple-send</span> <span class="nv">lua-process</span></div><div class='line' id='LC1376'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">buffer-substring</span> <span class="nv">lua-region-start</span> <span class="nv">lua-region-end</span><span class="p">)</span></div><div class='line' id='LC1377'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">)</span></div><div class='line' id='LC1378'>&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">lua-always-show</span></div><div class='line' id='LC1379'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">display-buffer</span> <span class="nv">lua-process-buffer</span><span class="p">)))</span></div><div class='line' id='LC1380'><br/></div><div class='line' id='LC1381'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-send-proc</span> <span class="p">()</span></div><div class='line' id='LC1382'>&nbsp;&nbsp;<span class="s">&quot;Send proc around point to lua subprocess.&quot;</span></div><div class='line' id='LC1383'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1384'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">(</span><span class="nf">beg</span> <span class="nv">end</span><span class="p">)</span></div><div class='line' id='LC1385'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC1386'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-beginning-of-proc</span><span class="p">)</span></div><div class='line' id='LC1387'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">beg</span> <span class="p">(</span><span class="nf">point</span><span class="p">))</span></div><div class='line' id='LC1388'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-end-of-proc</span><span class="p">)</span></div><div class='line' id='LC1389'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">end</span> <span class="p">(</span><span class="nf">point</span><span class="p">)))</span></div><div class='line' id='LC1390'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="k">and </span><span class="nv">lua-process</span></div><div class='line' id='LC1391'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">comint-check-proc</span> <span class="nv">lua-process-buffer</span><span class="p">))</span></div><div class='line' id='LC1392'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-start-process</span> <span class="nv">lua-default-application</span><span class="p">))</span></div><div class='line' id='LC1393'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">comint-simple-send</span> <span class="nv">lua-process</span></div><div class='line' id='LC1394'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">buffer-substring</span> <span class="nv">beg</span> <span class="nv">end</span><span class="p">))</span></div><div class='line' id='LC1395'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">lua-always-show</span></div><div class='line' id='LC1396'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">display-buffer</span> <span class="nv">lua-process-buffer</span><span class="p">))))</span></div><div class='line' id='LC1397'><br/></div><div class='line' id='LC1398'><span class="c1">;; FIXME: This needs work... -Bret</span></div><div class='line' id='LC1399'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-send-buffer</span> <span class="p">()</span></div><div class='line' id='LC1400'>&nbsp;&nbsp;<span class="s">&quot;Send whole buffer to lua subprocess.&quot;</span></div><div class='line' id='LC1401'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1402'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-send-region</span> <span class="p">(</span><span class="nf">point-min</span><span class="p">)</span> <span class="p">(</span><span class="nf">point-max</span><span class="p">)))</span></div><div class='line' id='LC1403'><br/></div><div class='line' id='LC1404'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-restart-with-whole-file</span> <span class="p">()</span></div><div class='line' id='LC1405'>&nbsp;&nbsp;<span class="s">&quot;Restart lua subprocess and send whole file as input.&quot;</span></div><div class='line' id='LC1406'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1407'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-kill-process</span><span class="p">)</span></div><div class='line' id='LC1408'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-start-process</span> <span class="nv">lua-default-application</span><span class="p">)</span></div><div class='line' id='LC1409'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-send-buffer</span><span class="p">))</span></div><div class='line' id='LC1410'><br/></div><div class='line' id='LC1411'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-show-process-buffer</span> <span class="p">()</span></div><div class='line' id='LC1412'>&nbsp;&nbsp;<span class="s">&quot;Make sure `lua-process-buffer&#39; is being displayed.&quot;</span></div><div class='line' id='LC1413'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1414'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">display-buffer</span> <span class="nv">lua-process-buffer</span><span class="p">))</span></div><div class='line' id='LC1415'><br/></div><div class='line' id='LC1416'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-hide-process-buffer</span> <span class="p">()</span></div><div class='line' id='LC1417'>&nbsp;&nbsp;<span class="s">&quot;Delete all windows that display `lua-process-buffer&#39;.&quot;</span></div><div class='line' id='LC1418'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1419'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">delete-windows-on</span> <span class="nv">lua-process-buffer</span><span class="p">))</span></div><div class='line' id='LC1420'><br/></div><div class='line' id='LC1421'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-search-documentation</span> <span class="p">()</span></div><div class='line' id='LC1422'>&nbsp;&nbsp;<span class="s">&quot;Search Lua documentation for the word at the point.&quot;</span></div><div class='line' id='LC1423'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1424'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">browse-url</span> <span class="p">(</span><span class="nf">concat</span> <span class="nv">lua-search-url-prefix</span> <span class="p">(</span><span class="nf">current-word</span> <span class="nv">t</span><span class="p">))))</span></div><div class='line' id='LC1425'><br/></div><div class='line' id='LC1426'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-toggle-electric-state</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">arg</span><span class="p">)</span></div><div class='line' id='LC1427'>&nbsp;&nbsp;<span class="s">&quot;Toggle the electric indentation feature.</span></div><div class='line' id='LC1428'><span class="s">Optional numeric ARG, if supplied, turns on electric indentation when</span></div><div class='line' id='LC1429'><span class="s">positive, turns it off when negative, and just toggles it when zero or</span></div><div class='line' id='LC1430'><span class="s">left out.&quot;</span></div><div class='line' id='LC1431'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span> <span class="s">&quot;P&quot;</span><span class="p">)</span></div><div class='line' id='LC1432'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">num_arg</span> <span class="p">(</span><span class="nf">prefix-numeric-value</span> <span class="nv">arg</span><span class="p">)))</span></div><div class='line' id='LC1433'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">lua-electric-flag</span> <span class="p">(</span><span class="k">cond </span><span class="p">((</span><span class="k">or </span><span class="p">(</span><span class="nf">null</span> <span class="nv">arg</span><span class="p">)</span></div><div class='line' id='LC1434'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">zerop</span> <span class="nv">num_arg</span><span class="p">))</span> <span class="p">(</span><span class="nb">not </span><span class="nv">lua-electric-flag</span><span class="p">))</span></div><div class='line' id='LC1435'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nb">&lt; </span><span class="nv">num_arg</span> <span class="mi">0</span><span class="p">)</span> <span class="nv">nil</span><span class="p">)</span></div><div class='line' id='LC1436'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nb">&gt; </span><span class="nv">num_arg</span> <span class="mi">0</span><span class="p">)</span> <span class="nv">t</span><span class="p">))))</span></div><div class='line' id='LC1437'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">message</span> <span class="s">&quot;%S&quot;</span> <span class="nv">lua-electric-flag</span><span class="p">))</span></div><div class='line' id='LC1438'><br/></div><div class='line' id='LC1439'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-forward-sexp</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">count</span><span class="p">)</span></div><div class='line' id='LC1440'>&nbsp;&nbsp;<span class="s">&quot;Forward to block end&quot;</span></div><div class='line' id='LC1441'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span> <span class="s">&quot;p&quot;</span><span class="p">)</span></div><div class='line' id='LC1442'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-match-data</span></div><div class='line' id='LC1443'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let* </span><span class="p">((</span><span class="nf">count</span> <span class="p">(</span><span class="k">or </span><span class="nv">count</span> <span class="mi">1</span><span class="p">))</span></div><div class='line' id='LC1444'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">block-start</span> <span class="p">(</span><span class="nf">mapcar</span> <span class="ss">&#39;car</span> <span class="nv">lua-sexp-alist</span><span class="p">))</span></div><div class='line' id='LC1445'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">block-end</span> <span class="p">(</span><span class="nf">mapcar</span> <span class="ss">&#39;cdr</span> <span class="nv">lua-sexp-alist</span><span class="p">))</span></div><div class='line' id='LC1446'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">block-regex</span> <span class="p">(</span><span class="nf">regexp-opt</span> <span class="p">(</span><span class="nb">append </span> <span class="nv">block-start</span> <span class="nv">block-end</span><span class="p">)</span> <span class="ss">&#39;words</span><span class="p">))</span></div><div class='line' id='LC1447'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">current-exp</span></div><div class='line' id='LC1448'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">)</span></div><div class='line' id='LC1449'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nb">&gt; </span><span class="nv">count</span> <span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC1450'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; skip whitespace</span></div><div class='line' id='LC1451'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">skip-chars-forward</span> <span class="s">&quot; \t\n&quot;</span><span class="p">)</span></div><div class='line' id='LC1452'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">looking-at</span> <span class="p">(</span><span class="nf">regexp-opt</span> <span class="nv">block-start</span> <span class="ss">&#39;words</span><span class="p">))</span></div><div class='line' id='LC1453'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">keyword</span> <span class="p">(</span><span class="nf">match-string</span> <span class="mi">1</span><span class="p">)))</span></div><div class='line' id='LC1454'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-find-matching-token-word</span> <span class="nv">keyword</span> <span class="nv">nil</span><span class="p">))</span></div><div class='line' id='LC1455'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; If the current keyword is not a &quot;begin&quot; keyword, then just</span></div><div class='line' id='LC1456'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; perform the normal forward-sexp.</span></div><div class='line' id='LC1457'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">forward-sexp</span> <span class="mi">1</span><span class="p">))</span></div><div class='line' id='LC1458'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">count</span> <span class="p">(</span><span class="mi">1</span><span class="nv">-</span> <span class="nv">count</span><span class="p">))))))</span></div><div class='line' id='LC1459'><br/></div><div class='line' id='LC1460'><br/></div><div class='line' id='LC1461'><span class="c1">;; menu bar</span></div><div class='line' id='LC1462'><br/></div><div class='line' id='LC1463'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">restart-with-whole-file</span><span class="err">]</span></div><div class='line' id='LC1464'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;Restart With Whole File&quot;</span> <span class="o">.</span>  <span class="nv">lua-restart-with-whole-file</span><span class="p">))</span></div><div class='line' id='LC1465'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">kill-process</span><span class="err">]</span></div><div class='line' id='LC1466'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;Kill Process&quot;</span> <span class="o">.</span> <span class="nv">lua-kill-process</span><span class="p">))</span></div><div class='line' id='LC1467'><br/></div><div class='line' id='LC1468'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">hide-process-buffer</span><span class="err">]</span></div><div class='line' id='LC1469'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;Hide Process Buffer&quot;</span> <span class="o">.</span> <span class="nv">lua-hide-process-buffer</span><span class="p">))</span></div><div class='line' id='LC1470'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">show-process-buffer</span><span class="err">]</span></div><div class='line' id='LC1471'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;Show Process Buffer&quot;</span> <span class="o">.</span> <span class="nv">lua-show-process-buffer</span><span class="p">))</span></div><div class='line' id='LC1472'><br/></div><div class='line' id='LC1473'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">end-of-proc</span><span class="err">]</span></div><div class='line' id='LC1474'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;End Of Proc&quot;</span> <span class="o">.</span> <span class="nv">lua-end-of-proc</span><span class="p">))</span></div><div class='line' id='LC1475'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">beginning-of-proc</span><span class="err">]</span></div><div class='line' id='LC1476'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;Beginning Of Proc&quot;</span> <span class="o">.</span> <span class="nv">lua-beginning-of-proc</span><span class="p">))</span></div><div class='line' id='LC1477'><br/></div><div class='line' id='LC1478'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">send-lua-region</span><span class="err">]</span></div><div class='line' id='LC1479'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;Send Lua-Region&quot;</span> <span class="o">.</span> <span class="nv">lua-send-lua-region</span><span class="p">))</span></div><div class='line' id='LC1480'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">set-lua-region-end</span><span class="err">]</span></div><div class='line' id='LC1481'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;Set Lua-Region End&quot;</span> <span class="o">.</span> <span class="nv">lua-set-lua-region-end</span><span class="p">))</span></div><div class='line' id='LC1482'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">set-lua-region-start</span><span class="err">]</span></div><div class='line' id='LC1483'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;Set Lua-Region Start&quot;</span> <span class="o">.</span> <span class="nv">lua-set-lua-region-start</span><span class="p">))</span></div><div class='line' id='LC1484'><br/></div><div class='line' id='LC1485'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">send-current-line</span><span class="err">]</span></div><div class='line' id='LC1486'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;Send Current Line&quot;</span> <span class="o">.</span> <span class="nv">lua-send-current-line</span><span class="p">))</span></div><div class='line' id='LC1487'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">send-region</span><span class="err">]</span></div><div class='line' id='LC1488'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;Send Region&quot;</span> <span class="o">.</span> <span class="nv">lua-send-region</span><span class="p">))</span></div><div class='line' id='LC1489'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">send-proc</span><span class="err">]</span></div><div class='line' id='LC1490'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;Send Proc&quot;</span> <span class="o">.</span> <span class="nv">lua-send-proc</span><span class="p">))</span></div><div class='line' id='LC1491'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">send-buffer</span><span class="err">]</span></div><div class='line' id='LC1492'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;Send Buffer&quot;</span> <span class="o">.</span> <span class="nv">lua-send-buffer</span><span class="p">))</span></div><div class='line' id='LC1493'><span class="p">(</span><span class="nf">define-key</span> <span class="nv">lua-mode-menu</span> <span class="err">[</span><span class="nv">search-documentation</span><span class="err">]</span></div><div class='line' id='LC1494'>&nbsp;&nbsp;<span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;Search Documentation&quot;</span> <span class="o">.</span> <span class="nv">lua-search-documentation</span><span class="p">))</span></div><div class='line' id='LC1495'><br/></div><div class='line' id='LC1496'><span class="p">(</span><span class="nf">defsubst</span> <span class="nv">lua-put-char-property</span> <span class="p">(</span><span class="nf">pos</span> <span class="nv">property</span> <span class="nv">value</span> <span class="nv">&amp;optional</span> <span class="nv">object</span><span class="p">)</span></div><div class='line' id='LC1497'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua--with-silent-modifications</span></div><div class='line' id='LC1498'><br/></div><div class='line' id='LC1499'>&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">value</span></div><div class='line' id='LC1500'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">put-text-property</span> <span class="nv">pos</span> <span class="p">(</span><span class="mi">1</span><span class="nv">+</span> <span class="nv">pos</span><span class="p">)</span> <span class="nv">property</span> <span class="nv">value</span> <span class="nv">object</span><span class="p">)</span></div><div class='line' id='LC1501'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">remove-text-properties</span> <span class="nv">pos</span> <span class="p">(</span><span class="mi">1</span><span class="nv">+</span> <span class="nv">pos</span><span class="p">)</span> <span class="p">(</span><span class="nb">list </span><span class="nv">property</span> <span class="nv">nil</span><span class="p">))))</span></div><div class='line' id='LC1502'><br/></div><div class='line' id='LC1503'>&nbsp;&nbsp;<span class="c1">;; `lua--with-silent-modifications&#39; inhibits modification hooks, one of which</span></div><div class='line' id='LC1504'>&nbsp;&nbsp;<span class="c1">;; is the hook that keeps `syntax-ppss&#39; internal cache up-to-date. If this</span></div><div class='line' id='LC1505'>&nbsp;&nbsp;<span class="c1">;; isn&#39;t done, the results of subsequent calls to `syntax-ppss&#39; are</span></div><div class='line' id='LC1506'>&nbsp;&nbsp;<span class="c1">;; invalid. To avoid such cache discrepancy, the hook must be run manually.</span></div><div class='line' id='LC1507'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">syntax-ppss-flush-cache</span> <span class="nv">pos</span><span class="p">))</span></div><div class='line' id='LC1508'><br/></div><div class='line' id='LC1509'><span class="p">(</span><span class="nf">defsubst</span> <span class="nv">lua-put-char-syntax-table</span> <span class="p">(</span><span class="nf">pos</span> <span class="nv">value</span> <span class="nv">&amp;optional</span> <span class="nv">object</span><span class="p">)</span></div><div class='line' id='LC1510'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-put-char-property</span> <span class="nv">pos</span> <span class="ss">&#39;syntax-table</span> <span class="nv">value</span> <span class="nv">object</span><span class="p">))</span></div><div class='line' id='LC1511'><br/></div><div class='line' id='LC1512'><span class="p">(</span><span class="nf">defsubst</span> <span class="nv">lua-get-multiline-delim-syntax</span> <span class="p">(</span><span class="nf">type</span><span class="p">)</span></div><div class='line' id='LC1513'>&nbsp;&nbsp;<span class="p">(</span><span class="k">cond </span><span class="p">((</span><span class="nf">eq</span> <span class="nv">type</span> <span class="ss">&#39;string</span><span class="p">)</span> <span class="o">&#39;</span><span class="p">(</span><span class="mi">15</span><span class="p">))</span></div><div class='line' id='LC1514'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">((</span><span class="nf">eq</span> <span class="nv">type</span> <span class="ss">&#39;comment</span><span class="p">)</span> <span class="o">&#39;</span><span class="p">(</span><span class="mi">14</span><span class="p">))</span></div><div class='line' id='LC1515'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">nil</span><span class="p">)))</span></div><div class='line' id='LC1516'><br/></div><div class='line' id='LC1517'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-mark-char-multiline-delim</span> <span class="p">(</span><span class="nf">pos</span> <span class="nv">type</span><span class="p">)</span></div><div class='line' id='LC1518'>&nbsp;&nbsp;<span class="s">&quot;Mark character as a delimiter of Lua multiline construct</span></div><div class='line' id='LC1519'><br/></div><div class='line' id='LC1520'><span class="s">If TYPE is string, mark char  as string delimiter. If TYPE is comment,</span></div><div class='line' id='LC1521'><span class="s">mark char as comment delimiter.  Otherwise, remove the mark if any.&quot;</span></div><div class='line' id='LC1522'>&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-put-char-syntax-table</span> <span class="nv">pos</span> <span class="p">(</span><span class="nf">lua-get-multiline-delim-syntax</span> <span class="nv">type</span><span class="p">)))</span></div><div class='line' id='LC1523'><br/></div><div class='line' id='LC1524'><span class="p">(</span><span class="nf">defsubst</span> <span class="nv">lua-inside-multiline-p</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">pos</span><span class="p">)</span></div><div class='line' id='LC1525'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">status</span> <span class="p">(</span><span class="nf">syntax-ppss</span> <span class="nv">pos</span><span class="p">)))</span></div><div class='line' id='LC1526'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="nf">eq</span> <span class="p">(</span><span class="nf">elt</span> <span class="nv">status</span> <span class="mi">3</span><span class="p">)</span> <span class="nv">t</span><span class="p">)</span>                <span class="c1">;; inside generic string</span></div><div class='line' id='LC1527'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">eq</span> <span class="p">(</span><span class="nf">elt</span> <span class="nv">status</span> <span class="mi">7</span><span class="p">)</span> <span class="ss">&#39;syntax-table</span><span class="p">))))</span> <span class="c1">;; inside generic comment</span></div><div class='line' id='LC1528'><br/></div><div class='line' id='LC1529'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-get-multiline-start</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="nv">pos</span><span class="p">)</span></div><div class='line' id='LC1530'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1531'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="p">(</span><span class="nf">lua-inside-multiline-p</span> <span class="nv">pos</span><span class="p">)</span> <span class="c1">;; return string/comment start</span></div><div class='line' id='LC1532'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">elt</span> <span class="p">(</span><span class="nf">syntax-ppss</span> <span class="nv">pos</span><span class="p">)</span> <span class="mi">8</span><span class="p">)))</span></div><div class='line' id='LC1533'><br/></div><div class='line' id='LC1534'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-unmark-multiline-literals</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="k">begin </span><span class="nv">end</span><span class="p">)</span></div><div class='line' id='LC1535'>&nbsp;&nbsp;<span class="s">&quot;Clears all Lua multiline construct markers in region</span></div><div class='line' id='LC1536'><br/></div><div class='line' id='LC1537'><span class="s">If BEGIN is nil, start from `beginning-of-buffer&#39;.</span></div><div class='line' id='LC1538'><span class="s">If END is nil, stop at `end-of-buffer&#39;.&quot;</span></div><div class='line' id='LC1539'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1540'><br/></div><div class='line' id='LC1541'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="k">begin </span><span class="p">(</span><span class="k">or begin </span><span class="p">(</span><span class="nf">point-min</span><span class="p">))</span></div><div class='line' id='LC1542'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">end</span>   <span class="p">(</span><span class="k">or </span><span class="nv">end</span>   <span class="p">(</span><span class="nf">point-max</span><span class="p">)))</span></div><div class='line' id='LC1543'><br/></div><div class='line' id='LC1544'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua--with-silent-modifications</span></div><div class='line' id='LC1545'>&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">remove-text-properties</span> <span class="k">begin </span><span class="nv">end</span> <span class="o">&#39;</span><span class="p">(</span><span class="nv">syntax-table</span> <span class="p">())))</span></div><div class='line' id='LC1546'><br/></div><div class='line' id='LC1547'>&nbsp;&nbsp;<span class="c1">;; `lua--with-silent-modifications&#39; inhibits modification hooks, one of which</span></div><div class='line' id='LC1548'>&nbsp;&nbsp;<span class="c1">;; is the hook that keeps `syntax-ppss&#39; internal cache up-to-date. If this</span></div><div class='line' id='LC1549'>&nbsp;&nbsp;<span class="c1">;; isn&#39;t done, the results of subsequent calls to `syntax-ppss&#39; are</span></div><div class='line' id='LC1550'>&nbsp;&nbsp;<span class="c1">;; invalid. To avoid such cache discrepancy, the hook must be run manually.</span></div><div class='line' id='LC1551'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">syntax-ppss-flush-cache</span> <span class="nv">begin</span><span class="p">)</span></div><div class='line' id='LC1552'><br/></div><div class='line' id='LC1553'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">font-lock-fontify-buffer</span><span class="p">))</span></div><div class='line' id='LC1554'><br/></div><div class='line' id='LC1555'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-mark-multiline-region</span> <span class="p">(</span><span class="k">begin </span><span class="nv">end</span><span class="p">)</span></div><div class='line' id='LC1556'>&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">((</span><span class="nf">type</span> <span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="nf">eq</span> <span class="nv">?-</span> <span class="p">(</span><span class="nf">char-after</span> <span class="nv">begin</span><span class="p">))</span> <span class="ss">&#39;comment</span> <span class="ss">&#39;string</span><span class="p">)))</span></div><div class='line' id='LC1557'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-mark-char-multiline-delim</span> <span class="k">begin </span><span class="nv">type</span><span class="p">)</span></div><div class='line' id='LC1558'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="nv">end</span></div><div class='line' id='LC1559'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-mark-char-multiline-delim</span> <span class="p">(</span><span class="mi">1</span><span class="nv">-</span> <span class="nv">end</span><span class="p">)</span> <span class="nv">type</span><span class="p">))))</span></div><div class='line' id='LC1560'><br/></div><div class='line' id='LC1561'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua-mark-all-multiline-literals</span> <span class="p">(</span><span class="nf">&amp;optional</span> <span class="k">begin </span><span class="nv">end</span><span class="p">)</span></div><div class='line' id='LC1562'>&nbsp;&nbsp;<span class="s">&quot;Marks all Lua multiline constructs in region</span></div><div class='line' id='LC1563'><br/></div><div class='line' id='LC1564'><span class="s">If BEGIN is nil, start from `beginning-of-buffer&#39;.</span></div><div class='line' id='LC1565'><span class="s">If END is nil, stop at `end-of-buffer&#39;.&quot;</span></div><div class='line' id='LC1566'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">interactive</span><span class="p">)</span></div><div class='line' id='LC1567'><br/></div><div class='line' id='LC1568'>&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="p">(</span><span class="k">and </span><span class="p">(</span><span class="nf">lua--called-interactively-p</span> <span class="ss">&#39;any</span><span class="p">)</span> <span class="p">(</span><span class="nf">use-region-p</span><span class="p">))</span></div><div class='line' id='LC1569'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="k">begin </span><span class="p">(</span><span class="nf">region-beginning</span><span class="p">)</span></div><div class='line' id='LC1570'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">end</span> <span class="p">(</span><span class="nf">region-end</span><span class="p">)))</span></div><div class='line' id='LC1571'><br/></div><div class='line' id='LC1572'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-unmark-multiline-literals</span> <span class="k">begin </span><span class="nv">end</span><span class="p">)</span></div><div class='line' id='LC1573'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC1574'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">goto-char</span> <span class="p">(</span><span class="k">or begin </span><span class="p">(</span><span class="nf">point-min</span><span class="p">)))</span></div><div class='line' id='LC1575'><br/></div><div class='line' id='LC1576'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">while</span> <span class="p">(</span><span class="nf">and</span></div><div class='line' id='LC1577'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; must check  for point range,  because matching previous</span></div><div class='line' id='LC1578'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; multiline  end might  move  point beyond  end and  this</span></div><div class='line' id='LC1579'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; drives `re-search-forward&#39; crazy</span></div><div class='line' id='LC1580'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">if </span><span class="nv">end</span> <span class="p">(</span><span class="nb">&lt; </span><span class="p">(</span><span class="nf">point</span><span class="p">)</span> <span class="nv">end</span><span class="p">)</span> <span class="nv">t</span><span class="p">)</span></div><div class='line' id='LC1581'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; look for</span></div><div class='line' id='LC1582'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; 1. (optional) two or more dashes followed by</span></div><div class='line' id='LC1583'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; 2. lua multiline delimiter [[</span></div><div class='line' id='LC1584'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">re-search-forward</span> <span class="s">&quot;\\(?2:--\\)?\\[\\(?1:=*\\)\\[&quot;</span> <span class="nv">end</span> <span class="ss">&#39;noerror</span><span class="p">))</span></div><div class='line' id='LC1585'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; match-start + 1 is considered instead of match-start, because</span></div><div class='line' id='LC1586'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; such  approach  handles  &#39;---[[&#39; situation  correctly:  Emacs</span></div><div class='line' id='LC1587'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; thinks 2nd dash (i.e.  match-start) is not yet a comment, but</span></div><div class='line' id='LC1588'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; the third one is, hence the +1.  In all the other situations,</span></div><div class='line' id='LC1589'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; &#39;+1&#39;  is safe  to use  because  it bears  the same  syntactic</span></div><div class='line' id='LC1590'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; properties, i.e.  if match-start is inside string-or-comment,</span></div><div class='line' id='LC1591'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; then &#39;+1&#39; is too and vice versa.</span></div><div class='line' id='LC1592'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;;</span></div><div class='line' id='LC1593'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; PS. ping me if you find a situation in which this is not true</span></div><div class='line' id='LC1594'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">unless</span> <span class="p">(</span><span class="nf">lua-comment-or-string-p</span> <span class="p">(</span><span class="mi">1</span><span class="nv">+</span> <span class="p">(</span><span class="nf">match-beginning</span> <span class="mi">0</span><span class="p">)))</span></div><div class='line' id='LC1595'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">let </span><span class="p">(</span><span class="nf">ml-begin</span> <span class="nv">ml-end</span><span class="p">)</span></div><div class='line' id='LC1596'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">ml-begin</span> <span class="p">(</span><span class="nf">match-beginning</span> <span class="mi">0</span><span class="p">))</span></div><div class='line' id='LC1597'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="p">(</span><span class="nf">re-search-forward</span> <span class="p">(</span><span class="nf">format</span> <span class="s">&quot;\\]%s\\]&quot;</span> <span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="nf">match-string</span> <span class="mi">1</span><span class="p">)</span> <span class="s">&quot;&quot;</span><span class="p">))</span> <span class="nv">nil</span> <span class="ss">&#39;noerror</span><span class="p">)</span></div><div class='line' id='LC1598'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">;; (message &quot;found match %s&quot; (match-string 0))</span></div><div class='line' id='LC1599'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">ml-end</span> <span class="p">(</span><span class="nf">match-end</span> <span class="mi">0</span><span class="p">)))</span></div><div class='line' id='LC1600'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-mark-multiline-region</span> <span class="nv">ml-begin</span> <span class="nv">ml-end</span><span class="p">))))))</span></div><div class='line' id='LC1601'><br/></div><div class='line' id='LC1602'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-automark-multiline-timer</span> <span class="nv">nil</span></div><div class='line' id='LC1603'>&nbsp;&nbsp;<span class="s">&quot;Contains idle-timer object used for automatical multiline literal markup which must be cleaned up on exit.&quot;</span><span class="p">)</span></div><div class='line' id='LC1604'><span class="p">(</span><span class="nf">make-variable-buffer-local</span> <span class="ss">&#39;lua-automark-multiline-timer</span><span class="p">)</span></div><div class='line' id='LC1605'><br/></div><div class='line' id='LC1606'><span class="p">(</span><span class="nf">defvar</span> <span class="nv">lua-automark-multiline-start-pos</span> <span class="nv">nil</span></div><div class='line' id='LC1607'>&nbsp;&nbsp;<span class="s">&quot;Contains position from which automark procedure should start.</span></div><div class='line' id='LC1608'><br/></div><div class='line' id='LC1609'><span class="s">Automarking shall start at the point before which no modification has been</span></div><div class='line' id='LC1610'><span class="s">made since last automark. Additionally, if such point is inside string or</span></div><div class='line' id='LC1611'><span class="s">comment, rewind start position to its beginning.</span></div><div class='line' id='LC1612'><br/></div><div class='line' id='LC1613'><span class="s">nil means automark is unnecessary because there were no updates.&quot;</span><span class="p">)</span></div><div class='line' id='LC1614'><span class="p">(</span><span class="nf">make-variable-buffer-local</span> <span class="ss">&#39;lua-automark-multiline-start-pos</span><span class="p">)</span></div><div class='line' id='LC1615'><br/></div><div class='line' id='LC1616'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua--automark-update-start-pos</span> <span class="p">(</span><span class="nf">change-begin</span> <span class="nv">change-end</span> <span class="nv">old-len</span><span class="p">)</span></div><div class='line' id='LC1617'>&nbsp;&nbsp;<span class="s">&quot;Updates `lua-automark-multiline-start-pos&#39; upon buffer modification.&quot;</span></div><div class='line' id='LC1618'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">save-excursion</span></div><div class='line' id='LC1619'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">goto-char</span> <span class="nv">change-begin</span><span class="p">)</span></div><div class='line' id='LC1620'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">beginning-of-line</span><span class="p">)</span></div><div class='line' id='LC1621'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">lua-automark-multiline-start-pos</span></div><div class='line' id='LC1622'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="k">or </span><span class="p">(</span><span class="nf">lua-comment-or-string-start</span><span class="p">)</span> <span class="p">(</span><span class="nf">point</span><span class="p">)))))</span></div><div class='line' id='LC1623'><br/></div><div class='line' id='LC1624'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua--automark-multiline-update-timer</span> <span class="p">()</span></div><div class='line' id='LC1625'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua--automark-multiline-cleanup</span><span class="p">)</span>  <span class="c1">;; reset previous timer if it existed</span></div><div class='line' id='LC1626'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="nv">lua-automark-multiline-interval</span></div><div class='line' id='LC1627'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">add-hook</span> <span class="ss">&#39;change-major-mode-hook</span> <span class="ss">&#39;lua--automark-multiline-cleanup</span> <span class="nv">nil</span> <span class="ss">&#39;local</span><span class="p">)</span></div><div class='line' id='LC1628'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">add-hook</span> <span class="ss">&#39;after-change-functions</span> <span class="ss">&#39;lua--automark-update-start-pos</span>  <span class="nv">nil</span> <span class="ss">&#39;local</span><span class="p">)</span></div><div class='line' id='LC1629'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">lua-automark-multiline-timer</span></div><div class='line' id='LC1630'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">run-with-idle-timer</span> <span class="nv">lua-automark-multiline-interval</span> <span class="ss">&#39;repeat</span></div><div class='line' id='LC1631'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="ss">&#39;lua--automark-multiline-run</span><span class="p">))))</span></div><div class='line' id='LC1632'><br/></div><div class='line' id='LC1633'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua--automark-multiline-cleanup</span> <span class="p">()</span></div><div class='line' id='LC1634'>&nbsp;&nbsp;<span class="s">&quot;Disable automatical multiline construct marking&quot;</span></div><div class='line' id='LC1635'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">unless</span> <span class="p">(</span><span class="nf">null</span> <span class="nv">lua-automark-multiline-timer</span><span class="p">)</span></div><div class='line' id='LC1636'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">cancel-timer</span> <span class="nv">lua-automark-multiline-timer</span><span class="p">)</span></div><div class='line' id='LC1637'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">lua-automark-multiline-timer</span> <span class="nv">nil</span><span class="p">)))</span></div><div class='line' id='LC1638'><br/></div><div class='line' id='LC1639'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua--automark-multiline-run</span> <span class="p">()</span></div><div class='line' id='LC1640'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="p">(</span><span class="nb">&lt;= </span><span class="p">(</span><span class="nf">buffer-size</span><span class="p">)</span> <span class="nv">lua-automark-multiline-maxsize</span><span class="p">)</span></div><div class='line' id='LC1641'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="nv">lua-automark-multiline-start-pos</span></div><div class='line' id='LC1642'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua-mark-all-multiline-literals</span> <span class="nv">lua-automark-multiline-start-pos</span><span class="p">)</span></div><div class='line' id='LC1643'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">setq</span> <span class="nv">lua-automark-multiline-start-pos</span> <span class="nv">nil</span><span class="p">))))</span></div><div class='line' id='LC1644'><br/></div><div class='line' id='LC1645'><span class="p">(</span><span class="nf">defun</span> <span class="nv">lua--customize-set-automark-multiline-interval</span> <span class="p">(</span><span class="nf">symbol</span> <span class="nv">value</span><span class="p">)</span></div><div class='line' id='LC1646'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">set</span> <span class="nv">symbol</span> <span class="nv">value</span><span class="p">)</span></div><div class='line' id='LC1647'>&nbsp;&nbsp;<span class="p">(</span><span class="nf">dolist</span> <span class="p">(</span><span class="nf">buf</span> <span class="p">(</span><span class="nf">buffer-list</span><span class="p">))</span></div><div class='line' id='LC1648'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">with-current-buffer</span> <span class="nv">buf</span></div><div class='line' id='LC1649'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">when</span> <span class="p">(</span><span class="nf">eq</span> <span class="nv">major-mode</span> <span class="ss">&#39;lua-mode</span><span class="p">)</span></div><div class='line' id='LC1650'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">(</span><span class="nf">lua--automark-multiline-update-timer</span><span class="p">)))))</span></div><div class='line' id='LC1651'><br/></div><div class='line' id='LC1652'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-automark-multiline-interval</span> <span class="mi">1</span></div><div class='line' id='LC1653'>&nbsp;&nbsp;<span class="s">&quot;If not 0, specifies idle time in seconds after which lua-mode will mark multiline literals.&quot;</span></div><div class='line' id='LC1654'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span></div><div class='line' id='LC1655'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="ss">&#39;integer</span></div><div class='line' id='LC1656'>&nbsp;&nbsp;<span class="nv">:set</span> <span class="ss">&#39;lua--customize-set-automark-multiline-interval</span><span class="p">)</span></div><div class='line' id='LC1657'><br/></div><div class='line' id='LC1658'><span class="p">(</span><span class="nf">defcustom</span> <span class="nv">lua-automark-multiline-maxsize</span> <span class="mi">100000</span></div><div class='line' id='LC1659'>&nbsp;&nbsp;<span class="s">&quot;Maximum buffer size for which lua-mode will mark multiline literals automatically.&quot;</span></div><div class='line' id='LC1660'>&nbsp;&nbsp;<span class="nv">:group</span> <span class="ss">&#39;lua</span></div><div class='line' id='LC1661'>&nbsp;&nbsp;<span class="nv">:type</span> <span class="ss">&#39;integer</span><span class="p">)</span></div><div class='line' id='LC1662'><br/></div><div class='line' id='LC1663'><span class="p">(</span><span class="nf">provide</span> <span class="ss">&#39;lua-mode</span><span class="p">)</span></div><div class='line' id='LC1664'><br/></div><div class='line' id='LC1665'><span class="c1">;;; lua-mode.el ends here</span></div></pre></div>
  2.2497 -          </td>
  2.2498 -        </tr>
  2.2499 -      </table>
  2.2500 -  </div>
  2.2501 +;; private functions
  2.2502  
  2.2503 -          </div>
  2.2504 -        </div>
  2.2505 +(defun lua-prefix-key-update-bindings ()
  2.2506 +  (let (old-cons)
  2.2507 +    (if (eq lua-prefix-mode-map (keymap-parent lua-mode-map))
  2.2508 +        ;; if prefix-map is a parent, delete the parent
  2.2509 +        (set-keymap-parent lua-mode-map nil)
  2.2510 +      ;; otherwise, look for it among children
  2.2511 +      (if (setq old-cons (rassoc lua-prefix-mode-map lua-mode-map))
  2.2512 +          (delq old-cons lua-mode-map)))
  2.2513  
  2.2514 -        <a href="#jump-to-line" rel="facebox" data-hotkey="l" class="js-jump-to-line" style="display:none">Jump to Line</a>
  2.2515 -        <div id="jump-to-line" style="display:none">
  2.2516 -          <h2>Jump to Line</h2>
  2.2517 -          <form accept-charset="UTF-8" class="js-jump-to-line-form">
  2.2518 -            <input class="textfield js-jump-to-line-field" type="text">
  2.2519 -            <div class="full-button">
  2.2520 -              <button type="submit" class="button">Go</button>
  2.2521 -            </div>
  2.2522 -          </form>
  2.2523 -        </div>
  2.2524 +    (if (null lua-prefix-key)
  2.2525 +        (set-keymap-parent lua-mode-map lua-prefix-mode-map)
  2.2526 +      (define-key lua-mode-map (vector lua-prefix-key) lua-prefix-mode-map))))
  2.2527  
  2.2528 -      </div>
  2.2529 -    </div>
  2.2530 -</div>
  2.2531 +(defun lua-set-prefix-key (new-key-str)
  2.2532 +  "Changes `lua-prefix-key' properly and updates keymaps
  2.2533  
  2.2534 -<div id="js-frame-loading-template" class="frame frame-loading large-loading-area" style="display:none;">
  2.2535 -  <img class="js-frame-loading-spinner" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-128.gif?1359500886" height="64" width="64">
  2.2536 -</div>
  2.2537 +This function replaces previous prefix-key binding with a new one."
  2.2538 +  (interactive "sNew prefix key (empty string means no key): ")
  2.2539 +  (lua--customize-set-prefix-key 'lua-prefix-key new-key-str)
  2.2540 +  (lua-prefix-key-update-bindings))
  2.2541  
  2.2542 +(defun lua-string-p (&optional pos)
  2.2543 +  "Returns true if the point is in a string."
  2.2544 +  (save-excursion (elt (syntax-ppss pos) 3)))
  2.2545  
  2.2546 -        </div>
  2.2547 -      </div>
  2.2548 -      <div class="context-overlay"></div>
  2.2549 -    </div>
  2.2550 +(defun lua-comment-p (&optional pos)
  2.2551 +  "Returns true if the point is in a comment."
  2.2552 +  (save-excursion (elt (syntax-ppss pos) 4)))
  2.2553  
  2.2554 -      <div id="footer-push"></div><!-- hack for sticky footer -->
  2.2555 -    </div><!-- end of wrapper - hack for sticky footer -->
  2.2556 +(defun lua-comment-or-string-p (&optional pos)
  2.2557 +  "Returns true if the point is in a comment or string."
  2.2558 +  (save-excursion (let ((parse-result (syntax-ppss pos)))
  2.2559 +                    (or (elt parse-result 3) (elt parse-result 4)))))
  2.2560  
  2.2561 -      <!-- footer -->
  2.2562 -      <div id="footer">
  2.2563 -  <div class="container clearfix">
  2.2564 +(defun lua-comment-or-string-start (&optional pos)
  2.2565 +  "Returns start position of string or comment which contains point.
  2.2566  
  2.2567 -      <dl class="footer_nav">
  2.2568 -        <dt>GitHub</dt>
  2.2569 -        <dd><a href="https://github.com/about">About us</a></dd>
  2.2570 -        <dd><a href="https://github.com/blog">Blog</a></dd>
  2.2571 -        <dd><a href="https://github.com/contact">Contact &amp; support</a></dd>
  2.2572 -        <dd><a href="http://enterprise.github.com/">GitHub Enterprise</a></dd>
  2.2573 -        <dd><a href="http://status.github.com/">Site status</a></dd>
  2.2574 -      </dl>
  2.2575 +If point is not inside string or comment, return nil."
  2.2576 +  (save-excursion (elt (syntax-ppss pos) 8)))
  2.2577  
  2.2578 -      <dl class="footer_nav">
  2.2579 -        <dt>Applications</dt>
  2.2580 -        <dd><a href="http://mac.github.com/">GitHub for Mac</a></dd>
  2.2581 -        <dd><a href="http://windows.github.com/">GitHub for Windows</a></dd>
  2.2582 -        <dd><a href="http://eclipse.github.com/">GitHub for Eclipse</a></dd>
  2.2583 -        <dd><a href="http://mobile.github.com/">GitHub mobile apps</a></dd>
  2.2584 -      </dl>
  2.2585 +(defun lua-indent-line ()
  2.2586 +  "Indent current line for Lua mode.
  2.2587 +Return the amount the indentation changed by."
  2.2588 +  (let (indent
  2.2589 +        (case-fold-search nil)
  2.2590 +        ;; save point as a distance to eob - it's invariant w.r.t indentation
  2.2591 +        (pos (- (point-max) (point))))
  2.2592 +    (back-to-indentation)
  2.2593 +    (if (lua-comment-or-string-p)
  2.2594 +        (setq indent (lua-calculate-string-or-comment-indentation)) ;; just restore point position
  2.2595 +      (setq indent (max 0 (lua-calculate-indentation nil))))
  2.2596  
  2.2597 -      <dl class="footer_nav">
  2.2598 -        <dt>Services</dt>
  2.2599 -        <dd><a href="http://get.gaug.es/">Gauges: Web analytics</a></dd>
  2.2600 -        <dd><a href="http://speakerdeck.com">Speaker Deck: Presentations</a></dd>
  2.2601 -        <dd><a href="https://gist.github.com">Gist: Code snippets</a></dd>
  2.2602 -        <dd><a href="http://jobs.github.com/">Job board</a></dd>
  2.2603 -      </dl>
  2.2604 +    (when (not (equal indent (current-column)))
  2.2605 +      (delete-region (line-beginning-position) (point))
  2.2606 +      (indent-to indent))
  2.2607  
  2.2608 -      <dl class="footer_nav">
  2.2609 -        <dt>Documentation</dt>
  2.2610 -        <dd><a href="http://help.github.com/">GitHub Help</a></dd>
  2.2611 -        <dd><a href="http://developer.github.com/">Developer API</a></dd>
  2.2612 -        <dd><a href="http://github.github.com/github-flavored-markdown/">GitHub Flavored Markdown</a></dd>
  2.2613 -        <dd><a href="http://pages.github.com/">GitHub Pages</a></dd>
  2.2614 -      </dl>
  2.2615 +    ;; If initial point was within line's indentation,
  2.2616 +    ;; position after the indentation.  Else stay at same point in text.
  2.2617 +    (if (> (- (point-max) pos) (point))
  2.2618 +        (goto-char (- (point-max) pos)))
  2.2619  
  2.2620 -      <dl class="footer_nav">
  2.2621 -        <dt>More</dt>
  2.2622 -        <dd><a href="http://training.github.com/">Training</a></dd>
  2.2623 -        <dd><a href="https://github.com/edu">Students &amp; teachers</a></dd>
  2.2624 -        <dd><a href="http://shop.github.com">The Shop</a></dd>
  2.2625 -        <dd><a href="/plans">Plans &amp; pricing</a></dd>
  2.2626 -        <dd><a href="http://octodex.github.com/">The Octodex</a></dd>
  2.2627 -      </dl>
  2.2628 +    indent))
  2.2629  
  2.2630 -      <hr class="footer-divider">
  2.2631 +(defun lua-calculate-string-or-comment-indentation ()
  2.2632 +  "This function should be run when point at (current-indentation) is inside string"
  2.2633 +  (if (and (lua-string-p) (not lua-indent-string-contents))
  2.2634 +      ;; if inside string and strings aren't to be indented, return current indentation
  2.2635 +      (current-indentation)
  2.2636 +    ;; Otherwise, indent as a comment
  2.2637 +    (save-excursion
  2.2638 +      (cond
  2.2639 +       ;; If it is the end of a multi-line comment, simply mirror the opening
  2.2640 +       ;; line's indent.
  2.2641 +       ((looking-at "\\s *\\(?:--\\)?\\]\\(?1:=*\\)\\]")
  2.2642 +        (re-search-backward (format "\\[%s\\["
  2.2643 +                                    (or (match-string-no-properties 1) ""))
  2.2644 +                            (lua-get-multiline-start)
  2.2645 +                            'noerror)
  2.2646 +        (current-indentation))
  2.2647 +       ;; otherwise indent by lua-indent-level relative to the line where literal starts
  2.2648 +       (t
  2.2649 +        (goto-char (lua-get-multiline-start))
  2.2650 +        (+ (current-indentation) lua-indent-level))))))
  2.2651  
  2.2652 +(defun lua-find-regexp (direction regexp &optional limit ignore-p)
  2.2653 +  "Searches for a regular expression in the direction specified.
  2.2654 +Direction is one of 'forward and 'backward.
  2.2655 +By default, matches in comments and strings are ignored, but what to ignore is
  2.2656 +configurable by specifying ignore-p. If the regexp is found, returns point
  2.2657 +position, nil otherwise.
  2.2658 +ignore-p returns true if the match at the current point position should be
  2.2659 +ignored, nil otherwise."
  2.2660 +  (let ((ignore-func (or ignore-p 'lua-comment-or-string-p))
  2.2661 +        (search-func (if (eq direction 'forward)
  2.2662 +                         're-search-forward 're-search-backward))
  2.2663 +        (case-fold-search nil))
  2.2664 +    (catch 'found
  2.2665 +      (while (funcall search-func regexp limit t)
  2.2666 +        (if (and (not (funcall ignore-func (match-beginning 0)))
  2.2667 +                 (not (funcall ignore-func (match-end 0))))
  2.2668 +            (throw 'found (point)))))))
  2.2669  
  2.2670 -    <p class="right">&copy; 2013 <span title="0.34901s from fe19.rs.github.com">GitHub</span> Inc. All rights reserved.</p>
  2.2671 -    <a class="left" href="https://github.com/">
  2.2672 -      <span class="mega-icon mega-icon-invertocat"></span>
  2.2673 -    </a>
  2.2674 -    <ul id="legal">
  2.2675 -        <li><a href="https://github.com/site/terms">Terms of Service</a></li>
  2.2676 -        <li><a href="https://github.com/site/privacy">Privacy</a></li>
  2.2677 -        <li><a href="https://github.com/security">Security</a></li>
  2.2678 -    </ul>
  2.2679 +(defconst lua-block-regexp
  2.2680 +  (eval-when-compile
  2.2681 +    (concat
  2.2682 +     "\\(\\_<"
  2.2683 +     (regexp-opt '("do" "function" "repeat" "then"
  2.2684 +                   "else" "elseif" "end" "until") t)
  2.2685 +     "\\_>\\)\\|"
  2.2686 +     (regexp-opt '("{" "(" "[" "]" ")" "}") t))))
  2.2687  
  2.2688 -  </div><!-- /.container -->
  2.2689 +(defconst lua-block-token-alist
  2.2690 +  '(("do"       "\\<end\\>"   "\\<for\\|while\\>"                       middle-or-open)
  2.2691 +    ("function" "\\<end\\>"   nil                                       open)
  2.2692 +    ("repeat"   "\\<until\\>" nil                                       open)
  2.2693 +    ("then"     "\\<\\(e\\(lse\\(if\\)?\\|nd\\)\\)\\>" "\\<\\(else\\)?if\\>" middle)
  2.2694 +    ("{"        "}"           nil                                       open)
  2.2695 +    ("["        "]"           nil                                       open)
  2.2696 +    ("("        ")"           nil                                       open)
  2.2697 +    ("if"       "\\<then\\>"  nil                                       open)
  2.2698 +    ("for"      "\\<do\\>"    nil                                       open)
  2.2699 +    ("while"    "\\<do\\>"    nil                                       open)
  2.2700 +    ("else"     "\\<end\\>"   "\\<then\\>"                              middle)
  2.2701 +    ("elseif"   "\\<then\\>"  "\\<then\\>"                              middle)
  2.2702 +    ("end"      nil           "\\<\\(do\\|function\\|then\\|else\\)\\>" close)
  2.2703 +    ("until"    nil           "\\<repeat\\>"                            close)
  2.2704 +    ("}"        nil           "{"                                       close)
  2.2705 +    ("]"        nil           "\\["                                     close)
  2.2706 +    (")"        nil           "("                                       close))
  2.2707 +  "This is a list of block token information blocks.
  2.2708 +Each token information entry is of the form:
  2.2709 +  KEYWORD FORWARD-MATCH-REGEXP BACKWARDS-MATCH-REGEXP TOKEN-TYPE
  2.2710 +KEYWORD is the token.
  2.2711 +FORWARD-MATCH-REGEXP is a regexp that matches all possble tokens when going forward.
  2.2712 +BACKWARDS-MATCH-REGEXP is a regexp that matches all possble tokens when going backwards.
  2.2713 +TOKEN-TYPE determines where the token occurs on a statement. open indicates that the token appears at start, close indicates that it appears at end, middle indicates that it is a middle type token, and middle-or-open indicates that it can appear both as a middle or an open type.")
  2.2714  
  2.2715 -</div><!-- /.#footer -->
  2.2716 +(defconst lua-indentation-modifier-regexp
  2.2717 +  ;; The absence of else is deliberate, since it does not modify the
  2.2718 +  ;; indentation level per se. It only may cause the line, in which the
  2.2719 +  ;; else is, to be shifted to the left.
  2.2720 +  (concat
  2.2721 +   "\\(\\_<"
  2.2722 +   (regexp-opt '("do" "function" "repeat" "then" "if" "else" "elseif" "for" "while") t)
  2.2723 +   "\\_>\\|"
  2.2724 +   (regexp-opt '("{" "(" "["))
  2.2725 +   "\\)\\|\\(\\_<"
  2.2726 +   (regexp-opt '("end" "until") t)
  2.2727 +   "\\_>\\|"
  2.2728 +   (regexp-opt '("]" ")" "}"))
  2.2729 +   "\\)")
  2.2730 +  )
  2.2731  
  2.2732 +(defun lua-get-block-token-info (token)
  2.2733 +  "Returns the block token info entry for TOKEN from lua-block-token-alist"
  2.2734 +  (assoc token lua-block-token-alist))
  2.2735  
  2.2736 -    <div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">
  2.2737 -  <div class="fullscreen-container js-fullscreen-container">
  2.2738 -    <div class="textarea-wrap">
  2.2739 -      <textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea>
  2.2740 -          <div class="suggester-container">
  2.2741 -              <div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester"
  2.2742 -                 data-url="/immerrr/lua-mode/suggestions/commit/e6a46ee34362b5090748643d4b2bef1f849ea0a8">
  2.2743 -              </div>
  2.2744 -          </div>
  2.2745 -    </div>
  2.2746 -  </div>
  2.2747 -  <div class="fullscreen-sidebar">
  2.2748 -    <a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode">
  2.2749 -      <span class="mega-icon mega-icon-normalscreen"></span>
  2.2750 -    </a>
  2.2751 -    <a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards"
  2.2752 -      title="Switch themes">
  2.2753 -      <span class="mini-icon mini-icon-brightness"></span>
  2.2754 -    </a>
  2.2755 -  </div>
  2.2756 -</div>
  2.2757 +(defun lua-get-token-match-re (token-info direction)
  2.2758 +  "Returns the relevant match regexp from token info"
  2.2759 +  (cond
  2.2760 +   ((eq direction 'forward) (cadr token-info))
  2.2761 +   ((eq direction 'backward) (caddr token-info))
  2.2762 +   (t nil)))
  2.2763  
  2.2764 +(defun lua-get-token-type (token-info)
  2.2765 +  "Returns the relevant match regexp from token info"
  2.2766 +   (cadddr token-info))
  2.2767  
  2.2768 +(defun lua-backwards-to-block-begin-or-end ()
  2.2769 +  "Move backwards to nearest block begin or end.  Returns nil if not successful."
  2.2770 +  (interactive)
  2.2771 +  (lua-find-regexp 'backward lua-block-regexp))
  2.2772  
  2.2773 -    <div id="ajax-error-message" class="flash flash-error">
  2.2774 -      <span class="mini-icon mini-icon-exclamation"></span>
  2.2775 -      Something went wrong with that request. Please try again.
  2.2776 -      <a href="#" class="mini-icon mini-icon-remove-close ajax-error-dismiss"></a>
  2.2777 -    </div>
  2.2778 +(defun lua-find-matching-token-word (token search-start &optional direction)
  2.2779 +  (let* ((token-info (lua-get-block-token-info token))
  2.2780 +         (match-type (lua-get-token-type token-info))
  2.2781 +         ;; If we are on a middle token, go backwards. If it is a middle or open,
  2.2782 +         ;; go forwards
  2.2783 +         (search-direction (or direction
  2.2784 +                               (if (or (eq match-type 'open)
  2.2785 +                                       (eq match-type 'middle-or-open))
  2.2786 +                                   'forward
  2.2787 +                                 'backward)
  2.2788 +                               'backward))
  2.2789 +         (match (lua-get-token-match-re token-info search-direction))
  2.2790 +         maybe-found-pos)
  2.2791 +    ;; if we are searching forward from the token at the current point
  2.2792 +    ;; (i.e. for a closing token), need to step one character forward
  2.2793 +    ;; first, or the regexp will match the opening token.
  2.2794 +    (if (eq search-direction 'forward) (forward-char 1))
  2.2795 +    (if search-start (goto-char search-start))
  2.2796 +    (catch 'found
  2.2797 +      ;; If we are attempting to find a matching token for a terminating token
  2.2798 +      ;; (i.e. a token that starts a statement when searching back, or a token
  2.2799 +      ;; that ends a statement when searching forward), then we don't need to look
  2.2800 +      ;; any further.
  2.2801 +      (if (or (and (eq search-direction 'forward)
  2.2802 +                   (eq match-type 'close))
  2.2803 +              (and (eq search-direction 'backward)
  2.2804 +                   (eq match-type 'open)))
  2.2805 +          (throw 'found nil))
  2.2806 +      (while (lua-find-regexp search-direction lua-indentation-modifier-regexp)
  2.2807 +        ;; have we found a valid matching token?
  2.2808 +        (let ((found-token (match-string 0))
  2.2809 +              (found-pos (match-beginning 0)))
  2.2810 +          (let ((found-type (lua-get-token-type
  2.2811 +                             (lua-get-block-token-info found-token))))
  2.2812 +            (if (not (and match (string-match match found-token)))
  2.2813 +                ;; no - then there is a nested block. If we were looking for
  2.2814 +                ;; a block begin token, found-token must be a block end
  2.2815 +                ;; token; likewise, if we were looking for a block end token,
  2.2816 +                ;; found-token must be a block begin token, otherwise there
  2.2817 +                ;; is a grammatical error in the code.
  2.2818 +                (if (not (and
  2.2819 +                          (or (eq match-type 'middle)
  2.2820 +                              (eq found-type 'middle)
  2.2821 +                              (eq match-type 'middle-or-open)
  2.2822 +                              (eq found-type 'middle-or-open)
  2.2823 +                              (eq match-type found-type))
  2.2824 +                          (lua-find-matching-token-word found-token nil
  2.2825 +                                                        search-direction)))
  2.2826 +                    (when maybe-found-pos
  2.2827 +                      (goto-char maybe-found-pos)
  2.2828 +                      (throw 'found maybe-found-pos)))
  2.2829 +              ;; yes.
  2.2830 +              ;; if it is a not a middle kind, report the location
  2.2831 +              (when (not (or (eq found-type 'middle)
  2.2832 +                             (eq found-type 'middle-or-open)))
  2.2833 +                (throw 'found found-pos))
  2.2834 +              ;; if it is a middle-or-open type, record location, but keep searching.
  2.2835 +              ;; If we fail to complete the search, we'll report the location
  2.2836 +              (when (eq found-type 'middle-or-open)
  2.2837 +                (setq maybe-found-pos found-pos))
  2.2838 +              ;; Cannot use tail recursion. too much nesting on long chains of
  2.2839 +              ;; if/elseif. Will reset variables instead.
  2.2840 +              (setq token found-token)
  2.2841 +              (setq token-info (lua-get-block-token-info token))
  2.2842 +              (setq match (lua-get-token-match-re token-info search-direction))
  2.2843 +              (setq match-type (lua-get-token-type token-info))))))
  2.2844 +      maybe-found-pos)))
  2.2845  
  2.2846 -    
  2.2847 -    
  2.2848 -    <span id='server_response_time' data-time='0.34954' data-host='fe19'></span>
  2.2849 -    
  2.2850 -  </body>
  2.2851 -</html>
  2.2852 +(defun lua-goto-matching-block-token (&optional search-start parse-start direction)
  2.2853 +  "Find block begion/end token matching the one at the point.
  2.2854 +This function moves the point to the token that matches the one
  2.2855 +at the current point. Returns the point position of the first character of
  2.2856 +the matching token if successful, nil otherwise."
  2.2857 +  (if parse-start (goto-char parse-start))
  2.2858 +  (let ((case-fold-search nil))
  2.2859 +    (if (looking-at lua-indentation-modifier-regexp)
  2.2860 +        (let ((position (lua-find-matching-token-word (match-string 0)
  2.2861 +                                                      search-start direction)))
  2.2862 +          (and position
  2.2863 +               (goto-char position))))))
  2.2864  
  2.2865 +(defun lua-goto-matching-block (&optional noreport)
  2.2866 +  "Go to the keyword balancing the one under the point.
  2.2867 +If the point is on a keyword/brace that starts a block, go to the
  2.2868 +matching keyword that ends the block, and vice versa."
  2.2869 +  (interactive)
  2.2870 +  ;; search backward to the beginning of the keyword if necessary
  2.2871 +  (if (eq (char-syntax (following-char)) ?w)
  2.2872 +      (re-search-backward "\\_<" nil t))
  2.2873 +  (let ((position (lua-goto-matching-block-token)))
  2.2874 +    (if (and (not position)
  2.2875 +             (not noreport))
  2.2876 +        (error "Not on a block control keyword or brace")
  2.2877 +      position)))
  2.2878 +
  2.2879 +(defun lua-forward-line-skip-blanks (&optional back)
  2.2880 +  "Move 1 line forward (back if BACK is non-nil) skipping blank lines.
  2.2881 +
  2.2882 +Moves point 1 line forward (or backward) skipping lines that contain
  2.2883 +no Lua code besides comments. The point is put to the beginning of
  2.2884 +the line.
  2.2885 +
  2.2886 +Returns final value of point as integer or nil if operation failed."
  2.2887 +  (catch 'found
  2.2888 +    (while t
  2.2889 +      (unless (eql (forward-line (if back -1 1)) 0)    ;; 0 means success
  2.2890 +        (throw 'found nil))
  2.2891 +      (unless (or (looking-at "\\s *\\(--.*\\)?$")
  2.2892 +                  (lua-comment-or-string-p))
  2.2893 +        (throw 'found (point))))))
  2.2894 +
  2.2895 +(eval-when-compile
  2.2896 +  (defconst lua-operator-class
  2.2897 +    "-+*/^.=<>~"))
  2.2898 +
  2.2899 +(defconst lua-cont-eol-regexp
  2.2900 +  (eval-when-compile
  2.2901 +    (concat
  2.2902 +     "\\(\\_<"
  2.2903 +     (regexp-opt '("and" "or" "not" "in" "for" "while"
  2.2904 +                   "local" "function" "if" "until" "elseif" "return") t)
  2.2905 +     "\\_>\\|"
  2.2906 +     "\\(^\\|[^" lua-operator-class "]\\)"
  2.2907 +     (regexp-opt '("+" "-" "*" "/" "^" ".." "==" "=" "<" ">" "<=" ">=" "~=") t)
  2.2908 +     "\\)"
  2.2909 +     "\\s *\\=")
  2.2910 +    )
  2.2911 +  "Regexp that matches the ending of a line that needs continuation
  2.2912 +
  2.2913 +This regexp starts from eol and looks for a binary operator or an unclosed
  2.2914 +block intro (i.e. 'for' without 'do' or 'if' without 'then') followed by
  2.2915 +an optional whitespace till the end of the line.")
  2.2916 +
  2.2917 +(defconst lua-cont-bol-regexp
  2.2918 +  (eval-when-compile
  2.2919 +    (concat
  2.2920 +     "\\=\\s *"
  2.2921 +     "\\(\\_<"
  2.2922 +     (regexp-opt '("and" "or" "not") t)
  2.2923 +     "\\_>\\|"
  2.2924 +     (regexp-opt '("+" "-" "*" "/" "^" ".." "==" "=" "<" ">" "<=" ">=" "~=") t)
  2.2925 +     "\\($\\|[^" lua-operator-class "]\\)"
  2.2926 +     "\\)")
  2.2927 +
  2.2928 +    )
  2.2929 +  "Regexp that matches a line that continues previous one
  2.2930 +
  2.2931 +This regexp means, starting from point there is an optional whitespace followed
  2.2932 +by Lua binary operator. Lua is very liberal when it comes to continuation line,
  2.2933 +so we're safe to assume that every line that starts with a binop continues
  2.2934 +previous one even though it looked like an end-of-statement.")
  2.2935 +
  2.2936 +(defun lua-last-token-continues-p ()
  2.2937 +  "Returns true if the last token on this line is a continuation token."
  2.2938 +  (let ((line-begin (line-beginning-position))
  2.2939 +        (line-end (line-end-position)))
  2.2940 +    (save-excursion
  2.2941 +      (end-of-line)
  2.2942 +      ;; we need to check whether the line ends in a comment and
  2.2943 +      ;; skip that one.
  2.2944 +      (while (lua-find-regexp 'backward "-" line-begin 'lua-string-p)
  2.2945 +        (if (looking-at "--")
  2.2946 +            (setq line-end (point))))
  2.2947 +      (goto-char line-end)
  2.2948 +      (re-search-backward lua-cont-eol-regexp line-begin t))))
  2.2949 +
  2.2950 +(defun lua-first-token-continues-p ()
  2.2951 +  "Returns true if the first token on this line is a continuation token."
  2.2952 +  (let ((line-end (line-end-position)))
  2.2953 +    (save-excursion
  2.2954 +      (beginning-of-line)
  2.2955 +      ;; if first character of the line is inside string, it's a continuation
  2.2956 +      ;; if strings aren't supposed to be indented, `lua-calculate-indentation' won't even let
  2.2957 +      ;; the control inside this function
  2.2958 +      (re-search-forward lua-cont-bol-regexp line-end t))))
  2.2959 +
  2.2960 +(defun lua-is-continuing-statement-p (&optional parse-start)
  2.2961 +  "Return non-nil if the line continues a statement.
  2.2962 +More specifically, return the point in the line that is continued.
  2.2963 +The criteria for a continuing statement are:
  2.2964 +
  2.2965 +* the last token of the previous line is a continuing op,
  2.2966 +  OR the first token of the current line is a continuing op
  2.2967 +
  2.2968 +"
  2.2969 +  (let ((prev-line nil))
  2.2970 +    (save-excursion
  2.2971 +      (if parse-start (goto-char parse-start))
  2.2972 +      (save-excursion (setq prev-line (lua-forward-line-skip-blanks 'back)))
  2.2973 +      (and prev-line
  2.2974 +           (or (lua-first-token-continues-p)
  2.2975 +               (and (goto-char prev-line)
  2.2976 +                    ;; check last token of previous nonblank line
  2.2977 +                    (lua-last-token-continues-p)))))))
  2.2978 +
  2.2979 +(defun lua-make-indentation-info-pair (found-token found-pos)
  2.2980 +  "This is a helper function to lua-calculate-indentation-info. Don't
  2.2981 +use standalone."
  2.2982 +  (cond
  2.2983 +   ;; function is a bit tricky to indent right. They can appear in a lot ot
  2.2984 +   ;; different contexts. Until I find a shortcut, I'll leave it with a simple
  2.2985 +   ;; relative indentation.
  2.2986 +   ;; The special cases are for indenting according to the location of the
  2.2987 +   ;; function. i.e.:
  2.2988 +   ;;       (cons 'absolute (+ (current-column) lua-indent-level))
  2.2989 +   ;; TODO: Fix this. It causes really ugly indentations for in-line functions.
  2.2990 +   ((string-equal found-token "function")
  2.2991 +    (cons 'relative lua-indent-level))
  2.2992 +
  2.2993 +   ;; block openers
  2.2994 +   ((member found-token (list "{" "(" "["))
  2.2995 +	 (save-excursion
  2.2996 +	   ;; expression follows -> indent at start of next expression
  2.2997 +       ;; Last token on the line -> simple relative indent
  2.2998 +	   (if (and (not (search-forward-regexp "[[:space:]]--" (line-end-position) t))
  2.2999 +                (search-forward-regexp "[^[:space:]]" (line-end-position) t))
  2.3000 +           (cons 'absolute (1- (current-column)))
  2.3001 +         (cons 'relative lua-indent-level))))
  2.3002 +
  2.3003 +   ;; These are not really block starters. They should not add to indentation.
  2.3004 +   ;; The corresponding "then" and "do" handle the indentation.
  2.3005 +   ((member found-token (list "if" "for" "while"))
  2.3006 +    (cons 'relative 0))
  2.3007 +   ;; closing tokens follow: These are usually taken care of by
  2.3008 +   ;; lua-calculate-indentation-override.
  2.3009 +   ;; elseif is a bit of a hack. It is not handled separately, but it needs to
  2.3010 +   ;; nullify a previous then if on the same line.
  2.3011 +   ((member found-token (list "until" "elseif"))
  2.3012 +    (save-excursion
  2.3013 +      (let ((line (line-number-at-pos)))
  2.3014 +        (if (and (lua-goto-matching-block-token nil found-pos 'backward)
  2.3015 +                 (= line (line-number-at-pos)))
  2.3016 +            (cons 'remove-matching 0)
  2.3017 +          (cons 'relative 0)))))
  2.3018 +
  2.3019 +   ;; else is a special case; if its matching block token is on the same line,
  2.3020 +   ;; instead of removing the matching token, it has to replace it, so that
  2.3021 +   ;; either the next line will be indented correctly, or the end on the same
  2.3022 +   ;; line will remove the effect of the else.
  2.3023 +   ((string-equal found-token "else")
  2.3024 +     (save-excursion
  2.3025 +       (let ((line (line-number-at-pos)))
  2.3026 +         (if (and (lua-goto-matching-block-token nil found-pos 'backward)
  2.3027 +                  (= line (line-number-at-pos)))
  2.3028 +             (cons 'replace-matching (cons 'relative lua-indent-level))
  2.3029 +                   (cons 'relative lua-indent-level)))))
  2.3030 +
  2.3031 +   ;; Block closers. If they are on the same line as their openers, they simply
  2.3032 +   ;; eat up the matching indentation modifier. Otherwise, they pull
  2.3033 +   ;; indentation back to the matching block opener.
  2.3034 +   ((member found-token (list ")" "}" "]" "end"))
  2.3035 +    (save-excursion
  2.3036 +      (let ((line (line-number-at-pos)))
  2.3037 +        (lua-goto-matching-block-token nil found-pos 'backward)
  2.3038 +        (if (/= line (line-number-at-pos))
  2.3039 +            (cons 'absolute
  2.3040 +                  (+ (current-indentation)
  2.3041 +                     (lua-calculate-indentation-block-modifier
  2.3042 +                      nil (point))))
  2.3043 +          (cons 'remove-matching 0)))))
  2.3044 +
  2.3045 +   ;; Everything else. This is from the original code: If opening a block
  2.3046 +   ;; (match-data 1 exists), then push indentation one level up, if it is
  2.3047 +   ;; closing a block, pull it one level down.
  2.3048 +   ('other-indentation-modifier
  2.3049 +    (cons 'relative (if (nth 2 (match-data))
  2.3050 +                        ;; beginning of a block matched
  2.3051 +                        lua-indent-level
  2.3052 +                      ;; end of a block matched
  2.3053 +                      (- lua-indent-level))))))
  2.3054 +
  2.3055 +(defun  lua-add-indentation-info-pair (pair info)
  2.3056 +  "Add the given indentation info pair to the list of indentation information.
  2.3057 +This function has special case handling for two tokens: remove-matching,
  2.3058 +and replace-matching. These two tokens are cleanup tokens that remove or
  2.3059 +alter the effect of a previously recorded indentation info.
  2.3060 +
  2.3061 +When a remove-matching token is encountered, the last recorded info, i.e.
  2.3062 +the car of the list is removed. This is used to roll-back an indentation of a
  2.3063 +block opening statement when it is closed.
  2.3064 +
  2.3065 +When a replace-matching token is seen, the last recorded info is removed,
  2.3066 +and the cdr of the replace-matching info is added in its place. This is used
  2.3067 +when a middle-of the block (the only case is 'else') is seen on the same line
  2.3068 +the block is opened."
  2.3069 +  (cond
  2.3070 +   ( (eq 'remove-matching (car pair))
  2.3071 +     ; Remove head of list
  2.3072 +     (cdr info))
  2.3073 +   ( (eq 'replace-matching (car pair))
  2.3074 +     ; remove head of list, and add the cdr of pair instead
  2.3075 +     (cons (cdr pair) (cdr info)))
  2.3076 +   ( t
  2.3077 +     ; Just add the pair
  2.3078 +     (cons pair info))))
  2.3079 +
  2.3080 +(defun lua-calculate-indentation-info (&optional parse-start parse-end)
  2.3081 +  "For each block token on the line, computes how it affects the indentation.
  2.3082 +The effect of each token can be either a shift relative to the current
  2.3083 +indentation level, or indentation to some absolute column. This information
  2.3084 +is collected in a list of indentation info pairs, which denote absolute
  2.3085 +and relative each, and the shift/column to indent to."
  2.3086 +  (let ((combined-line-end (line-end-position))
  2.3087 +        (start-indentation (current-indentation)))
  2.3088 +    (save-excursion
  2.3089 +      (while (lua-last-token-continues-p)
  2.3090 +        (lua-forward-line-skip-blanks)
  2.3091 +        (setq combined-line-end (line-end-position))))
  2.3092 +    (let ((search-stop (if parse-end
  2.3093 +                           (min parse-end combined-line-end)
  2.3094 +                         combined-line-end))
  2.3095 +          (indentation-info nil))
  2.3096 +      (if parse-start (goto-char parse-start))
  2.3097 +      (save-excursion
  2.3098 +        (beginning-of-line)
  2.3099 +        (while (lua-find-regexp 'forward lua-indentation-modifier-regexp
  2.3100 +                                search-stop)
  2.3101 +          (let ((found-token (match-string 0))
  2.3102 +                (found-pos (match-beginning 0))
  2.3103 +                (found-end (match-end 0))
  2.3104 +                (data (match-data)))
  2.3105 +            (setq indentation-info
  2.3106 +		  (lua-add-indentation-info-pair
  2.3107 +		   (lua-make-indentation-info-pair found-token found-pos)
  2.3108 +		   indentation-info))))
  2.3109 +	(or indentation-info
  2.3110 +	    (list (cons 'absolute start-indentation)))))))
  2.3111 +
  2.3112 +(defun lua-accumulate-indentation-info (info)
  2.3113 +  "Accumulates the indentation information previously calculated by
  2.3114 +lua-calculate-indentation-info. Returns either the relative indentation
  2.3115 +shift, or the absolute column to indent to."
  2.3116 +  (let ((info-list (reverse info))
  2.3117 +        (type 'relative)
  2.3118 +        (accu 0))
  2.3119 +    (mapc (lambda (x)
  2.3120 +            (setq accu (if (eq 'absolute (car x))
  2.3121 +                           (progn (setq type 'absolute)
  2.3122 +                                  (cdr x))
  2.3123 +                         (+ accu (cdr x)))))
  2.3124 +          info-list)
  2.3125 +    (cons type accu)))
  2.3126 +
  2.3127 +(defun lua-calculate-indentation-block-modifier (&optional parse-start
  2.3128 +                                                           parse-end)
  2.3129 +  "Return amount by which this line modifies the indentation.
  2.3130 +Beginnings of blocks add lua-indent-level once each, and endings
  2.3131 +of blocks subtract lua-indent-level once each. This function is used
  2.3132 +to determine how the indentation of the following line relates to this
  2.3133 +one."
  2.3134 +  (if parse-start (goto-char parse-start))
  2.3135 +  ;; First go back to the line that starts it all
  2.3136 +  ;; lua-calculate-indentation-info will scan through the whole thing
  2.3137 +  (while (lua-is-continuing-statement-p)
  2.3138 +    (lua-forward-line-skip-blanks 'back))
  2.3139 +  (let ((case-fold-search nil)
  2.3140 +        (indentation-info (lua-accumulate-indentation-info
  2.3141 +                           (lua-calculate-indentation-info nil parse-end))))
  2.3142 +    (if (eq (car indentation-info) 'absolute)
  2.3143 +        (- (cdr indentation-info) (current-indentation))
  2.3144 +      (cdr indentation-info))))
  2.3145 +
  2.3146 +(defun lua-point-is-after-left-shifter-p ()
  2.3147 +  "Check if point is at a left-shifter.
  2.3148 +A left-shifter is a partial lua expression which should be ignored for line up purposes when closing a block. An example of this is:
  2.3149 +   local a = function()
  2.3150 +      ....
  2.3151 +   end
  2.3152 +   ^         ^
  2.3153 +   |         +- not here
  2.3154 +   +- Close here"
  2.3155 +  (save-excursion
  2.3156 +    (let ((old-point (point)))
  2.3157 +      (back-to-indentation)
  2.3158 +      (and
  2.3159 +       (or (looking-at "local\\s +\\(?:\\(?:\\sw\\|\\s_\\)+\\s *\\(,\\s *\\(?:\\sw\\|\\s_\\)+\\s *\\)*=\\s *\\)?")
  2.3160 +           ;; This is too generic, and will screw up a lot of indentations. Will need
  2.3161 +           ;; a better regexp for assignments
  2.3162 +           (looking-at "[^=]*=\\s *"))
  2.3163 +       (= old-point (match-end 0))))))
  2.3164 +
  2.3165 +(defun lua-calculate-indentation-override (&optional parse-start)
  2.3166 +  "Return overriding indentation amount for special cases.
  2.3167 +Look for an uninterrupted sequence of block-closing tokens that starts
  2.3168 +at the beginning of the line. For each of these tokens, shift indentation
  2.3169 +to the left by the amount specified in lua-indent-level."
  2.3170 +  (let ((indentation-modifier 0)
  2.3171 +        (case-fold-search nil)
  2.3172 +        (block-token nil))
  2.3173 +    (save-excursion
  2.3174 +      (if parse-start (goto-char parse-start))
  2.3175 +      ;; Look for the last block closing token
  2.3176 +      (back-to-indentation)
  2.3177 +      (if (and (not (lua-comment-or-string-p))
  2.3178 +               (looking-at lua-indentation-modifier-regexp)
  2.3179 +               (let ((token-info (lua-get-block-token-info (match-string 0))))
  2.3180 +                 (and token-info
  2.3181 +                      (not (eq 'open (lua-get-token-type token-info))))))
  2.3182 +          (when (lua-goto-matching-block-token nil nil 'backward)
  2.3183 +            ;; Exception cases: when the start of the line is an assignment,
  2.3184 +            ;; go to the start of the assignment instead of the matching item
  2.3185 +            (let ((block-start-column (current-column))
  2.3186 +                  (block-start-point (point)))
  2.3187 +              (if (lua-point-is-after-left-shifter-p)
  2.3188 +                  (current-indentation)
  2.3189 +                block-start-column)))))))
  2.3190 +
  2.3191 +(defun lua-calculate-indentation (&optional parse-start)
  2.3192 +  "Return appropriate indentation for current line as Lua code."
  2.3193 +  (save-excursion
  2.3194 +    (let ((continuing-p (lua-is-continuing-statement-p)))
  2.3195 +      (or
  2.3196 +       ;; when calculating indentation, do the following:
  2.3197 +       ;; 1. check, if the line starts with indentation-modifier (open/close brace)
  2.3198 +       ;;    and if it should be indented/unindented in special way
  2.3199 +       (lua-calculate-indentation-override)
  2.3200 +
  2.3201 +       ;; 2. otherwise, use indentation modifiers from previous line + it's own indentation
  2.3202 +       ;; 3. if previous line doesn't contain indentation modifiers, additionally check
  2.3203 +       ;;    if current line is a continuation line and add lua-indent-level if it is
  2.3204 +       (when (lua-forward-line-skip-blanks 'back)
  2.3205 +         ;; the order of function calls here is important. block modifier
  2.3206 +         ;; call may change the point to another line
  2.3207 +         (let ((modifier
  2.3208 +                (lua-calculate-indentation-block-modifier nil (line-end-position))))
  2.3209 +           (+ (if (and continuing-p (= 0 modifier))
  2.3210 +                  lua-indent-level
  2.3211 +                modifier)
  2.3212 +              (current-indentation))))
  2.3213 +
  2.3214 +       ;; 4. if there's no previous line, indentation is 0
  2.3215 +       0))))
  2.3216 +
  2.3217 +(defun lua-beginning-of-proc (&optional arg)
  2.3218 +  "Move backward to the beginning of a lua proc (or similar).
  2.3219 +With argument, do it that many times.  Negative arg -N
  2.3220 +means move forward to Nth following beginning of proc.
  2.3221 +Returns t unless search stops due to beginning or end of buffer."
  2.3222 +  (interactive "P")
  2.3223 +  (or arg
  2.3224 +      (setq arg 1))
  2.3225 +  (let ((found nil)
  2.3226 +        (ret t))
  2.3227 +    (while (< arg 0)
  2.3228 +      (if (re-search-forward "^function[ \t]" nil t)
  2.3229 +          (setq arg (1+ arg)
  2.3230 +                found t)
  2.3231 +        (setq ret nil
  2.3232 +              arg 0)))
  2.3233 +    (if found
  2.3234 +        (beginning-of-line))
  2.3235 +    (if (> arg 0)
  2.3236 +        (if (re-search-forward "^function[ \t]" nil t)
  2.3237 +            (setq arg (1+ arg))
  2.3238 +          (goto-char (point-max))))
  2.3239 +    (while (> arg 0)
  2.3240 +      (if (re-search-backward "^function[ \t]" nil t)
  2.3241 +          (setq arg (1- arg))
  2.3242 +        (setq ret nil
  2.3243 +              arg 0)))
  2.3244 +    ret))
  2.3245 +
  2.3246 +(defun lua-end-of-proc (&optional arg)
  2.3247 +  "Move forward to next end of lua proc (or similar).
  2.3248 +With argument, do it that many times.  Negative argument -N means move
  2.3249 +back to Nth preceding end of proc.
  2.3250 +
  2.3251 +This function just searches for a `end' at the beginning of a line."
  2.3252 +  (interactive "P")
  2.3253 +  (or arg
  2.3254 +      (setq arg 1))
  2.3255 +  (let ((found nil)
  2.3256 +        (ret t))
  2.3257 +    (if (and (< arg 0)
  2.3258 +             (not (bolp))
  2.3259 +             (save-excursion
  2.3260 +               (beginning-of-line)
  2.3261 +               (eq (following-char) ?})))
  2.3262 +        (forward-char -1))
  2.3263 +    (while (> arg 0)
  2.3264 +      (if (re-search-forward "^end" nil t)
  2.3265 +          (setq arg (1- arg)
  2.3266 +                found t)
  2.3267 +        (setq ret nil
  2.3268 +              arg 0)))
  2.3269 +    (while (< arg 0)
  2.3270 +      (if (re-search-backward "^end" nil t)
  2.3271 +          (setq arg (1+ arg)
  2.3272 +                found t)
  2.3273 +        (setq ret nil
  2.3274 +              arg 0)))
  2.3275 +    (if found
  2.3276 +        (progn
  2.3277 +          (beginning-of-line)
  2.3278 +          (forward-line)))
  2.3279 +    ret))
  2.3280 +
  2.3281 +(defun lua-start-process (&optional name program startfile &rest switches)
  2.3282 +  "Start a lua process named NAME, running PROGRAM.
  2.3283 +PROGRAM defaults to NAME, which defaults to `lua-default-application'.
  2.3284 +When called interactively, switch to the process buffer."
  2.3285 +  (interactive)
  2.3286 +  (or switches
  2.3287 +      (setq switches lua-default-command-switches))
  2.3288 +  (setq name (or name lua-default-application))
  2.3289 +  (setq program (or program name))
  2.3290 +  (setq lua-process-buffer (apply 'make-comint name program startfile switches))
  2.3291 +  (setq lua-process (get-buffer-process lua-process-buffer))
  2.3292 +  ;; wait for prompt
  2.3293 +  (with-current-buffer lua-process-buffer
  2.3294 +    (while (not (lua-prompt-line))
  2.3295 +      (accept-process-output (get-buffer-process (current-buffer)))
  2.3296 +      (goto-char (point-max))))
  2.3297 +  ;; when called interactively, switch to process buffer
  2.3298 +  (if (lua--called-interactively-p 'any)
  2.3299 +      (switch-to-buffer lua-process-buffer)))
  2.3300 +
  2.3301 +(defun lua-kill-process ()
  2.3302 +  "Kill lua subprocess and its buffer."
  2.3303 +  (interactive)
  2.3304 +  (if lua-process-buffer
  2.3305 +      (kill-buffer lua-process-buffer)))
  2.3306 +
  2.3307 +(defun lua-set-lua-region-start (&optional arg)
  2.3308 +  "Set start of region for use with `lua-send-lua-region'."
  2.3309 +  (interactive)
  2.3310 +  (set-marker lua-region-start (or arg (point))))
  2.3311 +
  2.3312 +(defun lua-set-lua-region-end (&optional arg)
  2.3313 +  "Set end of region for use with `lua-send-lua-region'."
  2.3314 +  (interactive)
  2.3315 +  (set-marker lua-region-end (or arg (point))))
  2.3316 +
  2.3317 +(defun lua-send-current-line ()
  2.3318 +  "Send current line to lua subprocess, found in `lua-process'.
  2.3319 +If `lua-process' is nil or dead, start a new process first."
  2.3320 +  (interactive)
  2.3321 +  (lua-send-region (line-beginning-position) (line-end-position)))
  2.3322 +
  2.3323 +(defun lua-send-region (start end)
  2.3324 +  "Send region to lua subprocess."
  2.3325 +  (interactive "r")
  2.3326 +  ;; make temporary lua file
  2.3327 +  (let ((tempfile (lua-make-temp-file "lua-"))
  2.3328 +        (last-prompt nil)
  2.3329 +        (prompt-found nil)
  2.3330 +        (lua-stdin-line-offset (count-lines (point-min) start))
  2.3331 +        (lua-stdin-buffer (current-buffer))
  2.3332 +        current-prompt )
  2.3333 +    (write-region start end tempfile)
  2.3334 +    (or (and lua-process
  2.3335 +             (comint-check-proc lua-process-buffer))
  2.3336 +        (lua-start-process lua-default-application))
  2.3337 +    ;; kill lua process without query
  2.3338 +    (if (fboundp 'process-kill-without-query)
  2.3339 +        (process-kill-without-query lua-process))
  2.3340 +    ;; send dofile(tempfile)
  2.3341 +    (with-current-buffer lua-process-buffer
  2.3342 +      (goto-char (point-max))
  2.3343 +      (setq last-prompt (point-max))
  2.3344 +      (comint-simple-send (get-buffer-process (current-buffer))
  2.3345 +                          (format "dofile(\"%s\")"
  2.3346 +                                  (replace-regexp-in-string "\\\\" "\\\\\\\\" tempfile)))
  2.3347 +      ;; wait for prompt
  2.3348 +      (while (not prompt-found)
  2.3349 +        (accept-process-output (get-buffer-process (current-buffer)))
  2.3350 +        (goto-char (point-max))
  2.3351 +        (setq prompt-found (and (lua-prompt-line) (< last-prompt (point-max)))))
  2.3352 +      ;; remove temp. lua file
  2.3353 +      (delete-file tempfile)
  2.3354 +      (lua-postprocess-output-buffer lua-process-buffer last-prompt lua-stdin-line-offset)
  2.3355 +      (if lua-always-show
  2.3356 +          (display-buffer lua-process-buffer)))))
  2.3357 +
  2.3358 +(defun lua-postprocess-output-buffer (buf start &optional lua-stdin-line-offset)
  2.3359 +  "Highlight tracebacks found in buf. If an traceback occurred return
  2.3360 +t, otherwise return nil.  BUF must exist."
  2.3361 +  (let ((lua-stdin-line-offset (or lua-stdin-line-offset 0))
  2.3362 +        line file bol err-p)
  2.3363 +    (with-current-buffer buf
  2.3364 +      (goto-char start)
  2.3365 +      (beginning-of-line)
  2.3366 +      (if (re-search-forward lua-traceback-line-re nil t)
  2.3367 +          (setq file (match-string 1)
  2.3368 +                line (string-to-number (match-string 2)))))
  2.3369 +    (when (and lua-jump-on-traceback line)
  2.3370 +      (beep)
  2.3371 +      ;; FIXME: highlight
  2.3372 +      (lua-jump-to-traceback file line lua-stdin-line-offset)
  2.3373 +      (setq err-p t))
  2.3374 +    err-p))
  2.3375 +
  2.3376 +(defun lua-jump-to-traceback (file line lua-stdin-line-offset)
  2.3377 +  "Jump to the Lua code in FILE at LINE."
  2.3378 +  ;; sanity check: temporary-file-directory
  2.3379 +  (if (string= (substring file 0 3)  "...")
  2.3380 +      (message "Lua traceback output truncated: customize 'temporary-file-directory' or increase 'LUA_IDSIZE' in 'luaconf.h'.")
  2.3381 +    (let ((buffer (cond ((or (string-equal file tempfile) (string-equal file "stdin"))
  2.3382 +                         (setq line (+ line lua-stdin-line-offset))
  2.3383 +                         lua-stdin-buffer)
  2.3384 +                        (t (find-file-noselect file)))))
  2.3385 +      (pop-to-buffer buffer)
  2.3386 +      ;; Force Lua mode
  2.3387 +      (if (not (eq major-mode 'lua-mode))
  2.3388 +          (lua-mode))
  2.3389 +      ;; FIXME: fix offset when executing region
  2.3390 +      (goto-char (point-min)) (forward-line (1- line))
  2.3391 +      (message "Jumping to error in file %s on line %d" file line))))
  2.3392 +
  2.3393 +(defun lua-prompt-line ()
  2.3394 +  (save-excursion
  2.3395 +    (save-match-data
  2.3396 +      (forward-line 0)
  2.3397 +      (if (looking-at comint-prompt-regexp)
  2.3398 +          (match-end 0)))))
  2.3399 +
  2.3400 +(defun lua-send-lua-region ()
  2.3401 +  "Send preset lua region to lua subprocess."
  2.3402 +  (interactive)
  2.3403 +  (or (and lua-region-start lua-region-end)
  2.3404 +      (error "lua-region not set"))
  2.3405 +  (or (and lua-process
  2.3406 +           (comint-check-proc lua-process-buffer))
  2.3407 +      (lua-start-process lua-default-application))
  2.3408 +  (comint-simple-send lua-process
  2.3409 +                      (buffer-substring lua-region-start lua-region-end)
  2.3410 +                      )
  2.3411 +  (if lua-always-show
  2.3412 +      (display-buffer lua-process-buffer)))
  2.3413 +
  2.3414 +(defun lua-send-proc ()
  2.3415 +  "Send proc around point to lua subprocess."
  2.3416 +  (interactive)
  2.3417 +  (let (beg end)
  2.3418 +    (save-excursion
  2.3419 +      (lua-beginning-of-proc)
  2.3420 +      (setq beg (point))
  2.3421 +      (lua-end-of-proc)
  2.3422 +      (setq end (point)))
  2.3423 +    (or (and lua-process
  2.3424 +             (comint-check-proc lua-process-buffer))
  2.3425 +        (lua-start-process lua-default-application))
  2.3426 +    (comint-simple-send lua-process
  2.3427 +                        (buffer-substring beg end))
  2.3428 +    (if lua-always-show
  2.3429 +        (display-buffer lua-process-buffer))))
  2.3430 +
  2.3431 +;; FIXME: This needs work... -Bret
  2.3432 +(defun lua-send-buffer ()
  2.3433 +  "Send whole buffer to lua subprocess."
  2.3434 +  (interactive)
  2.3435 +  (lua-send-region (point-min) (point-max)))
  2.3436 +
  2.3437 +(defun lua-restart-with-whole-file ()
  2.3438 +  "Restart lua subprocess and send whole file as input."
  2.3439 +  (interactive)
  2.3440 +  (lua-kill-process)
  2.3441 +  (lua-start-process lua-default-application)
  2.3442 +  (lua-send-buffer))
  2.3443 +
  2.3444 +(defun lua-show-process-buffer ()
  2.3445 +  "Make sure `lua-process-buffer' is being displayed."
  2.3446 +  (interactive)
  2.3447 +  (display-buffer lua-process-buffer))
  2.3448 +
  2.3449 +(defun lua-hide-process-buffer ()
  2.3450 +  "Delete all windows that display `lua-process-buffer'."
  2.3451 +  (interactive)
  2.3452 +  (delete-windows-on lua-process-buffer))
  2.3453 +
  2.3454 +(defun lua-search-documentation ()
  2.3455 +  "Search Lua documentation for the word at the point."
  2.3456 +  (interactive)
  2.3457 +  (browse-url (concat lua-search-url-prefix (current-word t))))
  2.3458 +
  2.3459 +(defun lua-toggle-electric-state (&optional arg)
  2.3460 +  "Toggle the electric indentation feature.
  2.3461 +Optional numeric ARG, if supplied, turns on electric indentation when
  2.3462 +positive, turns it off when negative, and just toggles it when zero or
  2.3463 +left out."
  2.3464 +  (interactive "P")
  2.3465 +  (let ((num_arg (prefix-numeric-value arg)))
  2.3466 +    (setq lua-electric-flag (cond ((or (null arg)
  2.3467 +                                       (zerop num_arg)) (not lua-electric-flag))
  2.3468 +                                  ((< num_arg 0) nil)
  2.3469 +                                  ((> num_arg 0) t))))
  2.3470 +  (message "%S" lua-electric-flag))
  2.3471 +
  2.3472 +(defun lua-forward-sexp (&optional count)
  2.3473 +  "Forward to block end"
  2.3474 +  (interactive "p")
  2.3475 +  (save-match-data
  2.3476 +    (let* ((count (or count 1))
  2.3477 +           (block-start (mapcar 'car lua-sexp-alist))
  2.3478 +           (block-end (mapcar 'cdr lua-sexp-alist))
  2.3479 +           (block-regex (regexp-opt (append  block-start block-end) 'words))
  2.3480 +           current-exp
  2.3481 +           )
  2.3482 +      (while (> count 0)
  2.3483 +        ;; skip whitespace
  2.3484 +        (skip-chars-forward " \t\n")
  2.3485 +        (if (looking-at (regexp-opt block-start 'words))
  2.3486 +            (let ((keyword (match-string 1)))
  2.3487 +              (lua-find-matching-token-word keyword nil))
  2.3488 +          ;; If the current keyword is not a "begin" keyword, then just
  2.3489 +          ;; perform the normal forward-sexp.
  2.3490 +          (forward-sexp 1))
  2.3491 +        (setq count (1- count))))))
  2.3492 +
  2.3493 +
  2.3494 +;; menu bar
  2.3495 +
  2.3496 +(define-key lua-mode-menu [restart-with-whole-file]
  2.3497 +  '("Restart With Whole File" .  lua-restart-with-whole-file))
  2.3498 +(define-key lua-mode-menu [kill-process]
  2.3499 +  '("Kill Process" . lua-kill-process))
  2.3500 +
  2.3501 +(define-key lua-mode-menu [hide-process-buffer]
  2.3502 +  '("Hide Process Buffer" . lua-hide-process-buffer))
  2.3503 +(define-key lua-mode-menu [show-process-buffer]
  2.3504 +  '("Show Process Buffer" . lua-show-process-buffer))
  2.3505 +
  2.3506 +(define-key lua-mode-menu [end-of-proc]
  2.3507 +  '("End Of Proc" . lua-end-of-proc))
  2.3508 +(define-key lua-mode-menu [beginning-of-proc]
  2.3509 +  '("Beginning Of Proc" . lua-beginning-of-proc))
  2.3510 +
  2.3511 +(define-key lua-mode-menu [send-lua-region]
  2.3512 +  '("Send Lua-Region" . lua-send-lua-region))
  2.3513 +(define-key lua-mode-menu [set-lua-region-end]
  2.3514 +  '("Set Lua-Region End" . lua-set-lua-region-end))
  2.3515 +(define-key lua-mode-menu [set-lua-region-start]
  2.3516 +  '("Set Lua-Region Start" . lua-set-lua-region-start))
  2.3517 +
  2.3518 +(define-key lua-mode-menu [send-current-line]
  2.3519 +  '("Send Current Line" . lua-send-current-line))
  2.3520 +(define-key lua-mode-menu [send-region]
  2.3521 +  '("Send Region" . lua-send-region))
  2.3522 +(define-key lua-mode-menu [send-proc]
  2.3523 +  '("Send Proc" . lua-send-proc))
  2.3524 +(define-key lua-mode-menu [send-buffer]
  2.3525 +  '("Send Buffer" . lua-send-buffer))
  2.3526 +(define-key lua-mode-menu [search-documentation]
  2.3527 +  '("Search Documentation" . lua-search-documentation))
  2.3528 +
  2.3529 +(defsubst lua-put-char-property (pos property value &optional object)
  2.3530 +  (lua--with-silent-modifications
  2.3531 +
  2.3532 +   (if value
  2.3533 +       (put-text-property pos (1+ pos) property value object)
  2.3534 +     (remove-text-properties pos (1+ pos) (list property nil))))
  2.3535 +
  2.3536 +  ;; `lua--with-silent-modifications' inhibits modification hooks, one of which
  2.3537 +  ;; is the hook that keeps `syntax-ppss' internal cache up-to-date. If this
  2.3538 +  ;; isn't done, the results of subsequent calls to `syntax-ppss' are
  2.3539 +  ;; invalid. To avoid such cache discrepancy, the hook must be run manually.
  2.3540 +  (syntax-ppss-flush-cache pos))
  2.3541 +
  2.3542 +(defsubst lua-put-char-syntax-table (pos value &optional object)
  2.3543 +  (lua-put-char-property pos 'syntax-table value object))
  2.3544 +
  2.3545 +(defsubst lua-get-multiline-delim-syntax (type)
  2.3546 +  (cond ((eq type 'string) '(15))
  2.3547 +        ((eq type 'comment) '(14))
  2.3548 +        (nil)))
  2.3549 +
  2.3550 +(defun lua-mark-char-multiline-delim (pos type)
  2.3551 +  "Mark character as a delimiter of Lua multiline construct
  2.3552 +
  2.3553 +If TYPE is string, mark char  as string delimiter. If TYPE is comment,
  2.3554 +mark char as comment delimiter.  Otherwise, remove the mark if any."
  2.3555 +   (lua-put-char-syntax-table pos (lua-get-multiline-delim-syntax type)))
  2.3556 +
  2.3557 +(defsubst lua-inside-multiline-p (&optional pos)
  2.3558 +  (let ((status (syntax-ppss pos)))
  2.3559 +    (or (eq (elt status 3) t)                ;; inside generic string
  2.3560 +        (eq (elt status 7) 'syntax-table)))) ;; inside generic comment
  2.3561 +
  2.3562 +(defun lua-get-multiline-start (&optional pos)
  2.3563 +  (interactive)
  2.3564 +  (when (lua-inside-multiline-p pos) ;; return string/comment start
  2.3565 +    (elt (syntax-ppss pos) 8)))
  2.3566 +
  2.3567 +(defun lua-unmark-multiline-literals (&optional begin end)
  2.3568 +  "Clears all Lua multiline construct markers in region
  2.3569 +
  2.3570 +If BEGIN is nil, start from `beginning-of-buffer'.
  2.3571 +If END is nil, stop at `end-of-buffer'."
  2.3572 +  (interactive)
  2.3573 +
  2.3574 +  (setq begin (or begin (point-min))
  2.3575 +        end   (or end   (point-max)))
  2.3576 +
  2.3577 +  (lua--with-silent-modifications
  2.3578 +   (remove-text-properties begin end '(syntax-table ())))
  2.3579 +
  2.3580 +  ;; `lua--with-silent-modifications' inhibits modification hooks, one of which
  2.3581 +  ;; is the hook that keeps `syntax-ppss' internal cache up-to-date. If this
  2.3582 +  ;; isn't done, the results of subsequent calls to `syntax-ppss' are
  2.3583 +  ;; invalid. To avoid such cache discrepancy, the hook must be run manually.
  2.3584 +  (syntax-ppss-flush-cache begin)
  2.3585 +
  2.3586 +  (font-lock-fontify-buffer))
  2.3587 +
  2.3588 +(defun lua-mark-multiline-region (begin end)
  2.3589 +  (let ((type (if (eq ?- (char-after begin)) 'comment 'string)))
  2.3590 +  (lua-mark-char-multiline-delim begin type)
  2.3591 +  (when end
  2.3592 +    (lua-mark-char-multiline-delim (1- end) type))))
  2.3593 +
  2.3594 +(defun lua-mark-all-multiline-literals (&optional begin end)
  2.3595 +  "Marks all Lua multiline constructs in region
  2.3596 +
  2.3597 +If BEGIN is nil, start from `beginning-of-buffer'.
  2.3598 +If END is nil, stop at `end-of-buffer'."
  2.3599 +  (interactive)
  2.3600 +
  2.3601 +  (if (and (lua--called-interactively-p 'any) (use-region-p))
  2.3602 +      (setq begin (region-beginning)
  2.3603 +            end (region-end)))
  2.3604 +
  2.3605 +  (lua-unmark-multiline-literals begin end)
  2.3606 +  (save-excursion
  2.3607 +    (goto-char (or begin (point-min)))
  2.3608 +
  2.3609 +    (while (and
  2.3610 +            ;; must check  for point range,  because matching previous
  2.3611 +            ;; multiline  end might  move  point beyond  end and  this
  2.3612 +            ;; drives `re-search-forward' crazy
  2.3613 +            (if end (< (point) end) t)
  2.3614 +            ;; look for
  2.3615 +            ;; 1. (optional) two or more dashes followed by
  2.3616 +            ;; 2. lua multiline delimiter [[
  2.3617 +            (re-search-forward "\\(?2:--\\)?\\[\\(?1:=*\\)\\[" end 'noerror))
  2.3618 +      ;; match-start + 1 is considered instead of match-start, because
  2.3619 +      ;; such  approach  handles  '---[[' situation  correctly:  Emacs
  2.3620 +      ;; thinks 2nd dash (i.e.  match-start) is not yet a comment, but
  2.3621 +      ;; the third one is, hence the +1.  In all the other situations,
  2.3622 +      ;; '+1'  is safe  to use  because  it bears  the same  syntactic
  2.3623 +      ;; properties, i.e.  if match-start is inside string-or-comment,
  2.3624 +      ;; then '+1' is too and vice versa.
  2.3625 +      ;;
  2.3626 +      ;; PS. ping me if you find a situation in which this is not true
  2.3627 +      (unless (lua-comment-or-string-p (1+ (match-beginning 0)))
  2.3628 +        (let (ml-begin ml-end)
  2.3629 +          (setq ml-begin (match-beginning 0))
  2.3630 +          (when (re-search-forward (format "\\]%s\\]" (or (match-string 1) "")) nil 'noerror)
  2.3631 +            ;; (message "found match %s" (match-string 0))
  2.3632 +            (setq ml-end (match-end 0)))
  2.3633 +          (lua-mark-multiline-region ml-begin ml-end))))))
  2.3634 +
  2.3635 +(defvar lua-automark-multiline-timer nil
  2.3636 +  "Contains idle-timer object used for automatical multiline literal markup which must be cleaned up on exit.")
  2.3637 +(make-variable-buffer-local 'lua-automark-multiline-timer)
  2.3638 +
  2.3639 +(defvar lua-automark-multiline-start-pos nil
  2.3640 +  "Contains position from which automark procedure should start.
  2.3641 +
  2.3642 +Automarking shall start at the point before which no modification has been
  2.3643 +made since last automark. Additionally, if such point is inside string or
  2.3644 +comment, rewind start position to its beginning.
  2.3645 +
  2.3646 +nil means automark is unnecessary because there were no updates.")
  2.3647 +(make-variable-buffer-local 'lua-automark-multiline-start-pos)
  2.3648 +
  2.3649 +(defun lua--automark-update-start-pos (change-begin change-end old-len)
  2.3650 +  "Updates `lua-automark-multiline-start-pos' upon buffer modification."
  2.3651 +  (save-excursion
  2.3652 +    (goto-char change-begin)
  2.3653 +    (beginning-of-line)
  2.3654 +    (setq lua-automark-multiline-start-pos
  2.3655 +          (or (lua-comment-or-string-start) (point)))))
  2.3656 +
  2.3657 +(defun lua--automark-multiline-update-timer ()
  2.3658 +  (lua--automark-multiline-cleanup)  ;; reset previous timer if it existed
  2.3659 +  (when lua-automark-multiline-interval
  2.3660 +    (add-hook 'change-major-mode-hook 'lua--automark-multiline-cleanup nil 'local)
  2.3661 +    (add-hook 'after-change-functions 'lua--automark-update-start-pos  nil 'local)
  2.3662 +    (setq lua-automark-multiline-timer
  2.3663 +          (run-with-idle-timer lua-automark-multiline-interval 'repeat
  2.3664 +                               'lua--automark-multiline-run))))
  2.3665 +
  2.3666 +(defun lua--automark-multiline-cleanup ()
  2.3667 +  "Disable automatical multiline construct marking"
  2.3668 +  (unless (null lua-automark-multiline-timer)
  2.3669 +    (cancel-timer lua-automark-multiline-timer)
  2.3670 +    (setq lua-automark-multiline-timer nil)))
  2.3671 +
  2.3672 +(defun lua--automark-multiline-run ()
  2.3673 +  (when (<= (buffer-size) lua-automark-multiline-maxsize)
  2.3674 +    (when lua-automark-multiline-start-pos
  2.3675 +      (lua-mark-all-multiline-literals lua-automark-multiline-start-pos)
  2.3676 +      (setq lua-automark-multiline-start-pos nil))))
  2.3677 +
  2.3678 +(defun lua--customize-set-automark-multiline-interval (symbol value)
  2.3679 +  (set symbol value)
  2.3680 +  (dolist (buf (buffer-list))
  2.3681 +    (with-current-buffer buf
  2.3682 +      (when (eq major-mode 'lua-mode)
  2.3683 +        (lua--automark-multiline-update-timer)))))
  2.3684 +
  2.3685 +(defcustom lua-automark-multiline-interval 1
  2.3686 +  "If not 0, specifies idle time in seconds after which lua-mode will mark multiline literals."
  2.3687 +  :group 'lua
  2.3688 +  :type 'integer
  2.3689 +  :set 'lua--customize-set-automark-multiline-interval)
  2.3690 +
  2.3691 +(defcustom lua-automark-multiline-maxsize 100000
  2.3692 +  "Maximum buffer size for which lua-mode will mark multiline literals automatically."
  2.3693 +  :group 'lua
  2.3694 +  :type 'integer)
  2.3695 +
  2.3696 +(provide 'lua-mode)
  2.3697 +
  2.3698 +;;; lua-mode.el ends here