wok-next diff emacs-pkg-lua-mode/stuff/lua-mode.el @ rev 20814

palemoon: fatal error: sys/int_types.h
author Erkan Yilmaz <erkan@slitaz.org>
date Wed Jun 13 19:28:54 2018 +0000 (2018-06-13)
parents 755fb3544005
children
line diff
     1.1 --- a/emacs-pkg-lua-mode/stuff/lua-mode.el	Thu Feb 14 13:36:00 2013 +0100
     1.2 +++ b/emacs-pkg-lua-mode/stuff/lua-mode.el	Wed Jun 13 19:28:54 2018 +0000
     1.3 @@ -1,2144 +1,1665 @@
     1.4 -  
     1.5 +;;; lua-mode.el --- a major-mode for editing Lua scripts
     1.6  
     1.7 +;; Copyright (C) 1997, 2001, 2004, 2006, 2007, 2010, 2011 Free Software Foundation, Inc.
     1.8  
     1.9 -<!DOCTYPE html>
    1.10 -<html>
    1.11 -  <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
    1.12 -    <meta charset='utf-8'>
    1.13 -    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    1.14 -        <title>lua-mode/lua-mode.el at master · immerrr/lua-mode · GitHub</title>
    1.15 -    <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
    1.16 -    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
    1.17 -    <link rel="apple-touch-icon-precomposed" sizes="57x57" href="apple-touch-icon-114.png" />
    1.18 -    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114.png" />
    1.19 -    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-144.png" />
    1.20 -    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="apple-touch-icon-144.png" />
    1.21 -    <link rel="logo" type="image/svg" href="http://github-media-downloads.s3.amazonaws.com/github-logo.svg" />
    1.22 -    <meta name="msapplication-TileImage" content="/windows-tile.png">
    1.23 -    <meta name="msapplication-TileColor" content="#ffffff">
    1.24 +;; Author: 2011 immerrr <immerrr+lua@gmail.com>
    1.25 +;;         2010-2011 Reuben Thomas <rrt@sc3d.org>
    1.26 +;;         2006 Juergen Hoetzel <juergen@hoetzel.info>
    1.27 +;;         2004 various (support for Lua 5 and byte compilation)
    1.28 +;;         2001 Christian Vogler <cvogler@gradient.cis.upenn.edu>
    1.29 +;;         1997 Bret Mogilefsky <mogul-lua@gelatinous.com> starting from
    1.30 +;;              tcl-mode by Gregor Schmid <schmid@fb3-s7.math.tu-berlin.de>
    1.31 +;;              with tons of assistance from
    1.32 +;;              Paul Du Bois <pld-lua@gelatinous.com> and
    1.33 +;;              Aaron Smith <aaron-lua@gelatinous.com>.
    1.34 +;;
    1.35 +;; URL:         http://immerrr.github.com/lua-mode
    1.36 +;; Version:     20111107
    1.37 +;;
    1.38 +;; This file is NOT part of Emacs.
    1.39 +;;
    1.40 +;; This program is free software; you can redistribute it and/or
    1.41 +;; modify it under the terms of the GNU General Public License
    1.42 +;; as published by the Free Software Foundation; either version 2
    1.43 +;; of the License, or (at your option) any later version.
    1.44 +;;
    1.45 +;; This program is distributed in the hope that it will be useful,
    1.46 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.47 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.48 +;; GNU General Public License for more details.
    1.49 +;;
    1.50 +;; You should have received a copy of the GNU General Public License
    1.51 +;; along with this program; if not, write to the Free Software
    1.52 +;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    1.53 +;; MA 02110-1301, USA.
    1.54  
    1.55 -    
    1.56 -    
    1.57 -    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
    1.58 +;; Keywords: languages, processes, tools
    1.59  
    1.60 -    <meta content="authenticity_token" name="csrf-param" />
    1.61 -<meta content="7Opte9ezTrv4wfZYtQD35eRTvcYWwtxcMFX9BhJ0Xs4=" name="csrf-token" />
    1.62  
    1.63 -    <link href="https://a248.e.akamai.net/assets.github.com/assets/github-43b1cfcfbe53a62c7ab76e1da7f0ff83b28c9c92.css" media="screen" rel="stylesheet" type="text/css" />
    1.64 -    <link href="https://a248.e.akamai.net/assets.github.com/assets/github2-7c17a1ea38e88d72787a5a2bd336f7d8aa428037.css" media="screen" rel="stylesheet" type="text/css" />
    1.65 -    
    1.66 +;;; Commentary:
    1.67  
    1.68 +;; Thanks to d87 <github.com/d87> for an idea of highlighting lua
    1.69 +;; builtins/numbers
    1.70  
    1.71 -      <script src="https://a248.e.akamai.net/assets.github.com/assets/frameworks-5dcdaf734c8092261f37e6534c8f114696d913a9.js" type="text/javascript"></script>
    1.72 -      <script src="https://a248.e.akamai.net/assets.github.com/assets/github-47a3a09fdb39a3cc73da291f394b4c33a2695b7b.js" type="text/javascript"></script>
    1.73 -      
    1.74 +;; Thanks to Vedat Hallac <github.com/vhallac> for sharing some of
    1.75 +;; his fixes and updates to core indentation logics
    1.76  
    1.77 -        <link rel='permalink' href='/immerrr/lua-mode/blob/e6a46ee34362b5090748643d4b2bef1f849ea0a8/lua-mode.el'>
    1.78 -    <meta property="og:title" content="lua-mode"/>
    1.79 -    <meta property="og:type" content="githubog:gitrepository"/>
    1.80 -    <meta property="og:url" content="https://github.com/immerrr/lua-mode"/>
    1.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"/>
    1.82 -    <meta property="og:site_name" content="GitHub"/>
    1.83 -    <meta property="og:description" content="Emacs major mode for editing Lua. Contribute to lua-mode development by creating an account on GitHub."/>
    1.84 -    <meta property="twitter:card" content="summary"/>
    1.85 -    <meta property="twitter:site" content="@GitHub">
    1.86 -    <meta property="twitter:title" content="immerrr/lua-mode"/>
    1.87 +;; Thanks to Rafael Sanchez <rafael@cornerdimension.com> for patch
    1.88 +;; adding lua-mode to interpreter-mode-alist
    1.89  
    1.90 -    <meta name="description" content="Emacs major mode for editing Lua. Contribute to lua-mode development by creating an account on GitHub." />
    1.91 +;; Thanks to Leonardo Etcheverry <leo@kalio.net> for enabling
    1.92 +;; narrow-to-defun functionality
    1.93  
    1.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" />
    1.95 +;; Thanks to Tobias Polzin <polzin@gmx.de> for function indenting
    1.96 +;; patch: Indent "(" like "{"
    1.97  
    1.98 -  </head>
    1.99 +;; Thanks to Fabien <fleutot@gmail.com> for imenu patches.
   1.100  
   1.101 +;; Thanks to Simon Marshall <simonm@mail.esrin.esa.it> and Olivier
   1.102 +;; Andrieu <oandrieu@gmail.com> for font-lock patches.
   1.103  
   1.104 -  <body class="logged_out page-blob  vis-public env-production  ">
   1.105 -    <div id="wrapper">
   1.106 +;; Additional font-lock highlighting and indentation tweaks by
   1.107 +;; Adam D. Moss <adam@gimp.org>.
   1.108  
   1.109 -      
   1.110 +;; INSTALLATION:
   1.111  
   1.112 -      
   1.113 +;; To install, just copy this file into a directory on your load-path
   1.114 +;; (and byte-compile it). To set up Emacs to automatically edit files
   1.115 +;; ending in ".lua" or with a lua hash-bang line using lua-mode add
   1.116 +;; the following to your init file:
   1.117 +;;
   1.118 +;; (autoload 'lua-mode "lua-mode" "Lua editing mode." t)
   1.119 +;; (add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
   1.120 +;; (add-to-list 'interpreter-mode-alist '("lua" . lua-mode))
   1.121  
   1.122 -      
   1.123 +;; Usage
   1.124  
   1.125 -      
   1.126 +;; Lua-mode supports c-mode style formatting and sending of
   1.127 +;; lines/regions/files to a Lua interpreter. An interpreter (see
   1.128 +;; variable `lua-default-application') will be started if you try to
   1.129 +;; send some code and none is running. You can use the process-buffer
   1.130 +;; (named after the application you chose) as if it were an
   1.131 +;; interactive shell. See the documentation for `comint.el' for
   1.132 +;; details.
   1.133  
   1.134 +;; Lua-mode works with Hide Show minor mode (see ``hs-minor-mode``).
   1.135  
   1.136 -        <div class="header header-logged-out">
   1.137 -          <div class="container clearfix">
   1.138 +;; Key-bindings
   1.139  
   1.140 -            <a class="header-logo-wordmark" href="https://github.com/">
   1.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" />
   1.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" />
   1.143 -            </a>
   1.144 +;; To see all the keybindings for Lua mode, look at `lua-setup-keymap'
   1.145 +;; or start `lua-mode' and type `\C-h m'.
   1.146 +;; The keybindings may seem strange, since I prefer to use them with
   1.147 +;; lua-prefix-key set to nil, but since those keybindings are already used
   1.148 +;; the default for `lua-prefix-key' is `\C-c', which is the conventional
   1.149 +;; prefix for major-mode commands.
   1.150  
   1.151 -              
   1.152 -<ul class="top-nav">
   1.153 -    <li class="explore"><a href="https://github.com/explore">Explore GitHub</a></li>
   1.154 -  <li class="search"><a href="https://github.com/search">Search</a></li>
   1.155 -  <li class="features"><a href="https://github.com/features">Features</a></li>
   1.156 -    <li class="blog"><a href="https://github.com/blog">Blog</a></li>
   1.157 -</ul>
   1.158 +;; You can customise the keybindings either by setting `lua-prefix-key'
   1.159 +;; or by putting the following in your .emacs
   1.160 +;;      (define-key lua-mode-map <your-key> <function>)
   1.161 +;; for all the functions you need.
   1.162  
   1.163  
   1.164 -            <div class="header-actions">
   1.165 -                <a class="button primary" href="https://github.com/signup">Sign up for free</a>
   1.166 -              <a class="button" href="https://github.com/login?return_to=%2Fimmerrr%2Flua-mode%2Fblob%2Fmaster%2Flua-mode.el">Sign in</a>
   1.167 -            </div>
   1.168 +;;; Code:
   1.169 +(eval-when-compile
   1.170 +  (require 'cl))
   1.171  
   1.172 -          </div>
   1.173 -        </div>
   1.174 +(require 'comint)
   1.175  
   1.176 +(eval-and-compile
   1.177 +  ;; Backward compatibility for Emacsen < 24.1
   1.178 +  (defalias 'lua--prog-mode
   1.179 +    (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
   1.180  
   1.181 -      
   1.182 +  (defalias 'lua--cl-assert
   1.183 +    (if (fboundp 'cl-assert) 'cl-assert 'assert))
   1.184  
   1.185 -      
   1.186 +  (defalias 'lua--cl-labels
   1.187 +    (if (fboundp 'cl-labels) 'cl-labels 'flet))
   1.188  
   1.189 +  ;; for Emacsen < 22.1
   1.190 +  (defalias 'lua--with-no-warnings
   1.191 +    (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn))
   1.192  
   1.193 -            <div class="site hfeed" itemscope itemtype="http://schema.org/WebPage">
   1.194 -      <div class="hentry">
   1.195 -        
   1.196 -        <div class="pagehead repohead instapaper_ignore readability-menu">
   1.197 -          <div class="container">
   1.198 -            <div class="title-actions-bar">
   1.199 -              
   1.200 +  ;; provide backward compatibility for Emacs < 23.2
   1.201 +  ;; called-interactively-p receives an argument starting from Emacs 23.2
   1.202 +  ;; In Emacs 22 & Emacs 23.1 it didn't expect an argument
   1.203 +  ;; In Emacs 21 it was called interactively-p
   1.204 +  (condition-case nil
   1.205 +      (progn (called-interactively-p nil)
   1.206 +             ;; if first call succeeds, make lua-called-interactively-p an alias
   1.207 +             (defalias 'lua--called-interactively-p 'called-interactively-p))
   1.208  
   1.209 +    (wrong-number-of-arguments
   1.210 +     ;; wrong number of arguments means it's 22.1 <= Emacs < 23.2
   1.211 +     ;;
   1.212 +     ;; Newer and smarter Emacsen will warn about obsolete functions
   1.213 +     ;; and/or wrong number of arguments. Turning these warnings off,
   1.214 +     ;; since it's backward-compatibility-oriented code anyway.
   1.215 +     (lua--with-no-warnings
   1.216 +       (defun lua--called-interactively-p (kind)
   1.217 +         "Return t if containing function was called interactively.
   1.218  
   1.219 -<ul class="pagehead-actions">
   1.220 +This function provides lua-mode backward compatibility for
   1.221 +pre-23.2 Emacsen."
   1.222 +         (if (eq kind 'interactive)
   1.223 +             (interactive-p)
   1.224 +           (called-interactively-p)))))
   1.225  
   1.226 +    ;; if not, it's probably < 22.1, provide partial compatibility
   1.227 +    ;;
   1.228 +    ;; Once again, turning obsolete-function warnings off (see above).
   1.229 +    (error
   1.230 +     (lua--with-no-warnings
   1.231 +       (defun lua--called-interactively-p (&rest opts)
   1.232 +         "Return t if containing function was called interactively.
   1.233  
   1.234 +This function provides lua-mode backward compatibility for pre-22
   1.235 +Emacsen."
   1.236 +         (interactive-p)))))
   1.237  
   1.238 -    <li>
   1.239 -      <a href="/login?return_to=%2Fimmerrr%2Flua-mode"
   1.240 -        class="minibutton js-toggler-target star-button entice tooltipped upwards"
   1.241 -        title="You must be signed in to use this feature" rel="nofollow">
   1.242 -        <span class="mini-icon mini-icon-star"></span>Star
   1.243 -      </a>
   1.244 -      <a class="social-count js-social-count" href="/immerrr/lua-mode/stargazers">
   1.245 -        68
   1.246 -      </a>
   1.247 -    </li>
   1.248 -    <li>
   1.249 -      <a href="/login?return_to=%2Fimmerrr%2Flua-mode"
   1.250 -        class="minibutton js-toggler-target fork-button entice tooltipped upwards"
   1.251 -        title="You must be signed in to fork a repository" rel="nofollow">
   1.252 -        <span class="mini-icon mini-icon-fork"></span>Fork
   1.253 -      </a>
   1.254 -      <a href="/immerrr/lua-mode/network" class="social-count">
   1.255 -        19
   1.256 -      </a>
   1.257 -    </li>
   1.258 -</ul>
   1.259 +  ;; backward compatibility for Emacsen < 23.3
   1.260 +  ;; Emacs 23.3 introduced with-silent-modifications macro
   1.261 +  (if (fboundp 'with-silent-modifications)
   1.262 +      (defalias 'lua--with-silent-modifications 'with-silent-modifications)
   1.263  
   1.264 -              <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
   1.265 -                <span class="repo-label"><span>public</span></span>
   1.266 -                <span class="mega-icon mega-icon-public-repo"></span>
   1.267 -                <span class="author vcard">
   1.268 -                  <a href="/immerrr" class="url fn" itemprop="url" rel="author">
   1.269 -                  <span itemprop="title">immerrr</span>
   1.270 -                  </a></span> /
   1.271 -                <strong><a href="/immerrr/lua-mode" class="js-current-repository">lua-mode</a></strong>
   1.272 -              </h1>
   1.273 -            </div>
   1.274 +    (defmacro lua--with-silent-modifications (&rest body)
   1.275 +      "Execute BODY, pretending it does not modifies the buffer.
   1.276  
   1.277 -            
   1.278 +This is a reimplementation of macro `with-silent-modifications'
   1.279 +for Emacsen that doesn't contain one (pre-23.3)."
   1.280 +      `(let ((old-modified-p (buffer-modified-p))
   1.281 +            (inhibit-modification-hooks t)
   1.282 +            (buffer-undo-list t))
   1.283  
   1.284 -  <ul class="tabs">
   1.285 -    <li><a href="/immerrr/lua-mode" class="selected" highlight="repo_sourcerepo_downloadsrepo_commitsrepo_tagsrepo_branches">Code</a></li>
   1.286 -    <li><a href="/immerrr/lua-mode/network" highlight="repo_network">Network</a></li>
   1.287 -    <li><a href="/immerrr/lua-mode/pulls" highlight="repo_pulls">Pull Requests <span class='counter'>3</span></a></li>
   1.288 +        (unwind-protect
   1.289 +            ,@body
   1.290 +          (set-buffer-modified-p old-modified-p))))))
   1.291  
   1.292 -      <li><a href="/immerrr/lua-mode/issues" highlight="repo_issues">Issues <span class='counter'>19</span></a></li>
   1.293 +;; Local variables
   1.294 +(defgroup lua nil
   1.295 +  "Major mode for editing lua code."
   1.296 +  :prefix "lua-"
   1.297 +  :group 'languages)
   1.298  
   1.299 -      <li><a href="/immerrr/lua-mode/wiki" highlight="repo_wiki">Wiki</a></li>
   1.300 +(defcustom lua-indent-level 3
   1.301 +  "Amount by which Lua subexpressions are indented."
   1.302 +  :type 'integer
   1.303 +  :group 'lua)
   1.304  
   1.305 +(defcustom lua-comment-start "-- "
   1.306 +  "Default value of `comment-start'."
   1.307 +  :type 'string
   1.308 +  :group 'lua)
   1.309  
   1.310 -    <li><a href="/immerrr/lua-mode/graphs" highlight="repo_graphsrepo_contributors">Graphs</a></li>
   1.311 +(defcustom lua-comment-start-skip "-- "
   1.312 +  "Default value of `comment-start-skip'."
   1.313 +  :type 'string
   1.314 +  :group 'lua)
   1.315  
   1.316 +(defcustom lua-default-application "lua"
   1.317 +  "Default application to run in lua subprocess."
   1.318 +  :type 'string
   1.319 +  :group 'lua)
   1.320  
   1.321 -  </ul>
   1.322 -  
   1.323 -<div class="tabnav">
   1.324 +(defcustom lua-default-command-switches (list "-i")
   1.325 +  "Command switches for `lua-default-application'.
   1.326 +Should be a list of strings."
   1.327 +  :type '(repeat string)
   1.328 +  :group 'lua)
   1.329  
   1.330 -  <span class="tabnav-right">
   1.331 -    <ul class="tabnav-tabs">
   1.332 -          <li><a href="/immerrr/lua-mode/tags" class="tabnav-tab" highlight="repo_tags">Tags <span class="counter ">3</span></a></li>
   1.333 -    </ul>
   1.334 -    
   1.335 -  </span>
   1.336 +(defcustom lua-always-show t
   1.337 +  "*Non-nil means display lua-process-buffer after sending a command."
   1.338 +  :type 'boolean
   1.339 +  :group 'lua)
   1.340  
   1.341 -  <div class="tabnav-widget scope">
   1.342 +(defcustom lua-search-url-prefix "http://www.lua.org/manual/5.1/manual.html#pdf-"
   1.343 +  "*URL at which to search for documentation on a word"
   1.344 +  :type 'string
   1.345 +  :group 'lua)
   1.346  
   1.347 +(defvar lua-process nil
   1.348 +  "The active Lua subprocess")
   1.349  
   1.350 -    <div class="select-menu js-menu-container js-select-menu js-branch-menu">
   1.351 -      <a class="minibutton select-menu-button js-menu-target" data-hotkey="w" data-ref="master">
   1.352 -        <span class="mini-icon mini-icon-branch"></span>
   1.353 -        <i>branch:</i>
   1.354 -        <span class="js-select-button">master</span>
   1.355 -      </a>
   1.356 +(defvar lua-process-buffer nil
   1.357 +  "Buffer used for communication with Lua subprocess")
   1.358  
   1.359 -      <div class="select-menu-modal-holder js-menu-content js-navigation-container js-select-menu-pane">
   1.360 +(defun lua--customize-set-prefix-key (prefix-key-sym prefix-key-val)
   1.361 +  (lua--cl-assert (eq prefix-key-sym 'lua-prefix-key))
   1.362 +  (set prefix-key-sym (if (and prefix-key-val (> (length prefix-key-val) 0))
   1.363 +                          ;; read-kbd-macro returns a string or a vector
   1.364 +                          ;; in both cases (elt x 0) is ok
   1.365 +                          (elt (read-kbd-macro prefix-key-val) 0)))
   1.366 +  (if (fboundp 'lua-prefix-key-update-bindings)
   1.367 +      (lua-prefix-key-update-bindings))
   1.368 +  (message "prefix key set to %S"  (single-key-description (eval prefix-key-sym))))
   1.369  
   1.370 -        <div class="select-menu-modal js-select-menu-pane">
   1.371 -          <div class="select-menu-header">
   1.372 -            <span class="select-menu-title">Switch branches/tags</span>
   1.373 -            <span class="mini-icon mini-icon-remove-close js-menu-close"></span>
   1.374 -          </div> <!-- /.select-menu-header -->
   1.375 +(defcustom lua-prefix-key "\C-c"
   1.376 +  "Prefix for all lua-mode commands."
   1.377 +  :type 'string
   1.378 +  :group 'lua
   1.379 +  :set 'lua--customize-set-prefix-key
   1.380 +  :get '(lambda (sym)
   1.381 +          (let ((val (eval sym))) (if val (single-key-description (eval sym)) ""))))
   1.382  
   1.383 -          <div class="select-menu-filters">
   1.384 -            <div class="select-menu-text-filter">
   1.385 -              <input type="text" id="commitish-filter-field" class="js-select-menu-text-filter js-filterable-field js-navigation-enable" placeholder="Filter branches/tags">
   1.386 -            </div> <!-- /.select-menu-text-filter -->
   1.387 -            <div class="select-menu-tabs">
   1.388 -              <ul>
   1.389 -                <li class="select-menu-tab">
   1.390 -                  <a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a>
   1.391 -                </li>
   1.392 -                <li class="select-menu-tab">
   1.393 -                  <a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a>
   1.394 -                </li>
   1.395 -              </ul>
   1.396 -            </div><!-- /.select-menu-tabs -->
   1.397 -          </div><!-- /.select-menu-filters -->
   1.398 +(defvar lua-mode-menu (make-sparse-keymap "Lua")
   1.399 +  "Keymap for lua-mode's menu.")
   1.400  
   1.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">
   1.402 +(defvar lua-prefix-mode-map
   1.403 +  (eval-when-compile
   1.404 +    (let ((result-map (make-sparse-keymap)))
   1.405 +      (mapc (lambda (key_defn)
   1.406 +              (define-key result-map (read-kbd-macro (car key_defn)) (cdr key_defn)))
   1.407 +            '(("C-l" . lua-send-buffer)
   1.408 +              ("C-f" . lua-search-documentation)
   1.409 +              ("C-;" . lua-mark-all-multiline-literals)))
   1.410 +      result-map))
   1.411 +  "Keymap that is used to define keys accessible by `lua-prefix-key'.
   1.412  
   1.413 +If the latter is nil, the keymap translates into `lua-mode-map' verbatim.")
   1.414  
   1.415 +(defvar lua-mode-map
   1.416 +  (let ((result-map (make-sparse-keymap))
   1.417 +        prefix-key)
   1.418 +    (mapc (lambda (key_defn)
   1.419 +            (define-key result-map (read-kbd-macro (car key_defn)) (cdr key_defn)))
   1.420 +          ;; here go all the default bindings
   1.421 +          ;; backquote enables evaluating certain symbols by comma
   1.422 +          `(("}" . lua-electric-match)
   1.423 +            ("]" . lua-electric-match)
   1.424 +            (")" . lua-electric-match)))
   1.425 +    (define-key result-map [menu-bar lua-mode] (cons "Lua" lua-mode-menu))
   1.426  
   1.427 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   1.428 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   1.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>
   1.430 -              </div> <!-- /.select-menu-item -->
   1.431 +    ;; FIXME: see if the declared logic actually works
   1.432 +    ;; handle prefix-keyed bindings:
   1.433 +    ;; * if no prefix, set prefix-map as parent, i.e.
   1.434 +    ;;      if key is not defined look it up in prefix-map
   1.435 +    ;; * if prefix is set, bind the prefix-map to that key
   1.436 +    (if (boundp 'lua-prefix-key)
   1.437 +        (define-key result-map (vector lua-prefix-key) lua-prefix-mode-map)
   1.438 +      (set-keymap-parent result-map lua-prefix-mode-map))
   1.439 +    result-map)
   1.440 +  "Keymap used in lua-mode buffers.")
   1.441  
   1.442 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   1.443 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   1.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>
   1.445 -              </div> <!-- /.select-menu-item -->
   1.446 +(defvar lua-electric-flag t
   1.447 +  "If t, electric actions (like automatic reindentation) will happen when an electric
   1.448 + key like `{' is pressed")
   1.449 +(make-variable-buffer-local 'lua-electric-flag)
   1.450  
   1.451 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   1.452 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   1.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>
   1.454 -              </div> <!-- /.select-menu-item -->
   1.455 +(defcustom lua-prompt-regexp "[^\n]*\\(>[\t ]+\\)+$"
   1.456 +  "Regexp which matches the Lua program's prompt."
   1.457 +  :type  'regexp
   1.458 +  :group 'lua)
   1.459  
   1.460 -              <div class="select-menu-item js-navigation-item js-navigation-target selected">
   1.461 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   1.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>
   1.463 -              </div> <!-- /.select-menu-item -->
   1.464 +(defcustom lua-traceback-line-re
   1.465 +  "^\\(?:[\t ]*\\|.*>[\t ]+\\)\\([^\n\t ]+\\):\\([0-9]+\\):"
   1.466 +  "Regular expression that describes tracebacks and errors."
   1.467 +  :type 'regexp
   1.468 +  :group 'lua)
   1.469  
   1.470 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   1.471 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   1.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>
   1.473 -              </div> <!-- /.select-menu-item -->
   1.474 +(defcustom lua-indent-string-contents nil
   1.475 +  "If non-nil, contents of multiline string will be indented.
   1.476 +Otherwise leading amount of whitespace on each line is preserved."
   1.477 +  :group 'lua
   1.478 +  :type 'boolean)
   1.479  
   1.480 -              <div class="select-menu-no-results js-not-filterable">Nothing to show</div>
   1.481 -          </div> <!-- /.select-menu-list -->
   1.482 +(defcustom lua-jump-on-traceback t
   1.483 +  "*Jump to innermost traceback location in *lua* buffer.  When this
   1.484 +variable is non-nil and a traceback occurs when running Lua code in a
   1.485 +subprocess, jump immediately to the source code of the innermost
   1.486 +traceback location."
   1.487 +  :type 'boolean
   1.488 +  :group 'lua)
   1.489  
   1.490 +(defcustom lua-mode-hook nil
   1.491 +  "Hooks called when Lua mode fires up."
   1.492 +  :type 'hook
   1.493 +  :group 'lua)
   1.494  
   1.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">
   1.496 +(defvar lua-region-start (make-marker)
   1.497 +  "Start of special region for Lua communication.")
   1.498  
   1.499 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   1.500 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   1.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>
   1.502 +(defvar lua-region-end (make-marker)
   1.503 +  "End of special region for Lua communication.")
   1.504  
   1.505 -              </div> <!-- /.select-menu-item -->
   1.506 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   1.507 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   1.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>
   1.509 +(defvar lua-emacs-menu
   1.510 +  '(["Restart With Whole File" lua-restart-with-whole-file t]
   1.511 +    ["Kill Process" lua-kill-process t]
   1.512 +    ["Hide Process Buffer" lua-hide-process-buffer t]
   1.513 +    ["Show Process Buffer" lua-show-process-buffer t]
   1.514 +    ["Beginning Of Proc" lua-beginning-of-proc t]
   1.515 +    ["End Of Proc" lua-end-of-proc t]
   1.516 +    ["Set Lua-Region Start" lua-set-lua-region-start t]
   1.517 +    ["Set Lua-Region End" lua-set-lua-region-end t]
   1.518 +    ["Send Lua-Region" lua-send-lua-region t]
   1.519 +    ["Send Current Line" lua-send-current-line t]
   1.520 +    ["Send Region" lua-send-region t]
   1.521 +    ["Send Proc" lua-send-proc t]
   1.522 +    ["Send Buffer" lua-send-buffer t]
   1.523 +    ["Search Documentation" lua-search-documentation t])
   1.524 +  "Emacs menu for Lua mode.")
   1.525  
   1.526 -              </div> <!-- /.select-menu-item -->
   1.527 -              <div class="select-menu-item js-navigation-item js-navigation-target ">
   1.528 -                <span class="select-menu-checkmark mini-icon mini-icon-confirm"></span>
   1.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>
   1.530 +;; the whole defconst is inside eval-when-compile, because it's later referenced
   1.531 +;; inside another eval-and-compile block
   1.532 +(eval-and-compile
   1.533 +  (defconst
   1.534 +    lua--builtins
   1.535 +    (let*
   1.536 +        ((modules
   1.537 +          '("_G" "_VERSION" "assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable"
   1.538 +            "ipairs" "load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print" 
   1.539 +            "rawequal" "rawget" "rawlen" "rawset" "require" "select" "setfenv" "setmetatable"
   1.540 +            "tonumber" "tostring" "type" "unpack" "xpcall"
   1.541 +            ("bit32" . ("arshift" "band" "bnot" "bor" "btest" "bxor" "extract" "lrotate" "lshift"
   1.542 +                        "replace" "rrotate" "rshift"))
   1.543 +            ("coroutine" . ("create" "resume" "running" "status" "wrap" "yield"))
   1.544 +            ("debug" . ("debug" "getfenv" "gethook" "getinfo" "getlocal" "getmetatable" 
   1.545 +                        "getregistry" "getupvalue" "getuservalue" "setfenv" "sethook" "setlocal" 
   1.546 +                        "setmetatable" "setupvalue" "setuservalue" "traceback" "upvalueid"
   1.547 +                        "upvaluejoin"))
   1.548 +            ("io" . ("close" "flush" "input" "lines" "open" "output" "popen" "read" "stderr" 
   1.549 +                     "stdin" "stdout" "tmpfile" "type" "write"))
   1.550 +            ("math" . ("abs" "acos" "asin" "atan" "atan2" "ceil" "cos" "cosh" "deg" "exp" "floor"
   1.551 +                       "fmod" "frexp" "huge" "ldexp" "log" "log10" "max" "min" "modf" "pi" "pow"
   1.552 +                       "rad" "random" "randomseed" "sin" "sinh" "sqrt" "tan" "tanh"))
   1.553 +            ("os" . ("clock" "date" "difftime" "execute" "exit" "getenv" "remove" "rename"
   1.554 +                     "setlocale" "time" "tmpname"))
   1.555 +            ("package" . ("config" "cpath" "loaded" "loaders" "loadlib" "path" "preload"
   1.556 +                          "searchers" "searchpath" "seeall"))
   1.557 +            ("string" . ("byte" "char" "dump" "find" "format" "gmatch" "gsub" "len" "lower"
   1.558 +                         "match" "rep" "reverse" "sub" "upper"))
   1.559 +            ("table" . ("concat" "insert" "maxn" "pack" "remove" "sort" "unpack")))))
   1.560  
   1.561 -              </div> <!-- /.select-menu-item -->
   1.562 +      ;; This code uses \\< and \\> to delimit builtin symbols instead of
   1.563 +      ;; \\_< and \\_>, because -- a necessity -- '.' syntax class is hacked
   1.564 +      ;; to 'symbol' and \\_> won't detect a symbol boundary in 'foo.bar' and
   1.565 +      ;; -- sufficiency -- conveniently, underscore '_' is hacked to count as
   1.566 +      ;; word constituent, but only for font-locking. Neither of these hacks
   1.567 +      ;; makes sense to me, I'm going to wipe them out as soon as I'm sure
   1.568 +      ;; that indentation won't get hurt. --immerrr
   1.569 +      ;;
   1.570 +      (lua--cl-labels
   1.571 +          ((module-name-re (x)
   1.572 +                           (concat "\\(?1:\\<"
   1.573 +                                   (if (listp x) (car x) x)
   1.574 +                                   "\\>\\)"))
   1.575 +           (module-members-re (x) (if (listp x)
   1.576 +                                      (concat "\\(?:[ \t]*\\.[ \t]*"
   1.577 +                                              "\\<\\(?2:"
   1.578 +                                              (regexp-opt (cdr x))
   1.579 +                                              "\\)\\>\\)?")
   1.580 +                                    "")))
   1.581  
   1.582 -            <div class="select-menu-no-results js-not-filterable">Nothing to show</div>
   1.583 +        (concat
   1.584 +         ;; common prefix - beginning-of-line or neither of [ '.', ':' ] to
   1.585 +         ;; exclude "foo.string.rep"
   1.586 +         "\\(?:\\`\\|[^:. \n\t]\\)"
   1.587 +         ;; optional whitespace
   1.588 +         "[ \n\t]*"
   1.589 +         "\\(?:"
   1.590 +         ;; any of modules/functions
   1.591 +         (mapconcat (lambda (x) (concat (module-name-re x)
   1.592 +                                        (module-members-re x)))
   1.593 +                    modules
   1.594 +                    "\\|")
   1.595 +         "\\)"))))
   1.596  
   1.597 -          </div> <!-- /.select-menu-list -->
   1.598 +  "A regexp that matches lua builtin functions & variables.
   1.599  
   1.600 -        </div> <!-- /.select-menu-modal -->
   1.601 -      </div> <!-- /.select-menu-modal-holder -->
   1.602 -    </div> <!-- /.select-menu -->
   1.603 +This is a compilation of 5.1 and 5.2 builtins taken from the
   1.604 +index of respective Lua reference manuals.")
   1.605  
   1.606 -  </div> <!-- /.scope -->
   1.607 +(defvar lua-font-lock-keywords
   1.608 +  (eval-when-compile
   1.609 +    (list
   1.610 +     ;; highlight the hash-bang line "#!/foo/bar/lua" as comment
   1.611 +     '("^#!.*$" . font-lock-comment-face)
   1.612 +     ;; Handle variable names
   1.613 +     ;;  local blalba =
   1.614 +     ;;        ^^^^^^
   1.615 +     '("\\(local[ \t]+\\(\\sw+\\)[ \t]*=\\)"
   1.616 +       (2 font-lock-variable-name-face))
   1.617  
   1.618 -  <ul class="tabnav-tabs">
   1.619 -    <li><a href="/immerrr/lua-mode" class="selected tabnav-tab" highlight="repo_source">Files</a></li>
   1.620 -    <li><a href="/immerrr/lua-mode/commits/master" class="tabnav-tab" highlight="repo_commits">Commits</a></li>
   1.621 -    <li><a href="/immerrr/lua-mode/branches" class="tabnav-tab" highlight="repo_branches" rel="nofollow">Branches <span class="counter ">5</span></a></li>
   1.622 -  </ul>
   1.623 +     ;; Function name declarations.
   1.624 +     '("^[ \t]*\\_<\\(\\(local[ \t]+\\)?function\\)\\_>[ \t]+\\(\\(\\sw:\\|\\sw\\.\\|\\sw_\\|\\sw\\)+\\)"
   1.625 +       (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t))
   1.626  
   1.627 -</div>
   1.628 +     ;; Highlight lua builtin functions and variables
   1.629 +     `(,lua--builtins
   1.630 +           (1 font-lock-builtin-face) (2 font-lock-builtin-face nil noerror))
   1.631  
   1.632 -  
   1.633 -  
   1.634 -  
   1.635 +     ;; Handle function names in assignments
   1.636 +     '("\\(\\(\\sw:\\|\\sw\\.\\|\\sw_\\|\\sw\\)+\\)[ \t]*=[ \t]*\\(function\\)\\_>"
   1.637 +       (1 font-lock-function-name-face nil t) (3 font-lock-keyword-face))
   1.638  
   1.639 +     ;; octal numbers
   1.640 +     '("\\_<0x[[:xdigit:]]+\\_>" . font-lock-constant-face)
   1.641  
   1.642 -            
   1.643 -          </div>
   1.644 -        </div><!-- /.repohead -->
   1.645 +     ;; regular numbers
   1.646 +     ;;
   1.647 +     ;; This regexp relies on '.' being symbol constituent. Whenever this
   1.648 +     ;; changes, the regexp needs revisiting --immerrr
   1.649 +     `(,(concat "\\_<\\(?1:"
   1.650 +                ;; make a digit on either side of dot mandatory
   1.651 +                "\\(?:[0-9]+\\.?[0-9]*\\|[0-9]*\\.?[0-9]+\\)"
   1.652 +                "\\(?:[eE][+-]?[0-9]+\\)?"
   1.653 +                "\\)\\_>")
   1.654 +       . font-lock-constant-face)
   1.655  
   1.656 -        <div id="js-repo-pjax-container" class="container context-loader-container" data-pjax-container>
   1.657 -          
   1.658 +     ;; Keywords.
   1.659 +     (concat "\\_<"
   1.660 +             (regexp-opt '("and" "break" "do" "else" "elseif" "end" "false"
   1.661 +                           "for" "function" "if" "in" "local" "nil" "not"
   1.662 +                           "or" "repeat" "return" "then" "true" "until"
   1.663 +                           "while") t)
   1.664 +             "\\_>")
   1.665  
   1.666 +     "Default expressions to highlight in Lua mode.")))
   1.667  
   1.668 -<!-- blob contrib key: blob_contributors:v21:5c00d163385428f2cbceab8569302ca7 -->
   1.669 -<!-- blob contrib frag key: views10/v8/blob_contributors:v21:5c00d163385428f2cbceab8569302ca7 -->
   1.670 +(defvar lua-imenu-generic-expression
   1.671 +  '((nil "^[ \t]*\\(?:local[ \t]+\\)?function[ \t]+\\(\\(\\sw:\\|\\sw_\\|\\sw\\.\\|\\sw\\)+\\)" 1))
   1.672 +  "Imenu generic expression for lua-mode.  See `imenu-generic-expression'.")
   1.673  
   1.674 +(defvar lua-sexp-alist '(("then" . "end")
   1.675 +                         ("function" . "end")
   1.676 +                         ("do" . "end")))
   1.677  
   1.678 -<div id="slider">
   1.679 -    <div class="frame-meta">
   1.680 +(defvar lua-mode-abbrev-table nil
   1.681 +  "Abbreviation table used in lua-mode buffers.")
   1.682  
   1.683 -      <p title="This is a placeholder element" class="js-history-link-replace hidden"></p>
   1.684 +(define-abbrev-table 'lua-mode-abbrev-table
   1.685 +  ;; Emacs 23 introduced :system property that prevents abbrev
   1.686 +  ;; entries from being written to file specified by abbrev-file-name
   1.687 +  ;;
   1.688 +  ;; Emacs 22 and earlier had this functionality implemented
   1.689 +  ;; by simple nil/non-nil flag as positional parameter
   1.690 +  (if (>= emacs-major-version 23)
   1.691 +      '(("end"    "end"    lua-indent-line :system t)
   1.692 +        ("else"   "else"   lua-indent-line :system t)
   1.693 +        ("elseif" "elseif" lua-indent-line :system t))
   1.694 +    '(("end"    "end"      lua-indent-line nil 'system)
   1.695 +      ("else"   "else"     lua-indent-line nil 'system)
   1.696 +      ("elseif" "elseif"   lua-indent-line nil 'system))))
   1.697  
   1.698 -        <div class="breadcrumb">
   1.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>
   1.700 -        </div>
   1.701 +(eval-and-compile
   1.702 +  (defalias 'lua-make-temp-file
   1.703 +    (if (fboundp 'make-temp-file)
   1.704 +        'make-temp-file
   1.705 +      (lambda (prefix &optional dir-flag) ;; Simple implementation
   1.706 +        (expand-file-name
   1.707 +         (make-temp-name prefix)
   1.708 +         (if (fboundp 'temp-directory)
   1.709 +             (temp-directory)
   1.710 +           temporary-file-directory))))))
   1.711  
   1.712 -      <a href="/immerrr/lua-mode/find/master" class="js-slide-to" data-hotkey="t" style="display:none">Show File Finder</a>
   1.713 +(defvar lua-mode-syntax-table
   1.714 +  (with-syntax-table (copy-syntax-table)
   1.715 +    (modify-syntax-entry ?+ ".")
   1.716 +    (modify-syntax-entry ?- ". 12")
   1.717 +    (modify-syntax-entry ?* ".")
   1.718 +    (modify-syntax-entry ?/ ".")
   1.719 +    (modify-syntax-entry ?^ ".")
   1.720 +    ;; This might be better as punctuation, as for C, but this way you
   1.721 +    ;; can treat table index as symbol.
   1.722 +    (modify-syntax-entry ?. "_")        ; e.g. `io.string'
   1.723 +    (modify-syntax-entry ?> ".")
   1.724 +    (modify-syntax-entry ?< ".")
   1.725 +    (modify-syntax-entry ?= ".")
   1.726 +    (modify-syntax-entry ?~ ".")
   1.727 +    (modify-syntax-entry ?\n ">")
   1.728 +    (modify-syntax-entry ?\' "\"")
   1.729 +    (modify-syntax-entry ?\" "\"")
   1.730 +    (syntax-table))
   1.731 +  "Syntax table used while in `lua-mode'.")
   1.732  
   1.733 +;;;###autoload
   1.734 +(define-derived-mode lua-mode lua--prog-mode "Lua"
   1.735 +  "Major mode for editing Lua code."
   1.736 +  :abbrev-table lua-mode-abbrev-table
   1.737 +  :syntax-table lua-mode-syntax-table
   1.738 +  :group 'lua
   1.739 +  (let ((switches nil)
   1.740 +        s)
   1.741 +    (setq comint-prompt-regexp lua-prompt-regexp)
   1.742 +    (make-local-variable 'lua-default-command-switches)
   1.743 +    (set (make-local-variable 'beginning-of-defun-function)
   1.744 +         'lua-beginning-of-proc)
   1.745 +    (set (make-local-variable 'end-of-defun-function) 'lua-end-of-proc)
   1.746 +    (set (make-local-variable 'indent-line-function) 'lua-indent-line)
   1.747 +    (set (make-local-variable 'comment-start) lua-comment-start)
   1.748 +    (set (make-local-variable 'comment-start-skip) lua-comment-start-skip)
   1.749 +    (set (make-local-variable 'font-lock-defaults)
   1.750 +         '(lua-font-lock-keywords
   1.751 +           nil nil ((?_ . "w"))))
   1.752 +    (set (make-local-variable 'imenu-generic-expression)
   1.753 +         lua-imenu-generic-expression)
   1.754 +    (make-local-variable 'lua-default-eval)
   1.755 +    ;; setup menu bar entry (XEmacs style)
   1.756 +    (if (and (featurep 'menubar)
   1.757 +             (boundp 'current-menubar)
   1.758 +             (fboundp 'set-buffer-menubar)
   1.759 +             (fboundp 'add-menu)
   1.760 +             (not (assoc "Lua" current-menubar)))
   1.761 +        (progn
   1.762 +          (set-buffer-menubar (copy-sequence current-menubar))
   1.763 +          (add-menu nil "Lua" lua-emacs-menu)))
   1.764 +    ;; Append Lua menu to popup menu for Emacs.
   1.765 +    (if (boundp 'mode-popup-menu)
   1.766 +        (setq mode-popup-menu
   1.767 +              (cons (concat mode-name " Mode Commands") lua-emacs-menu)))
   1.768  
   1.769 -        <div class="commit commit-loader file-history-tease js-deferred-content" data-url="/immerrr/lua-mode/contributors/master/lua-mode.el">
   1.770 -          Fetching contributors…
   1.771 +    ;; hideshow setup
   1.772 +    (unless (assq 'lua-mode hs-special-modes-alist)
   1.773 +      (add-to-list 'hs-special-modes-alist
   1.774 +                   `(lua-mode
   1.775 +                     ,(regexp-opt (mapcar 'car lua-sexp-alist) 'words) ;start
   1.776 +                     ,(regexp-opt (mapcar 'cdr lua-sexp-alist) 'words) ;end
   1.777 +                     nil lua-forward-sexp)))
   1.778  
   1.779 -          <div class="participation">
   1.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>
   1.781 -            <p class="loader-error">Cannot retrieve contributors at this time</p>
   1.782 -          </div>
   1.783 -        </div>
   1.784 +    (set (make-local-variable 'parse-sexp-lookup-properties) t)
   1.785 +    (lua-mark-all-multiline-literals)
   1.786 +    (lua--automark-multiline-update-timer)))
   1.787  
   1.788 -    </div><!-- ./.frame-meta -->
   1.789 +;;;###autoload
   1.790 +(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
   1.791  
   1.792 -    <div class="frames">
   1.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">
   1.794 +;;;###autoload
   1.795 +(add-to-list 'interpreter-mode-alist '("lua" . lua-mode))
   1.796  
   1.797 -        <div id="files" class="bubble">
   1.798 -          <div class="file">
   1.799 -            <div class="meta">
   1.800 -              <div class="info">
   1.801 -                <span class="icon"><b class="mini-icon mini-icon-text-file"></b></span>
   1.802 -                <span class="mode" title="File Mode">file</span>
   1.803 -                  <span>1666 lines (1458 sloc)</span>
   1.804 -                <span>68.277 kb</span>
   1.805 -              </div>
   1.806 -              <div class="actions">
   1.807 -                <div class="button-group">
   1.808 -                      <a class="minibutton js-entice" href=""
   1.809 -                         data-entice="You must be signed in and on a branch to make or propose changes">Edit</a>
   1.810 -                  <a href="/immerrr/lua-mode/raw/master/lua-mode.el" class="button minibutton " id="raw-url">Raw</a>
   1.811 -                    <a href="/immerrr/lua-mode/blame/master/lua-mode.el" class="button minibutton ">Blame</a>
   1.812 -                  <a href="/immerrr/lua-mode/commits/master/lua-mode.el" class="button minibutton " rel="nofollow">History</a>
   1.813 -                </div><!-- /.button-group -->
   1.814 -              </div><!-- /.actions -->
   1.815 +(defun lua-electric-match (arg)
   1.816 +  "Insert character and adjust indentation."
   1.817 +  (interactive "P")
   1.818 +  (insert-char last-command-event (prefix-numeric-value arg))
   1.819 +  (if lua-electric-flag
   1.820 +      (lua-indent-line))
   1.821 +  (blink-matching-open))
   1.822  
   1.823 -            </div>
   1.824 -                <div class="data type-emacs-lisp js-blob-data">
   1.825 -      <table cellpadding="0" cellspacing="0" class="lines">
   1.826 -        <tr>
   1.827 -          <td>
   1.828 -            <pre class="line_numbers"><span id="L1" rel="#L1">1</span>
   1.829 -<span id="L2" rel="#L2">2</span>
   1.830 -<span id="L3" rel="#L3">3</span>
   1.831 -<span id="L4" rel="#L4">4</span>
   1.832 -<span id="L5" rel="#L5">5</span>
   1.833 -<span id="L6" rel="#L6">6</span>
   1.834 -<span id="L7" rel="#L7">7</span>
   1.835 -<span id="L8" rel="#L8">8</span>
   1.836 -<span id="L9" rel="#L9">9</span>
   1.837 -<span id="L10" rel="#L10">10</span>
   1.838 -<span id="L11" rel="#L11">11</span>
   1.839 -<span id="L12" rel="#L12">12</span>
   1.840 -<span id="L13" rel="#L13">13</span>
   1.841 -<span id="L14" rel="#L14">14</span>
   1.842 -<span id="L15" rel="#L15">15</span>
   1.843 -<span id="L16" rel="#L16">16</span>
   1.844 -<span id="L17" rel="#L17">17</span>
   1.845 -<span id="L18" rel="#L18">18</span>
   1.846 -<span id="L19" rel="#L19">19</span>
   1.847 -<span id="L20" rel="#L20">20</span>
   1.848 -<span id="L21" rel="#L21">21</span>
   1.849 -<span id="L22" rel="#L22">22</span>
   1.850 -<span id="L23" rel="#L23">23</span>
   1.851 -<span id="L24" rel="#L24">24</span>
   1.852 -<span id="L25" rel="#L25">25</span>
   1.853 -<span id="L26" rel="#L26">26</span>
   1.854 -<span id="L27" rel="#L27">27</span>
   1.855 -<span id="L28" rel="#L28">28</span>
   1.856 -<span id="L29" rel="#L29">29</span>
   1.857 -<span id="L30" rel="#L30">30</span>
   1.858 -<span id="L31" rel="#L31">31</span>
   1.859 -<span id="L32" rel="#L32">32</span>
   1.860 -<span id="L33" rel="#L33">33</span>
   1.861 -<span id="L34" rel="#L34">34</span>
   1.862 -<span id="L35" rel="#L35">35</span>
   1.863 -<span id="L36" rel="#L36">36</span>
   1.864 -<span id="L37" rel="#L37">37</span>
   1.865 -<span id="L38" rel="#L38">38</span>
   1.866 -<span id="L39" rel="#L39">39</span>
   1.867 -<span id="L40" rel="#L40">40</span>
   1.868 -<span id="L41" rel="#L41">41</span>
   1.869 -<span id="L42" rel="#L42">42</span>
   1.870 -<span id="L43" rel="#L43">43</span>
   1.871 -<span id="L44" rel="#L44">44</span>
   1.872 -<span id="L45" rel="#L45">45</span>
   1.873 -<span id="L46" rel="#L46">46</span>
   1.874 -<span id="L47" rel="#L47">47</span>
   1.875 -<span id="L48" rel="#L48">48</span>
   1.876 -<span id="L49" rel="#L49">49</span>
   1.877 -<span id="L50" rel="#L50">50</span>
   1.878 -<span id="L51" rel="#L51">51</span>
   1.879 -<span id="L52" rel="#L52">52</span>
   1.880 -<span id="L53" rel="#L53">53</span>
   1.881 -<span id="L54" rel="#L54">54</span>
   1.882 -<span id="L55" rel="#L55">55</span>
   1.883 -<span id="L56" rel="#L56">56</span>
   1.884 -<span id="L57" rel="#L57">57</span>
   1.885 -<span id="L58" rel="#L58">58</span>
   1.886 -<span id="L59" rel="#L59">59</span>
   1.887 -<span id="L60" rel="#L60">60</span>
   1.888 -<span id="L61" rel="#L61">61</span>
   1.889 -<span id="L62" rel="#L62">62</span>
   1.890 -<span id="L63" rel="#L63">63</span>
   1.891 -<span id="L64" rel="#L64">64</span>
   1.892 -<span id="L65" rel="#L65">65</span>
   1.893 -<span id="L66" rel="#L66">66</span>
   1.894 -<span id="L67" rel="#L67">67</span>
   1.895 -<span id="L68" rel="#L68">68</span>
   1.896 -<span id="L69" rel="#L69">69</span>
   1.897 -<span id="L70" rel="#L70">70</span>
   1.898 -<span id="L71" rel="#L71">71</span>
   1.899 -<span id="L72" rel="#L72">72</span>
   1.900 -<span id="L73" rel="#L73">73</span>
   1.901 -<span id="L74" rel="#L74">74</span>
   1.902 -<span id="L75" rel="#L75">75</span>
   1.903 -<span id="L76" rel="#L76">76</span>
   1.904 -<span id="L77" rel="#L77">77</span>
   1.905 -<span id="L78" rel="#L78">78</span>
   1.906 -<span id="L79" rel="#L79">79</span>
   1.907 -<span id="L80" rel="#L80">80</span>
   1.908 -<span id="L81" rel="#L81">81</span>
   1.909 -<span id="L82" rel="#L82">82</span>
   1.910 -<span id="L83" rel="#L83">83</span>
   1.911 -<span id="L84" rel="#L84">84</span>
   1.912 -<span id="L85" rel="#L85">85</span>
   1.913 -<span id="L86" rel="#L86">86</span>
   1.914 -<span id="L87" rel="#L87">87</span>
   1.915 -<span id="L88" rel="#L88">88</span>
   1.916 -<span id="L89" rel="#L89">89</span>
   1.917 -<span id="L90" rel="#L90">90</span>
   1.918 -<span id="L91" rel="#L91">91</span>
   1.919 -<span id="L92" rel="#L92">92</span>
   1.920 -<span id="L93" rel="#L93">93</span>
   1.921 -<span id="L94" rel="#L94">94</span>
   1.922 -<span id="L95" rel="#L95">95</span>
   1.923 -<span id="L96" rel="#L96">96</span>
   1.924 -<span id="L97" rel="#L97">97</span>
   1.925 -<span id="L98" rel="#L98">98</span>
   1.926 -<span id="L99" rel="#L99">99</span>
   1.927 -<span id="L100" rel="#L100">100</span>
   1.928 -<span id="L101" rel="#L101">101</span>
   1.929 -<span id="L102" rel="#L102">102</span>
   1.930 -<span id="L103" rel="#L103">103</span>
   1.931 -<span id="L104" rel="#L104">104</span>
   1.932 -<span id="L105" rel="#L105">105</span>
   1.933 -<span id="L106" rel="#L106">106</span>
   1.934 -<span id="L107" rel="#L107">107</span>
   1.935 -<span id="L108" rel="#L108">108</span>
   1.936 -<span id="L109" rel="#L109">109</span>
   1.937 -<span id="L110" rel="#L110">110</span>
   1.938 -<span id="L111" rel="#L111">111</span>
   1.939 -<span id="L112" rel="#L112">112</span>
   1.940 -<span id="L113" rel="#L113">113</span>
   1.941 -<span id="L114" rel="#L114">114</span>
   1.942 -<span id="L115" rel="#L115">115</span>
   1.943 -<span id="L116" rel="#L116">116</span>
   1.944 -<span id="L117" rel="#L117">117</span>
   1.945 -<span id="L118" rel="#L118">118</span>
   1.946 -<span id="L119" rel="#L119">119</span>
   1.947 -<span id="L120" rel="#L120">120</span>
   1.948 -<span id="L121" rel="#L121">121</span>
   1.949 -<span id="L122" rel="#L122">122</span>
   1.950 -<span id="L123" rel="#L123">123</span>
   1.951 -<span id="L124" rel="#L124">124</span>
   1.952 -<span id="L125" rel="#L125">125</span>
   1.953 -<span id="L126" rel="#L126">126</span>
   1.954 -<span id="L127" rel="#L127">127</span>
   1.955 -<span id="L128" rel="#L128">128</span>
   1.956 -<span id="L129" rel="#L129">129</span>
   1.957 -<span id="L130" rel="#L130">130</span>
   1.958 -<span id="L131" rel="#L131">131</span>
   1.959 -<span id="L132" rel="#L132">132</span>
   1.960 -<span id="L133" rel="#L133">133</span>
   1.961 -<span id="L134" rel="#L134">134</span>
   1.962 -<span id="L135" rel="#L135">135</span>
   1.963 -<span id="L136" rel="#L136">136</span>
   1.964 -<span id="L137" rel="#L137">137</span>
   1.965 -<span id="L138" rel="#L138">138</span>
   1.966 -<span id="L139" rel="#L139">139</span>
   1.967 -<span id="L140" rel="#L140">140</span>
   1.968 -<span id="L141" rel="#L141">141</span>
   1.969 -<span id="L142" rel="#L142">142</span>
   1.970 -<span id="L143" rel="#L143">143</span>
   1.971 -<span id="L144" rel="#L144">144</span>
   1.972 -<span id="L145" rel="#L145">145</span>
   1.973 -<span id="L146" rel="#L146">146</span>
   1.974 -<span id="L147" rel="#L147">147</span>
   1.975 -<span id="L148" rel="#L148">148</span>
   1.976 -<span id="L149" rel="#L149">149</span>
   1.977 -<span id="L150" rel="#L150">150</span>
   1.978 -<span id="L151" rel="#L151">151</span>
   1.979 -<span id="L152" rel="#L152">152</span>
   1.980 -<span id="L153" rel="#L153">153</span>
   1.981 -<span id="L154" rel="#L154">154</span>
   1.982 -<span id="L155" rel="#L155">155</span>
   1.983 -<span id="L156" rel="#L156">156</span>
   1.984 -<span id="L157" rel="#L157">157</span>
   1.985 -<span id="L158" rel="#L158">158</span>
   1.986 -<span id="L159" rel="#L159">159</span>
   1.987 -<span id="L160" rel="#L160">160</span>
   1.988 -<span id="L161" rel="#L161">161</span>
   1.989 -<span id="L162" rel="#L162">162</span>
   1.990 -<span id="L163" rel="#L163">163</span>
   1.991 -<span id="L164" rel="#L164">164</span>
   1.992 -<span id="L165" rel="#L165">165</span>
   1.993 -<span id="L166" rel="#L166">166</span>
   1.994 -<span id="L167" rel="#L167">167</span>
   1.995 -<span id="L168" rel="#L168">168</span>
   1.996 -<span id="L169" rel="#L169">169</span>
   1.997 -<span id="L170" rel="#L170">170</span>
   1.998 -<span id="L171" rel="#L171">171</span>
   1.999 -<span id="L172" rel="#L172">172</span>
  1.1000 -<span id="L173" rel="#L173">173</span>
  1.1001 -<span id="L174" rel="#L174">174</span>
  1.1002 -<span id="L175" rel="#L175">175</span>
  1.1003 -<span id="L176" rel="#L176">176</span>
  1.1004 -<span id="L177" rel="#L177">177</span>
  1.1005 -<span id="L178" rel="#L178">178</span>
  1.1006 -<span id="L179" rel="#L179">179</span>
  1.1007 -<span id="L180" rel="#L180">180</span>
  1.1008 -<span id="L181" rel="#L181">181</span>
  1.1009 -<span id="L182" rel="#L182">182</span>
  1.1010 -<span id="L183" rel="#L183">183</span>
  1.1011 -<span id="L184" rel="#L184">184</span>
  1.1012 -<span id="L185" rel="#L185">185</span>
  1.1013 -<span id="L186" rel="#L186">186</span>
  1.1014 -<span id="L187" rel="#L187">187</span>
  1.1015 -<span id="L188" rel="#L188">188</span>
  1.1016 -<span id="L189" rel="#L189">189</span>
  1.1017 -<span id="L190" rel="#L190">190</span>
  1.1018 -<span id="L191" rel="#L191">191</span>
  1.1019 -<span id="L192" rel="#L192">192</span>
  1.1020 -<span id="L193" rel="#L193">193</span>
  1.1021 -<span id="L194" rel="#L194">194</span>
  1.1022 -<span id="L195" rel="#L195">195</span>
  1.1023 -<span id="L196" rel="#L196">196</span>
  1.1024 -<span id="L197" rel="#L197">197</span>
  1.1025 -<span id="L198" rel="#L198">198</span>
  1.1026 -<span id="L199" rel="#L199">199</span>
  1.1027 -<span id="L200" rel="#L200">200</span>
  1.1028 -<span id="L201" rel="#L201">201</span>
  1.1029 -<span id="L202" rel="#L202">202</span>
  1.1030 -<span id="L203" rel="#L203">203</span>
  1.1031 -<span id="L204" rel="#L204">204</span>
  1.1032 -<span id="L205" rel="#L205">205</span>
  1.1033 -<span id="L206" rel="#L206">206</span>
  1.1034 -<span id="L207" rel="#L207">207</span>
  1.1035 -<span id="L208" rel="#L208">208</span>
  1.1036 -<span id="L209" rel="#L209">209</span>
  1.1037 -<span id="L210" rel="#L210">210</span>
  1.1038 -<span id="L211" rel="#L211">211</span>
  1.1039 -<span id="L212" rel="#L212">212</span>
  1.1040 -<span id="L213" rel="#L213">213</span>
  1.1041 -<span id="L214" rel="#L214">214</span>
  1.1042 -<span id="L215" rel="#L215">215</span>
  1.1043 -<span id="L216" rel="#L216">216</span>
  1.1044 -<span id="L217" rel="#L217">217</span>
  1.1045 -<span id="L218" rel="#L218">218</span>
  1.1046 -<span id="L219" rel="#L219">219</span>
  1.1047 -<span id="L220" rel="#L220">220</span>
  1.1048 -<span id="L221" rel="#L221">221</span>
  1.1049 -<span id="L222" rel="#L222">222</span>
  1.1050 -<span id="L223" rel="#L223">223</span>
  1.1051 -<span id="L224" rel="#L224">224</span>
  1.1052 -<span id="L225" rel="#L225">225</span>
  1.1053 -<span id="L226" rel="#L226">226</span>
  1.1054 -<span id="L227" rel="#L227">227</span>
  1.1055 -<span id="L228" rel="#L228">228</span>
  1.1056 -<span id="L229" rel="#L229">229</span>
  1.1057 -<span id="L230" rel="#L230">230</span>
  1.1058 -<span id="L231" rel="#L231">231</span>
  1.1059 -<span id="L232" rel="#L232">232</span>
  1.1060 -<span id="L233" rel="#L233">233</span>
  1.1061 -<span id="L234" rel="#L234">234</span>
  1.1062 -<span id="L235" rel="#L235">235</span>
  1.1063 -<span id="L236" rel="#L236">236</span>
  1.1064 -<span id="L237" rel="#L237">237</span>
  1.1065 -<span id="L238" rel="#L238">238</span>
  1.1066 -<span id="L239" rel="#L239">239</span>
  1.1067 -<span id="L240" rel="#L240">240</span>
  1.1068 -<span id="L241" rel="#L241">241</span>
  1.1069 -<span id="L242" rel="#L242">242</span>
  1.1070 -<span id="L243" rel="#L243">243</span>
  1.1071 -<span id="L244" rel="#L244">244</span>
  1.1072 -<span id="L245" rel="#L245">245</span>
  1.1073 -<span id="L246" rel="#L246">246</span>
  1.1074 -<span id="L247" rel="#L247">247</span>
  1.1075 -<span id="L248" rel="#L248">248</span>
  1.1076 -<span id="L249" rel="#L249">249</span>
  1.1077 -<span id="L250" rel="#L250">250</span>
  1.1078 -<span id="L251" rel="#L251">251</span>
  1.1079 -<span id="L252" rel="#L252">252</span>
  1.1080 -<span id="L253" rel="#L253">253</span>
  1.1081 -<span id="L254" rel="#L254">254</span>
  1.1082 -<span id="L255" rel="#L255">255</span>
  1.1083 -<span id="L256" rel="#L256">256</span>
  1.1084 -<span id="L257" rel="#L257">257</span>
  1.1085 -<span id="L258" rel="#L258">258</span>
  1.1086 -<span id="L259" rel="#L259">259</span>
  1.1087 -<span id="L260" rel="#L260">260</span>
  1.1088 -<span id="L261" rel="#L261">261</span>
  1.1089 -<span id="L262" rel="#L262">262</span>
  1.1090 -<span id="L263" rel="#L263">263</span>
  1.1091 -<span id="L264" rel="#L264">264</span>
  1.1092 -<span id="L265" rel="#L265">265</span>
  1.1093 -<span id="L266" rel="#L266">266</span>
  1.1094 -<span id="L267" rel="#L267">267</span>
  1.1095 -<span id="L268" rel="#L268">268</span>
  1.1096 -<span id="L269" rel="#L269">269</span>
  1.1097 -<span id="L270" rel="#L270">270</span>
  1.1098 -<span id="L271" rel="#L271">271</span>
  1.1099 -<span id="L272" rel="#L272">272</span>
  1.1100 -<span id="L273" rel="#L273">273</span>
  1.1101 -<span id="L274" rel="#L274">274</span>
  1.1102 -<span id="L275" rel="#L275">275</span>
  1.1103 -<span id="L276" rel="#L276">276</span>
  1.1104 -<span id="L277" rel="#L277">277</span>
  1.1105 -<span id="L278" rel="#L278">278</span>
  1.1106 -<span id="L279" rel="#L279">279</span>
  1.1107 -<span id="L280" rel="#L280">280</span>
  1.1108 -<span id="L281" rel="#L281">281</span>
  1.1109 -<span id="L282" rel="#L282">282</span>
  1.1110 -<span id="L283" rel="#L283">283</span>
  1.1111 -<span id="L284" rel="#L284">284</span>
  1.1112 -<span id="L285" rel="#L285">285</span>
  1.1113 -<span id="L286" rel="#L286">286</span>
  1.1114 -<span id="L287" rel="#L287">287</span>
  1.1115 -<span id="L288" rel="#L288">288</span>
  1.1116 -<span id="L289" rel="#L289">289</span>
  1.1117 -<span id="L290" rel="#L290">290</span>
  1.1118 -<span id="L291" rel="#L291">291</span>
  1.1119 -<span id="L292" rel="#L292">292</span>
  1.1120 -<span id="L293" rel="#L293">293</span>
  1.1121 -<span id="L294" rel="#L294">294</span>
  1.1122 -<span id="L295" rel="#L295">295</span>
  1.1123 -<span id="L296" rel="#L296">296</span>
  1.1124 -<span id="L297" rel="#L297">297</span>
  1.1125 -<span id="L298" rel="#L298">298</span>
  1.1126 -<span id="L299" rel="#L299">299</span>
  1.1127 -<span id="L300" rel="#L300">300</span>
  1.1128 -<span id="L301" rel="#L301">301</span>
  1.1129 -<span id="L302" rel="#L302">302</span>
  1.1130 -<span id="L303" rel="#L303">303</span>
  1.1131 -<span id="L304" rel="#L304">304</span>
  1.1132 -<span id="L305" rel="#L305">305</span>
  1.1133 -<span id="L306" rel="#L306">306</span>
  1.1134 -<span id="L307" rel="#L307">307</span>
  1.1135 -<span id="L308" rel="#L308">308</span>
  1.1136 -<span id="L309" rel="#L309">309</span>
  1.1137 -<span id="L310" rel="#L310">310</span>
  1.1138 -<span id="L311" rel="#L311">311</span>
  1.1139 -<span id="L312" rel="#L312">312</span>
  1.1140 -<span id="L313" rel="#L313">313</span>
  1.1141 -<span id="L314" rel="#L314">314</span>
  1.1142 -<span id="L315" rel="#L315">315</span>
  1.1143 -<span id="L316" rel="#L316">316</span>
  1.1144 -<span id="L317" rel="#L317">317</span>
  1.1145 -<span id="L318" rel="#L318">318</span>
  1.1146 -<span id="L319" rel="#L319">319</span>
  1.1147 -<span id="L320" rel="#L320">320</span>
  1.1148 -<span id="L321" rel="#L321">321</span>
  1.1149 -<span id="L322" rel="#L322">322</span>
  1.1150 -<span id="L323" rel="#L323">323</span>
  1.1151 -<span id="L324" rel="#L324">324</span>
  1.1152 -<span id="L325" rel="#L325">325</span>
  1.1153 -<span id="L326" rel="#L326">326</span>
  1.1154 -<span id="L327" rel="#L327">327</span>
  1.1155 -<span id="L328" rel="#L328">328</span>
  1.1156 -<span id="L329" rel="#L329">329</span>
  1.1157 -<span id="L330" rel="#L330">330</span>
  1.1158 -<span id="L331" rel="#L331">331</span>
  1.1159 -<span id="L332" rel="#L332">332</span>
  1.1160 -<span id="L333" rel="#L333">333</span>
  1.1161 -<span id="L334" rel="#L334">334</span>
  1.1162 -<span id="L335" rel="#L335">335</span>
  1.1163 -<span id="L336" rel="#L336">336</span>
  1.1164 -<span id="L337" rel="#L337">337</span>
  1.1165 -<span id="L338" rel="#L338">338</span>
  1.1166 -<span id="L339" rel="#L339">339</span>
  1.1167 -<span id="L340" rel="#L340">340</span>
  1.1168 -<span id="L341" rel="#L341">341</span>
  1.1169 -<span id="L342" rel="#L342">342</span>
  1.1170 -<span id="L343" rel="#L343">343</span>
  1.1171 -<span id="L344" rel="#L344">344</span>
  1.1172 -<span id="L345" rel="#L345">345</span>
  1.1173 -<span id="L346" rel="#L346">346</span>
  1.1174 -<span id="L347" rel="#L347">347</span>
  1.1175 -<span id="L348" rel="#L348">348</span>
  1.1176 -<span id="L349" rel="#L349">349</span>
  1.1177 -<span id="L350" rel="#L350">350</span>
  1.1178 -<span id="L351" rel="#L351">351</span>
  1.1179 -<span id="L352" rel="#L352">352</span>
  1.1180 -<span id="L353" rel="#L353">353</span>
  1.1181 -<span id="L354" rel="#L354">354</span>
  1.1182 -<span id="L355" rel="#L355">355</span>
  1.1183 -<span id="L356" rel="#L356">356</span>
  1.1184 -<span id="L357" rel="#L357">357</span>
  1.1185 -<span id="L358" rel="#L358">358</span>
  1.1186 -<span id="L359" rel="#L359">359</span>
  1.1187 -<span id="L360" rel="#L360">360</span>
  1.1188 -<span id="L361" rel="#L361">361</span>
  1.1189 -<span id="L362" rel="#L362">362</span>
  1.1190 -<span id="L363" rel="#L363">363</span>
  1.1191 -<span id="L364" rel="#L364">364</span>
  1.1192 -<span id="L365" rel="#L365">365</span>
  1.1193 -<span id="L366" rel="#L366">366</span>
  1.1194 -<span id="L367" rel="#L367">367</span>
  1.1195 -<span id="L368" rel="#L368">368</span>
  1.1196 -<span id="L369" rel="#L369">369</span>
  1.1197 -<span id="L370" rel="#L370">370</span>
  1.1198 -<span id="L371" rel="#L371">371</span>
  1.1199 -<span id="L372" rel="#L372">372</span>
  1.1200 -<span id="L373" rel="#L373">373</span>
  1.1201 -<span id="L374" rel="#L374">374</span>
  1.1202 -<span id="L375" rel="#L375">375</span>
  1.1203 -<span id="L376" rel="#L376">376</span>
  1.1204 -<span id="L377" rel="#L377">377</span>
  1.1205 -<span id="L378" rel="#L378">378</span>
  1.1206 -<span id="L379" rel="#L379">379</span>
  1.1207 -<span id="L380" rel="#L380">380</span>
  1.1208 -<span id="L381" rel="#L381">381</span>
  1.1209 -<span id="L382" rel="#L382">382</span>
  1.1210 -<span id="L383" rel="#L383">383</span>
  1.1211 -<span id="L384" rel="#L384">384</span>
  1.1212 -<span id="L385" rel="#L385">385</span>
  1.1213 -<span id="L386" rel="#L386">386</span>
  1.1214 -<span id="L387" rel="#L387">387</span>
  1.1215 -<span id="L388" rel="#L388">388</span>
  1.1216 -<span id="L389" rel="#L389">389</span>
  1.1217 -<span id="L390" rel="#L390">390</span>
  1.1218 -<span id="L391" rel="#L391">391</span>
  1.1219 -<span id="L392" rel="#L392">392</span>
  1.1220 -<span id="L393" rel="#L393">393</span>
  1.1221 -<span id="L394" rel="#L394">394</span>
  1.1222 -<span id="L395" rel="#L395">395</span>
  1.1223 -<span id="L396" rel="#L396">396</span>
  1.1224 -<span id="L397" rel="#L397">397</span>
  1.1225 -<span id="L398" rel="#L398">398</span>
  1.1226 -<span id="L399" rel="#L399">399</span>
  1.1227 -<span id="L400" rel="#L400">400</span>
  1.1228 -<span id="L401" rel="#L401">401</span>
  1.1229 -<span id="L402" rel="#L402">402</span>
  1.1230 -<span id="L403" rel="#L403">403</span>
  1.1231 -<span id="L404" rel="#L404">404</span>
  1.1232 -<span id="L405" rel="#L405">405</span>
  1.1233 -<span id="L406" rel="#L406">406</span>
  1.1234 -<span id="L407" rel="#L407">407</span>
  1.1235 -<span id="L408" rel="#L408">408</span>
  1.1236 -<span id="L409" rel="#L409">409</span>
  1.1237 -<span id="L410" rel="#L410">410</span>
  1.1238 -<span id="L411" rel="#L411">411</span>
  1.1239 -<span id="L412" rel="#L412">412</span>
  1.1240 -<span id="L413" rel="#L413">413</span>
  1.1241 -<span id="L414" rel="#L414">414</span>
  1.1242 -<span id="L415" rel="#L415">415</span>
  1.1243 -<span id="L416" rel="#L416">416</span>
  1.1244 -<span id="L417" rel="#L417">417</span>
  1.1245 -<span id="L418" rel="#L418">418</span>
  1.1246 -<span id="L419" rel="#L419">419</span>
  1.1247 -<span id="L420" rel="#L420">420</span>
  1.1248 -<span id="L421" rel="#L421">421</span>
  1.1249 -<span id="L422" rel="#L422">422</span>
  1.1250 -<span id="L423" rel="#L423">423</span>
  1.1251 -<span id="L424" rel="#L424">424</span>
  1.1252 -<span id="L425" rel="#L425">425</span>
  1.1253 -<span id="L426" rel="#L426">426</span>
  1.1254 -<span id="L427" rel="#L427">427</span>
  1.1255 -<span id="L428" rel="#L428">428</span>
  1.1256 -<span id="L429" rel="#L429">429</span>
  1.1257 -<span id="L430" rel="#L430">430</span>
  1.1258 -<span id="L431" rel="#L431">431</span>
  1.1259 -<span id="L432" rel="#L432">432</span>
  1.1260 -<span id="L433" rel="#L433">433</span>
  1.1261 -<span id="L434" rel="#L434">434</span>
  1.1262 -<span id="L435" rel="#L435">435</span>
  1.1263 -<span id="L436" rel="#L436">436</span>
  1.1264 -<span id="L437" rel="#L437">437</span>
  1.1265 -<span id="L438" rel="#L438">438</span>
  1.1266 -<span id="L439" rel="#L439">439</span>
  1.1267 -<span id="L440" rel="#L440">440</span>
  1.1268 -<span id="L441" rel="#L441">441</span>
  1.1269 -<span id="L442" rel="#L442">442</span>
  1.1270 -<span id="L443" rel="#L443">443</span>
  1.1271 -<span id="L444" rel="#L444">444</span>
  1.1272 -<span id="L445" rel="#L445">445</span>
  1.1273 -<span id="L446" rel="#L446">446</span>
  1.1274 -<span id="L447" rel="#L447">447</span>
  1.1275 -<span id="L448" rel="#L448">448</span>
  1.1276 -<span id="L449" rel="#L449">449</span>
  1.1277 -<span id="L450" rel="#L450">450</span>
  1.1278 -<span id="L451" rel="#L451">451</span>
  1.1279 -<span id="L452" rel="#L452">452</span>
  1.1280 -<span id="L453" rel="#L453">453</span>
  1.1281 -<span id="L454" rel="#L454">454</span>
  1.1282 -<span id="L455" rel="#L455">455</span>
  1.1283 -<span id="L456" rel="#L456">456</span>
  1.1284 -<span id="L457" rel="#L457">457</span>
  1.1285 -<span id="L458" rel="#L458">458</span>
  1.1286 -<span id="L459" rel="#L459">459</span>
  1.1287 -<span id="L460" rel="#L460">460</span>
  1.1288 -<span id="L461" rel="#L461">461</span>
  1.1289 -<span id="L462" rel="#L462">462</span>
  1.1290 -<span id="L463" rel="#L463">463</span>
  1.1291 -<span id="L464" rel="#L464">464</span>
  1.1292 -<span id="L465" rel="#L465">465</span>
  1.1293 -<span id="L466" rel="#L466">466</span>
  1.1294 -<span id="L467" rel="#L467">467</span>
  1.1295 -<span id="L468" rel="#L468">468</span>
  1.1296 -<span id="L469" rel="#L469">469</span>
  1.1297 -<span id="L470" rel="#L470">470</span>
  1.1298 -<span id="L471" rel="#L471">471</span>
  1.1299 -<span id="L472" rel="#L472">472</span>
  1.1300 -<span id="L473" rel="#L473">473</span>
  1.1301 -<span id="L474" rel="#L474">474</span>
  1.1302 -<span id="L475" rel="#L475">475</span>
  1.1303 -<span id="L476" rel="#L476">476</span>
  1.1304 -<span id="L477" rel="#L477">477</span>
  1.1305 -<span id="L478" rel="#L478">478</span>
  1.1306 -<span id="L479" rel="#L479">479</span>
  1.1307 -<span id="L480" rel="#L480">480</span>
  1.1308 -<span id="L481" rel="#L481">481</span>
  1.1309 -<span id="L482" rel="#L482">482</span>
  1.1310 -<span id="L483" rel="#L483">483</span>
  1.1311 -<span id="L484" rel="#L484">484</span>
  1.1312 -<span id="L485" rel="#L485">485</span>
  1.1313 -<span id="L486" rel="#L486">486</span>
  1.1314 -<span id="L487" rel="#L487">487</span>
  1.1315 -<span id="L488" rel="#L488">488</span>
  1.1316 -<span id="L489" rel="#L489">489</span>
  1.1317 -<span id="L490" rel="#L490">490</span>
  1.1318 -<span id="L491" rel="#L491">491</span>
  1.1319 -<span id="L492" rel="#L492">492</span>
  1.1320 -<span id="L493" rel="#L493">493</span>
  1.1321 -<span id="L494" rel="#L494">494</span>
  1.1322 -<span id="L495" rel="#L495">495</span>
  1.1323 -<span id="L496" rel="#L496">496</span>
  1.1324 -<span id="L497" rel="#L497">497</span>
  1.1325 -<span id="L498" rel="#L498">498</span>
  1.1326 -<span id="L499" rel="#L499">499</span>
  1.1327 -<span id="L500" rel="#L500">500</span>
  1.1328 -<span id="L501" rel="#L501">501</span>
  1.1329 -<span id="L502" rel="#L502">502</span>
  1.1330 -<span id="L503" rel="#L503">503</span>
  1.1331 -<span id="L504" rel="#L504">504</span>
  1.1332 -<span id="L505" rel="#L505">505</span>
  1.1333 -<span id="L506" rel="#L506">506</span>
  1.1334 -<span id="L507" rel="#L507">507</span>
  1.1335 -<span id="L508" rel="#L508">508</span>
  1.1336 -<span id="L509" rel="#L509">509</span>
  1.1337 -<span id="L510" rel="#L510">510</span>
  1.1338 -<span id="L511" rel="#L511">511</span>
  1.1339 -<span id="L512" rel="#L512">512</span>
  1.1340 -<span id="L513" rel="#L513">513</span>
  1.1341 -<span id="L514" rel="#L514">514</span>
  1.1342 -<span id="L515" rel="#L515">515</span>
  1.1343 -<span id="L516" rel="#L516">516</span>
  1.1344 -<span id="L517" rel="#L517">517</span>
  1.1345 -<span id="L518" rel="#L518">518</span>
  1.1346 -<span id="L519" rel="#L519">519</span>
  1.1347 -<span id="L520" rel="#L520">520</span>
  1.1348 -<span id="L521" rel="#L521">521</span>
  1.1349 -<span id="L522" rel="#L522">522</span>
  1.1350 -<span id="L523" rel="#L523">523</span>
  1.1351 -<span id="L524" rel="#L524">524</span>
  1.1352 -<span id="L525" rel="#L525">525</span>
  1.1353 -<span id="L526" rel="#L526">526</span>
  1.1354 -<span id="L527" rel="#L527">527</span>
  1.1355 -<span id="L528" rel="#L528">528</span>
  1.1356 -<span id="L529" rel="#L529">529</span>
  1.1357 -<span id="L530" rel="#L530">530</span>
  1.1358 -<span id="L531" rel="#L531">531</span>
  1.1359 -<span id="L532" rel="#L532">532</span>
  1.1360 -<span id="L533" rel="#L533">533</span>
  1.1361 -<span id="L534" rel="#L534">534</span>
  1.1362 -<span id="L535" rel="#L535">535</span>
  1.1363 -<span id="L536" rel="#L536">536</span>
  1.1364 -<span id="L537" rel="#L537">537</span>
  1.1365 -<span id="L538" rel="#L538">538</span>
  1.1366 -<span id="L539" rel="#L539">539</span>
  1.1367 -<span id="L540" rel="#L540">540</span>
  1.1368 -<span id="L541" rel="#L541">541</span>
  1.1369 -<span id="L542" rel="#L542">542</span>
  1.1370 -<span id="L543" rel="#L543">543</span>
  1.1371 -<span id="L544" rel="#L544">544</span>
  1.1372 -<span id="L545" rel="#L545">545</span>
  1.1373 -<span id="L546" rel="#L546">546</span>
  1.1374 -<span id="L547" rel="#L547">547</span>
  1.1375 -<span id="L548" rel="#L548">548</span>
  1.1376 -<span id="L549" rel="#L549">549</span>
  1.1377 -<span id="L550" rel="#L550">550</span>
  1.1378 -<span id="L551" rel="#L551">551</span>
  1.1379 -<span id="L552" rel="#L552">552</span>
  1.1380 -<span id="L553" rel="#L553">553</span>
  1.1381 -<span id="L554" rel="#L554">554</span>
  1.1382 -<span id="L555" rel="#L555">555</span>
  1.1383 -<span id="L556" rel="#L556">556</span>
  1.1384 -<span id="L557" rel="#L557">557</span>
  1.1385 -<span id="L558" rel="#L558">558</span>
  1.1386 -<span id="L559" rel="#L559">559</span>
  1.1387 -<span id="L560" rel="#L560">560</span>
  1.1388 -<span id="L561" rel="#L561">561</span>
  1.1389 -<span id="L562" rel="#L562">562</span>
  1.1390 -<span id="L563" rel="#L563">563</span>
  1.1391 -<span id="L564" rel="#L564">564</span>
  1.1392 -<span id="L565" rel="#L565">565</span>
  1.1393 -<span id="L566" rel="#L566">566</span>
  1.1394 -<span id="L567" rel="#L567">567</span>
  1.1395 -<span id="L568" rel="#L568">568</span>
  1.1396 -<span id="L569" rel="#L569">569</span>
  1.1397 -<span id="L570" rel="#L570">570</span>
  1.1398 -<span id="L571" rel="#L571">571</span>
  1.1399 -<span id="L572" rel="#L572">572</span>
  1.1400 -<span id="L573" rel="#L573">573</span>
  1.1401 -<span id="L574" rel="#L574">574</span>
  1.1402 -<span id="L575" rel="#L575">575</span>
  1.1403 -<span id="L576" rel="#L576">576</span>
  1.1404 -<span id="L577" rel="#L577">577</span>
  1.1405 -<span id="L578" rel="#L578">578</span>
  1.1406 -<span id="L579" rel="#L579">579</span>
  1.1407 -<span id="L580" rel="#L580">580</span>
  1.1408 -<span id="L581" rel="#L581">581</span>
  1.1409 -<span id="L582" rel="#L582">582</span>
  1.1410 -<span id="L583" rel="#L583">583</span>
  1.1411 -<span id="L584" rel="#L584">584</span>
  1.1412 -<span id="L585" rel="#L585">585</span>
  1.1413 -<span id="L586" rel="#L586">586</span>
  1.1414 -<span id="L587" rel="#L587">587</span>
  1.1415 -<span id="L588" rel="#L588">588</span>
  1.1416 -<span id="L589" rel="#L589">589</span>
  1.1417 -<span id="L590" rel="#L590">590</span>
  1.1418 -<span id="L591" rel="#L591">591</span>
  1.1419 -<span id="L592" rel="#L592">592</span>
  1.1420 -<span id="L593" rel="#L593">593</span>
  1.1421 -<span id="L594" rel="#L594">594</span>
  1.1422 -<span id="L595" rel="#L595">595</span>
  1.1423 -<span id="L596" rel="#L596">596</span>
  1.1424 -<span id="L597" rel="#L597">597</span>
  1.1425 -<span id="L598" rel="#L598">598</span>
  1.1426 -<span id="L599" rel="#L599">599</span>
  1.1427 -<span id="L600" rel="#L600">600</span>
  1.1428 -<span id="L601" rel="#L601">601</span>
  1.1429 -<span id="L602" rel="#L602">602</span>
  1.1430 -<span id="L603" rel="#L603">603</span>
  1.1431 -<span id="L604" rel="#L604">604</span>
  1.1432 -<span id="L605" rel="#L605">605</span>
  1.1433 -<span id="L606" rel="#L606">606</span>
  1.1434 -<span id="L607" rel="#L607">607</span>
  1.1435 -<span id="L608" rel="#L608">608</span>
  1.1436 -<span id="L609" rel="#L609">609</span>
  1.1437 -<span id="L610" rel="#L610">610</span>
  1.1438 -<span id="L611" rel="#L611">611</span>
  1.1439 -<span id="L612" rel="#L612">612</span>
  1.1440 -<span id="L613" rel="#L613">613</span>
  1.1441 -<span id="L614" rel="#L614">614</span>
  1.1442 -<span id="L615" rel="#L615">615</span>
  1.1443 -<span id="L616" rel="#L616">616</span>
  1.1444 -<span id="L617" rel="#L617">617</span>
  1.1445 -<span id="L618" rel="#L618">618</span>
  1.1446 -<span id="L619" rel="#L619">619</span>
  1.1447 -<span id="L620" rel="#L620">620</span>
  1.1448 -<span id="L621" rel="#L621">621</span>
  1.1449 -<span id="L622" rel="#L622">622</span>
  1.1450 -<span id="L623" rel="#L623">623</span>
  1.1451 -<span id="L624" rel="#L624">624</span>
  1.1452 -<span id="L625" rel="#L625">625</span>
  1.1453 -<span id="L626" rel="#L626">626</span>
  1.1454 -<span id="L627" rel="#L627">627</span>
  1.1455 -<span id="L628" rel="#L628">628</span>
  1.1456 -<span id="L629" rel="#L629">629</span>
  1.1457 -<span id="L630" rel="#L630">630</span>
  1.1458 -<span id="L631" rel="#L631">631</span>
  1.1459 -<span id="L632" rel="#L632">632</span>
  1.1460 -<span id="L633" rel="#L633">633</span>
  1.1461 -<span id="L634" rel="#L634">634</span>
  1.1462 -<span id="L635" rel="#L635">635</span>
  1.1463 -<span id="L636" rel="#L636">636</span>
  1.1464 -<span id="L637" rel="#L637">637</span>
  1.1465 -<span id="L638" rel="#L638">638</span>
  1.1466 -<span id="L639" rel="#L639">639</span>
  1.1467 -<span id="L640" rel="#L640">640</span>
  1.1468 -<span id="L641" rel="#L641">641</span>
  1.1469 -<span id="L642" rel="#L642">642</span>
  1.1470 -<span id="L643" rel="#L643">643</span>
  1.1471 -<span id="L644" rel="#L644">644</span>
  1.1472 -<span id="L645" rel="#L645">645</span>
  1.1473 -<span id="L646" rel="#L646">646</span>
  1.1474 -<span id="L647" rel="#L647">647</span>
  1.1475 -<span id="L648" rel="#L648">648</span>
  1.1476 -<span id="L649" rel="#L649">649</span>
  1.1477 -<span id="L650" rel="#L650">650</span>
  1.1478 -<span id="L651" rel="#L651">651</span>
  1.1479 -<span id="L652" rel="#L652">652</span>
  1.1480 -<span id="L653" rel="#L653">653</span>
  1.1481 -<span id="L654" rel="#L654">654</span>
  1.1482 -<span id="L655" rel="#L655">655</span>
  1.1483 -<span id="L656" rel="#L656">656</span>
  1.1484 -<span id="L657" rel="#L657">657</span>
  1.1485 -<span id="L658" rel="#L658">658</span>
  1.1486 -<span id="L659" rel="#L659">659</span>
  1.1487 -<span id="L660" rel="#L660">660</span>
  1.1488 -<span id="L661" rel="#L661">661</span>
  1.1489 -<span id="L662" rel="#L662">662</span>
  1.1490 -<span id="L663" rel="#L663">663</span>
  1.1491 -<span id="L664" rel="#L664">664</span>
  1.1492 -<span id="L665" rel="#L665">665</span>
  1.1493 -<span id="L666" rel="#L666">666</span>
  1.1494 -<span id="L667" rel="#L667">667</span>
  1.1495 -<span id="L668" rel="#L668">668</span>
  1.1496 -<span id="L669" rel="#L669">669</span>
  1.1497 -<span id="L670" rel="#L670">670</span>
  1.1498 -<span id="L671" rel="#L671">671</span>
  1.1499 -<span id="L672" rel="#L672">672</span>
  1.1500 -<span id="L673" rel="#L673">673</span>
  1.1501 -<span id="L674" rel="#L674">674</span>
  1.1502 -<span id="L675" rel="#L675">675</span>
  1.1503 -<span id="L676" rel="#L676">676</span>
  1.1504 -<span id="L677" rel="#L677">677</span>
  1.1505 -<span id="L678" rel="#L678">678</span>
  1.1506 -<span id="L679" rel="#L679">679</span>
  1.1507 -<span id="L680" rel="#L680">680</span>
  1.1508 -<span id="L681" rel="#L681">681</span>
  1.1509 -<span id="L682" rel="#L682">682</span>
  1.1510 -<span id="L683" rel="#L683">683</span>
  1.1511 -<span id="L684" rel="#L684">684</span>
  1.1512 -<span id="L685" rel="#L685">685</span>
  1.1513 -<span id="L686" rel="#L686">686</span>
  1.1514 -<span id="L687" rel="#L687">687</span>
  1.1515 -<span id="L688" rel="#L688">688</span>
  1.1516 -<span id="L689" rel="#L689">689</span>
  1.1517 -<span id="L690" rel="#L690">690</span>
  1.1518 -<span id="L691" rel="#L691">691</span>
  1.1519 -<span id="L692" rel="#L692">692</span>
  1.1520 -<span id="L693" rel="#L693">693</span>
  1.1521 -<span id="L694" rel="#L694">694</span>
  1.1522 -<span id="L695" rel="#L695">695</span>
  1.1523 -<span id="L696" rel="#L696">696</span>
  1.1524 -<span id="L697" rel="#L697">697</span>
  1.1525 -<span id="L698" rel="#L698">698</span>
  1.1526 -<span id="L699" rel="#L699">699</span>
  1.1527 -<span id="L700" rel="#L700">700</span>
  1.1528 -<span id="L701" rel="#L701">701</span>
  1.1529 -<span id="L702" rel="#L702">702</span>
  1.1530 -<span id="L703" rel="#L703">703</span>
  1.1531 -<span id="L704" rel="#L704">704</span>
  1.1532 -<span id="L705" rel="#L705">705</span>
  1.1533 -<span id="L706" rel="#L706">706</span>
  1.1534 -<span id="L707" rel="#L707">707</span>
  1.1535 -<span id="L708" rel="#L708">708</span>
  1.1536 -<span id="L709" rel="#L709">709</span>
  1.1537 -<span id="L710" rel="#L710">710</span>
  1.1538 -<span id="L711" rel="#L711">711</span>
  1.1539 -<span id="L712" rel="#L712">712</span>
  1.1540 -<span id="L713" rel="#L713">713</span>
  1.1541 -<span id="L714" rel="#L714">714</span>
  1.1542 -<span id="L715" rel="#L715">715</span>
  1.1543 -<span id="L716" rel="#L716">716</span>
  1.1544 -<span id="L717" rel="#L717">717</span>
  1.1545 -<span id="L718" rel="#L718">718</span>
  1.1546 -<span id="L719" rel="#L719">719</span>
  1.1547 -<span id="L720" rel="#L720">720</span>
  1.1548 -<span id="L721" rel="#L721">721</span>
  1.1549 -<span id="L722" rel="#L722">722</span>
  1.1550 -<span id="L723" rel="#L723">723</span>
  1.1551 -<span id="L724" rel="#L724">724</span>
  1.1552 -<span id="L725" rel="#L725">725</span>
  1.1553 -<span id="L726" rel="#L726">726</span>
  1.1554 -<span id="L727" rel="#L727">727</span>
  1.1555 -<span id="L728" rel="#L728">728</span>
  1.1556 -<span id="L729" rel="#L729">729</span>
  1.1557 -<span id="L730" rel="#L730">730</span>
  1.1558 -<span id="L731" rel="#L731">731</span>
  1.1559 -<span id="L732" rel="#L732">732</span>
  1.1560 -<span id="L733" rel="#L733">733</span>
  1.1561 -<span id="L734" rel="#L734">734</span>
  1.1562 -<span id="L735" rel="#L735">735</span>
  1.1563 -<span id="L736" rel="#L736">736</span>
  1.1564 -<span id="L737" rel="#L737">737</span>
  1.1565 -<span id="L738" rel="#L738">738</span>
  1.1566 -<span id="L739" rel="#L739">739</span>
  1.1567 -<span id="L740" rel="#L740">740</span>
  1.1568 -<span id="L741" rel="#L741">741</span>
  1.1569 -<span id="L742" rel="#L742">742</span>
  1.1570 -<span id="L743" rel="#L743">743</span>
  1.1571 -<span id="L744" rel="#L744">744</span>
  1.1572 -<span id="L745" rel="#L745">745</span>
  1.1573 -<span id="L746" rel="#L746">746</span>
  1.1574 -<span id="L747" rel="#L747">747</span>
  1.1575 -<span id="L748" rel="#L748">748</span>
  1.1576 -<span id="L749" rel="#L749">749</span>
  1.1577 -<span id="L750" rel="#L750">750</span>
  1.1578 -<span id="L751" rel="#L751">751</span>
  1.1579 -<span id="L752" rel="#L752">752</span>
  1.1580 -<span id="L753" rel="#L753">753</span>
  1.1581 -<span id="L754" rel="#L754">754</span>
  1.1582 -<span id="L755" rel="#L755">755</span>
  1.1583 -<span id="L756" rel="#L756">756</span>
  1.1584 -<span id="L757" rel="#L757">757</span>
  1.1585 -<span id="L758" rel="#L758">758</span>
  1.1586 -<span id="L759" rel="#L759">759</span>
  1.1587 -<span id="L760" rel="#L760">760</span>
  1.1588 -<span id="L761" rel="#L761">761</span>
  1.1589 -<span id="L762" rel="#L762">762</span>
  1.1590 -<span id="L763" rel="#L763">763</span>
  1.1591 -<span id="L764" rel="#L764">764</span>
  1.1592 -<span id="L765" rel="#L765">765</span>
  1.1593 -<span id="L766" rel="#L766">766</span>
  1.1594 -<span id="L767" rel="#L767">767</span>
  1.1595 -<span id="L768" rel="#L768">768</span>
  1.1596 -<span id="L769" rel="#L769">769</span>
  1.1597 -<span id="L770" rel="#L770">770</span>
  1.1598 -<span id="L771" rel="#L771">771</span>
  1.1599 -<span id="L772" rel="#L772">772</span>
  1.1600 -<span id="L773" rel="#L773">773</span>
  1.1601 -<span id="L774" rel="#L774">774</span>
  1.1602 -<span id="L775" rel="#L775">775</span>
  1.1603 -<span id="L776" rel="#L776">776</span>
  1.1604 -<span id="L777" rel="#L777">777</span>
  1.1605 -<span id="L778" rel="#L778">778</span>
  1.1606 -<span id="L779" rel="#L779">779</span>
  1.1607 -<span id="L780" rel="#L780">780</span>
  1.1608 -<span id="L781" rel="#L781">781</span>
  1.1609 -<span id="L782" rel="#L782">782</span>
  1.1610 -<span id="L783" rel="#L783">783</span>
  1.1611 -<span id="L784" rel="#L784">784</span>
  1.1612 -<span id="L785" rel="#L785">785</span>
  1.1613 -<span id="L786" rel="#L786">786</span>
  1.1614 -<span id="L787" rel="#L787">787</span>
  1.1615 -<span id="L788" rel="#L788">788</span>
  1.1616 -<span id="L789" rel="#L789">789</span>
  1.1617 -<span id="L790" rel="#L790">790</span>
  1.1618 -<span id="L791" rel="#L791">791</span>
  1.1619 -<span id="L792" rel="#L792">792</span>
  1.1620 -<span id="L793" rel="#L793">793</span>
  1.1621 -<span id="L794" rel="#L794">794</span>
  1.1622 -<span id="L795" rel="#L795">795</span>
  1.1623 -<span id="L796" rel="#L796">796</span>
  1.1624 -<span id="L797" rel="#L797">797</span>
  1.1625 -<span id="L798" rel="#L798">798</span>
  1.1626 -<span id="L799" rel="#L799">799</span>
  1.1627 -<span id="L800" rel="#L800">800</span>
  1.1628 -<span id="L801" rel="#L801">801</span>
  1.1629 -<span id="L802" rel="#L802">802</span>
  1.1630 -<span id="L803" rel="#L803">803</span>
  1.1631 -<span id="L804" rel="#L804">804</span>
  1.1632 -<span id="L805" rel="#L805">805</span>
  1.1633 -<span id="L806" rel="#L806">806</span>
  1.1634 -<span id="L807" rel="#L807">807</span>
  1.1635 -<span id="L808" rel="#L808">808</span>
  1.1636 -<span id="L809" rel="#L809">809</span>
  1.1637 -<span id="L810" rel="#L810">810</span>
  1.1638 -<span id="L811" rel="#L811">811</span>
  1.1639 -<span id="L812" rel="#L812">812</span>
  1.1640 -<span id="L813" rel="#L813">813</span>
  1.1641 -<span id="L814" rel="#L814">814</span>
  1.1642 -<span id="L815" rel="#L815">815</span>
  1.1643 -<span id="L816" rel="#L816">816</span>
  1.1644 -<span id="L817" rel="#L817">817</span>
  1.1645 -<span id="L818" rel="#L818">818</span>
  1.1646 -<span id="L819" rel="#L819">819</span>
  1.1647 -<span id="L820" rel="#L820">820</span>
  1.1648 -<span id="L821" rel="#L821">821</span>
  1.1649 -<span id="L822" rel="#L822">822</span>
  1.1650 -<span id="L823" rel="#L823">823</span>
  1.1651 -<span id="L824" rel="#L824">824</span>
  1.1652 -<span id="L825" rel="#L825">825</span>
  1.1653 -<span id="L826" rel="#L826">826</span>
  1.1654 -<span id="L827" rel="#L827">827</span>
  1.1655 -<span id="L828" rel="#L828">828</span>
  1.1656 -<span id="L829" rel="#L829">829</span>
  1.1657 -<span id="L830" rel="#L830">830</span>
  1.1658 -<span id="L831" rel="#L831">831</span>
  1.1659 -<span id="L832" rel="#L832">832</span>
  1.1660 -<span id="L833" rel="#L833">833</span>
  1.1661 -<span id="L834" rel="#L834">834</span>
  1.1662 -<span id="L835" rel="#L835">835</span>
  1.1663 -<span id="L836" rel="#L836">836</span>
  1.1664 -<span id="L837" rel="#L837">837</span>
  1.1665 -<span id="L838" rel="#L838">838</span>
  1.1666 -<span id="L839" rel="#L839">839</span>
  1.1667 -<span id="L840" rel="#L840">840</span>
  1.1668 -<span id="L841" rel="#L841">841</span>
  1.1669 -<span id="L842" rel="#L842">842</span>
  1.1670 -<span id="L843" rel="#L843">843</span>
  1.1671 -<span id="L844" rel="#L844">844</span>
  1.1672 -<span id="L845" rel="#L845">845</span>
  1.1673 -<span id="L846" rel="#L846">846</span>
  1.1674 -<span id="L847" rel="#L847">847</span>
  1.1675 -<span id="L848" rel="#L848">848</span>
  1.1676 -<span id="L849" rel="#L849">849</span>
  1.1677 -<span id="L850" rel="#L850">850</span>
  1.1678 -<span id="L851" rel="#L851">851</span>
  1.1679 -<span id="L852" rel="#L852">852</span>
  1.1680 -<span id="L853" rel="#L853">853</span>
  1.1681 -<span id="L854" rel="#L854">854</span>
  1.1682 -<span id="L855" rel="#L855">855</span>
  1.1683 -<span id="L856" rel="#L856">856</span>
  1.1684 -<span id="L857" rel="#L857">857</span>
  1.1685 -<span id="L858" rel="#L858">858</span>
  1.1686 -<span id="L859" rel="#L859">859</span>
  1.1687 -<span id="L860" rel="#L860">860</span>
  1.1688 -<span id="L861" rel="#L861">861</span>
  1.1689 -<span id="L862" rel="#L862">862</span>
  1.1690 -<span id="L863" rel="#L863">863</span>
  1.1691 -<span id="L864" rel="#L864">864</span>
  1.1692 -<span id="L865" rel="#L865">865</span>
  1.1693 -<span id="L866" rel="#L866">866</span>
  1.1694 -<span id="L867" rel="#L867">867</span>
  1.1695 -<span id="L868" rel="#L868">868</span>
  1.1696 -<span id="L869" rel="#L869">869</span>
  1.1697 -<span id="L870" rel="#L870">870</span>
  1.1698 -<span id="L871" rel="#L871">871</span>
  1.1699 -<span id="L872" rel="#L872">872</span>
  1.1700 -<span id="L873" rel="#L873">873</span>
  1.1701 -<span id="L874" rel="#L874">874</span>
  1.1702 -<span id="L875" rel="#L875">875</span>
  1.1703 -<span id="L876" rel="#L876">876</span>
  1.1704 -<span id="L877" rel="#L877">877</span>
  1.1705 -<span id="L878" rel="#L878">878</span>
  1.1706 -<span id="L879" rel="#L879">879</span>
  1.1707 -<span id="L880" rel="#L880">880</span>
  1.1708 -<span id="L881" rel="#L881">881</span>
  1.1709 -<span id="L882" rel="#L882">882</span>
  1.1710 -<span id="L883" rel="#L883">883</span>
  1.1711 -<span id="L884" rel="#L884">884</span>
  1.1712 -<span id="L885" rel="#L885">885</span>
  1.1713 -<span id="L886" rel="#L886">886</span>
  1.1714 -<span id="L887" rel="#L887">887</span>
  1.1715 -<span id="L888" rel="#L888">888</span>
  1.1716 -<span id="L889" rel="#L889">889</span>
  1.1717 -<span id="L890" rel="#L890">890</span>
  1.1718 -<span id="L891" rel="#L891">891</span>
  1.1719 -<span id="L892" rel="#L892">892</span>
  1.1720 -<span id="L893" rel="#L893">893</span>
  1.1721 -<span id="L894" rel="#L894">894</span>
  1.1722 -<span id="L895" rel="#L895">895</span>
  1.1723 -<span id="L896" rel="#L896">896</span>
  1.1724 -<span id="L897" rel="#L897">897</span>
  1.1725 -<span id="L898" rel="#L898">898</span>
  1.1726 -<span id="L899" rel="#L899">899</span>
  1.1727 -<span id="L900" rel="#L900">900</span>
  1.1728 -<span id="L901" rel="#L901">901</span>
  1.1729 -<span id="L902" rel="#L902">902</span>
  1.1730 -<span id="L903" rel="#L903">903</span>
  1.1731 -<span id="L904" rel="#L904">904</span>
  1.1732 -<span id="L905" rel="#L905">905</span>
  1.1733 -<span id="L906" rel="#L906">906</span>
  1.1734 -<span id="L907" rel="#L907">907</span>
  1.1735 -<span id="L908" rel="#L908">908</span>
  1.1736 -<span id="L909" rel="#L909">909</span>
  1.1737 -<span id="L910" rel="#L910">910</span>
  1.1738 -<span id="L911" rel="#L911">911</span>
  1.1739 -<span id="L912" rel="#L912">912</span>
  1.1740 -<span id="L913" rel="#L913">913</span>
  1.1741 -<span id="L914" rel="#L914">914</span>
  1.1742 -<span id="L915" rel="#L915">915</span>
  1.1743 -<span id="L916" rel="#L916">916</span>
  1.1744 -<span id="L917" rel="#L917">917</span>
  1.1745 -<span id="L918" rel="#L918">918</span>
  1.1746 -<span id="L919" rel="#L919">919</span>
  1.1747 -<span id="L920" rel="#L920">920</span>
  1.1748 -<span id="L921" rel="#L921">921</span>
  1.1749 -<span id="L922" rel="#L922">922</span>
  1.1750 -<span id="L923" rel="#L923">923</span>
  1.1751 -<span id="L924" rel="#L924">924</span>
  1.1752 -<span id="L925" rel="#L925">925</span>
  1.1753 -<span id="L926" rel="#L926">926</span>
  1.1754 -<span id="L927" rel="#L927">927</span>
  1.1755 -<span id="L928" rel="#L928">928</span>
  1.1756 -<span id="L929" rel="#L929">929</span>
  1.1757 -<span id="L930" rel="#L930">930</span>
  1.1758 -<span id="L931" rel="#L931">931</span>
  1.1759 -<span id="L932" rel="#L932">932</span>
  1.1760 -<span id="L933" rel="#L933">933</span>
  1.1761 -<span id="L934" rel="#L934">934</span>
  1.1762 -<span id="L935" rel="#L935">935</span>
  1.1763 -<span id="L936" rel="#L936">936</span>
  1.1764 -<span id="L937" rel="#L937">937</span>
  1.1765 -<span id="L938" rel="#L938">938</span>
  1.1766 -<span id="L939" rel="#L939">939</span>
  1.1767 -<span id="L940" rel="#L940">940</span>
  1.1768 -<span id="L941" rel="#L941">941</span>
  1.1769 -<span id="L942" rel="#L942">942</span>
  1.1770 -<span id="L943" rel="#L943">943</span>
  1.1771 -<span id="L944" rel="#L944">944</span>
  1.1772 -<span id="L945" rel="#L945">945</span>
  1.1773 -<span id="L946" rel="#L946">946</span>
  1.1774 -<span id="L947" rel="#L947">947</span>
  1.1775 -<span id="L948" rel="#L948">948</span>
  1.1776 -<span id="L949" rel="#L949">949</span>
  1.1777 -<span id="L950" rel="#L950">950</span>
  1.1778 -<span id="L951" rel="#L951">951</span>
  1.1779 -<span id="L952" rel="#L952">952</span>
  1.1780 -<span id="L953" rel="#L953">953</span>
  1.1781 -<span id="L954" rel="#L954">954</span>
  1.1782 -<span id="L955" rel="#L955">955</span>
  1.1783 -<span id="L956" rel="#L956">956</span>
  1.1784 -<span id="L957" rel="#L957">957</span>
  1.1785 -<span id="L958" rel="#L958">958</span>
  1.1786 -<span id="L959" rel="#L959">959</span>
  1.1787 -<span id="L960" rel="#L960">960</span>
  1.1788 -<span id="L961" rel="#L961">961</span>
  1.1789 -<span id="L962" rel="#L962">962</span>
  1.1790 -<span id="L963" rel="#L963">963</span>
  1.1791 -<span id="L964" rel="#L964">964</span>
  1.1792 -<span id="L965" rel="#L965">965</span>
  1.1793 -<span id="L966" rel="#L966">966</span>
  1.1794 -<span id="L967" rel="#L967">967</span>
  1.1795 -<span id="L968" rel="#L968">968</span>
  1.1796 -<span id="L969" rel="#L969">969</span>
  1.1797 -<span id="L970" rel="#L970">970</span>
  1.1798 -<span id="L971" rel="#L971">971</span>
  1.1799 -<span id="L972" rel="#L972">972</span>
  1.1800 -<span id="L973" rel="#L973">973</span>
  1.1801 -<span id="L974" rel="#L974">974</span>
  1.1802 -<span id="L975" rel="#L975">975</span>
  1.1803 -<span id="L976" rel="#L976">976</span>
  1.1804 -<span id="L977" rel="#L977">977</span>
  1.1805 -<span id="L978" rel="#L978">978</span>
  1.1806 -<span id="L979" rel="#L979">979</span>
  1.1807 -<span id="L980" rel="#L980">980</span>
  1.1808 -<span id="L981" rel="#L981">981</span>
  1.1809 -<span id="L982" rel="#L982">982</span>
  1.1810 -<span id="L983" rel="#L983">983</span>
  1.1811 -<span id="L984" rel="#L984">984</span>
  1.1812 -<span id="L985" rel="#L985">985</span>
  1.1813 -<span id="L986" rel="#L986">986</span>
  1.1814 -<span id="L987" rel="#L987">987</span>
  1.1815 -<span id="L988" rel="#L988">988</span>
  1.1816 -<span id="L989" rel="#L989">989</span>
  1.1817 -<span id="L990" rel="#L990">990</span>
  1.1818 -<span id="L991" rel="#L991">991</span>
  1.1819 -<span id="L992" rel="#L992">992</span>
  1.1820 -<span id="L993" rel="#L993">993</span>
  1.1821 -<span id="L994" rel="#L994">994</span>
  1.1822 -<span id="L995" rel="#L995">995</span>
  1.1823 -<span id="L996" rel="#L996">996</span>
  1.1824 -<span id="L997" rel="#L997">997</span>
  1.1825 -<span id="L998" rel="#L998">998</span>
  1.1826 -<span id="L999" rel="#L999">999</span>
  1.1827 -<span id="L1000" rel="#L1000">1000</span>
  1.1828 -<span id="L1001" rel="#L1001">1001</span>
  1.1829 -<span id="L1002" rel="#L1002">1002</span>
  1.1830 -<span id="L1003" rel="#L1003">1003</span>
  1.1831 -<span id="L1004" rel="#L1004">1004</span>
  1.1832 -<span id="L1005" rel="#L1005">1005</span>
  1.1833 -<span id="L1006" rel="#L1006">1006</span>
  1.1834 -<span id="L1007" rel="#L1007">1007</span>
  1.1835 -<span id="L1008" rel="#L1008">1008</span>
  1.1836 -<span id="L1009" rel="#L1009">1009</span>
  1.1837 -<span id="L1010" rel="#L1010">1010</span>
  1.1838 -<span id="L1011" rel="#L1011">1011</span>
  1.1839 -<span id="L1012" rel="#L1012">1012</span>
  1.1840 -<span id="L1013" rel="#L1013">1013</span>
  1.1841 -<span id="L1014" rel="#L1014">1014</span>
  1.1842 -<span id="L1015" rel="#L1015">1015</span>
  1.1843 -<span id="L1016" rel="#L1016">1016</span>
  1.1844 -<span id="L1017" rel="#L1017">1017</span>
  1.1845 -<span id="L1018" rel="#L1018">1018</span>
  1.1846 -<span id="L1019" rel="#L1019">1019</span>
  1.1847 -<span id="L1020" rel="#L1020">1020</span>
  1.1848 -<span id="L1021" rel="#L1021">1021</span>
  1.1849 -<span id="L1022" rel="#L1022">1022</span>
  1.1850 -<span id="L1023" rel="#L1023">1023</span>
  1.1851 -<span id="L1024" rel="#L1024">1024</span>
  1.1852 -<span id="L1025" rel="#L1025">1025</span>
  1.1853 -<span id="L1026" rel="#L1026">1026</span>
  1.1854 -<span id="L1027" rel="#L1027">1027</span>
  1.1855 -<span id="L1028" rel="#L1028">1028</span>
  1.1856 -<span id="L1029" rel="#L1029">1029</span>
  1.1857 -<span id="L1030" rel="#L1030">1030</span>
  1.1858 -<span id="L1031" rel="#L1031">1031</span>
  1.1859 -<span id="L1032" rel="#L1032">1032</span>
  1.1860 -<span id="L1033" rel="#L1033">1033</span>
  1.1861 -<span id="L1034" rel="#L1034">1034</span>
  1.1862 -<span id="L1035" rel="#L1035">1035</span>
  1.1863 -<span id="L1036" rel="#L1036">1036</span>
  1.1864 -<span id="L1037" rel="#L1037">1037</span>
  1.1865 -<span id="L1038" rel="#L1038">1038</span>
  1.1866 -<span id="L1039" rel="#L1039">1039</span>
  1.1867 -<span id="L1040" rel="#L1040">1040</span>
  1.1868 -<span id="L1041" rel="#L1041">1041</span>
  1.1869 -<span id="L1042" rel="#L1042">1042</span>
  1.1870 -<span id="L1043" rel="#L1043">1043</span>
  1.1871 -<span id="L1044" rel="#L1044">1044</span>
  1.1872 -<span id="L1045" rel="#L1045">1045</span>
  1.1873 -<span id="L1046" rel="#L1046">1046</span>
  1.1874 -<span id="L1047" rel="#L1047">1047</span>
  1.1875 -<span id="L1048" rel="#L1048">1048</span>
  1.1876 -<span id="L1049" rel="#L1049">1049</span>
  1.1877 -<span id="L1050" rel="#L1050">1050</span>
  1.1878 -<span id="L1051" rel="#L1051">1051</span>
  1.1879 -<span id="L1052" rel="#L1052">1052</span>
  1.1880 -<span id="L1053" rel="#L1053">1053</span>
  1.1881 -<span id="L1054" rel="#L1054">1054</span>
  1.1882 -<span id="L1055" rel="#L1055">1055</span>
  1.1883 -<span id="L1056" rel="#L1056">1056</span>
  1.1884 -<span id="L1057" rel="#L1057">1057</span>
  1.1885 -<span id="L1058" rel="#L1058">1058</span>
  1.1886 -<span id="L1059" rel="#L1059">1059</span>
  1.1887 -<span id="L1060" rel="#L1060">1060</span>
  1.1888 -<span id="L1061" rel="#L1061">1061</span>
  1.1889 -<span id="L1062" rel="#L1062">1062</span>
  1.1890 -<span id="L1063" rel="#L1063">1063</span>
  1.1891 -<span id="L1064" rel="#L1064">1064</span>
  1.1892 -<span id="L1065" rel="#L1065">1065</span>
  1.1893 -<span id="L1066" rel="#L1066">1066</span>
  1.1894 -<span id="L1067" rel="#L1067">1067</span>
  1.1895 -<span id="L1068" rel="#L1068">1068</span>
  1.1896 -<span id="L1069" rel="#L1069">1069</span>
  1.1897 -<span id="L1070" rel="#L1070">1070</span>
  1.1898 -<span id="L1071" rel="#L1071">1071</span>
  1.1899 -<span id="L1072" rel="#L1072">1072</span>
  1.1900 -<span id="L1073" rel="#L1073">1073</span>
  1.1901 -<span id="L1074" rel="#L1074">1074</span>
  1.1902 -<span id="L1075" rel="#L1075">1075</span>
  1.1903 -<span id="L1076" rel="#L1076">1076</span>
  1.1904 -<span id="L1077" rel="#L1077">1077</span>
  1.1905 -<span id="L1078" rel="#L1078">1078</span>
  1.1906 -<span id="L1079" rel="#L1079">1079</span>
  1.1907 -<span id="L1080" rel="#L1080">1080</span>
  1.1908 -<span id="L1081" rel="#L1081">1081</span>
  1.1909 -<span id="L1082" rel="#L1082">1082</span>
  1.1910 -<span id="L1083" rel="#L1083">1083</span>
  1.1911 -<span id="L1084" rel="#L1084">1084</span>
  1.1912 -<span id="L1085" rel="#L1085">1085</span>
  1.1913 -<span id="L1086" rel="#L1086">1086</span>
  1.1914 -<span id="L1087" rel="#L1087">1087</span>
  1.1915 -<span id="L1088" rel="#L1088">1088</span>
  1.1916 -<span id="L1089" rel="#L1089">1089</span>
  1.1917 -<span id="L1090" rel="#L1090">1090</span>
  1.1918 -<span id="L1091" rel="#L1091">1091</span>
  1.1919 -<span id="L1092" rel="#L1092">1092</span>
  1.1920 -<span id="L1093" rel="#L1093">1093</span>
  1.1921 -<span id="L1094" rel="#L1094">1094</span>
  1.1922 -<span id="L1095" rel="#L1095">1095</span>
  1.1923 -<span id="L1096" rel="#L1096">1096</span>
  1.1924 -<span id="L1097" rel="#L1097">1097</span>
  1.1925 -<span id="L1098" rel="#L1098">1098</span>
  1.1926 -<span id="L1099" rel="#L1099">1099</span>
  1.1927 -<span id="L1100" rel="#L1100">1100</span>
  1.1928 -<span id="L1101" rel="#L1101">1101</span>
  1.1929 -<span id="L1102" rel="#L1102">1102</span>
  1.1930 -<span id="L1103" rel="#L1103">1103</span>
  1.1931 -<span id="L1104" rel="#L1104">1104</span>
  1.1932 -<span id="L1105" rel="#L1105">1105</span>
  1.1933 -<span id="L1106" rel="#L1106">1106</span>
  1.1934 -<span id="L1107" rel="#L1107">1107</span>
  1.1935 -<span id="L1108" rel="#L1108">1108</span>
  1.1936 -<span id="L1109" rel="#L1109">1109</span>
  1.1937 -<span id="L1110" rel="#L1110">1110</span>
  1.1938 -<span id="L1111" rel="#L1111">1111</span>
  1.1939 -<span id="L1112" rel="#L1112">1112</span>
  1.1940 -<span id="L1113" rel="#L1113">1113</span>
  1.1941 -<span id="L1114" rel="#L1114">1114</span>
  1.1942 -<span id="L1115" rel="#L1115">1115</span>
  1.1943 -<span id="L1116" rel="#L1116">1116</span>
  1.1944 -<span id="L1117" rel="#L1117">1117</span>
  1.1945 -<span id="L1118" rel="#L1118">1118</span>
  1.1946 -<span id="L1119" rel="#L1119">1119</span>
  1.1947 -<span id="L1120" rel="#L1120">1120</span>
  1.1948 -<span id="L1121" rel="#L1121">1121</span>
  1.1949 -<span id="L1122" rel="#L1122">1122</span>
  1.1950 -<span id="L1123" rel="#L1123">1123</span>
  1.1951 -<span id="L1124" rel="#L1124">1124</span>
  1.1952 -<span id="L1125" rel="#L1125">1125</span>
  1.1953 -<span id="L1126" rel="#L1126">1126</span>
  1.1954 -<span id="L1127" rel="#L1127">1127</span>
  1.1955 -<span id="L1128" rel="#L1128">1128</span>
  1.1956 -<span id="L1129" rel="#L1129">1129</span>
  1.1957 -<span id="L1130" rel="#L1130">1130</span>
  1.1958 -<span id="L1131" rel="#L1131">1131</span>
  1.1959 -<span id="L1132" rel="#L1132">1132</span>
  1.1960 -<span id="L1133" rel="#L1133">1133</span>
  1.1961 -<span id="L1134" rel="#L1134">1134</span>
  1.1962 -<span id="L1135" rel="#L1135">1135</span>
  1.1963 -<span id="L1136" rel="#L1136">1136</span>
  1.1964 -<span id="L1137" rel="#L1137">1137</span>
  1.1965 -<span id="L1138" rel="#L1138">1138</span>
  1.1966 -<span id="L1139" rel="#L1139">1139</span>
  1.1967 -<span id="L1140" rel="#L1140">1140</span>
  1.1968 -<span id="L1141" rel="#L1141">1141</span>
  1.1969 -<span id="L1142" rel="#L1142">1142</span>
  1.1970 -<span id="L1143" rel="#L1143">1143</span>
  1.1971 -<span id="L1144" rel="#L1144">1144</span>
  1.1972 -<span id="L1145" rel="#L1145">1145</span>
  1.1973 -<span id="L1146" rel="#L1146">1146</span>
  1.1974 -<span id="L1147" rel="#L1147">1147</span>
  1.1975 -<span id="L1148" rel="#L1148">1148</span>
  1.1976 -<span id="L1149" rel="#L1149">1149</span>
  1.1977 -<span id="L1150" rel="#L1150">1150</span>
  1.1978 -<span id="L1151" rel="#L1151">1151</span>
  1.1979 -<span id="L1152" rel="#L1152">1152</span>
  1.1980 -<span id="L1153" rel="#L1153">1153</span>
  1.1981 -<span id="L1154" rel="#L1154">1154</span>
  1.1982 -<span id="L1155" rel="#L1155">1155</span>
  1.1983 -<span id="L1156" rel="#L1156">1156</span>
  1.1984 -<span id="L1157" rel="#L1157">1157</span>
  1.1985 -<span id="L1158" rel="#L1158">1158</span>
  1.1986 -<span id="L1159" rel="#L1159">1159</span>
  1.1987 -<span id="L1160" rel="#L1160">1160</span>
  1.1988 -<span id="L1161" rel="#L1161">1161</span>
  1.1989 -<span id="L1162" rel="#L1162">1162</span>
  1.1990 -<span id="L1163" rel="#L1163">1163</span>
  1.1991 -<span id="L1164" rel="#L1164">1164</span>
  1.1992 -<span id="L1165" rel="#L1165">1165</span>
  1.1993 -<span id="L1166" rel="#L1166">1166</span>
  1.1994 -<span id="L1167" rel="#L1167">1167</span>
  1.1995 -<span id="L1168" rel="#L1168">1168</span>
  1.1996 -<span id="L1169" rel="#L1169">1169</span>
  1.1997 -<span id="L1170" rel="#L1170">1170</span>
  1.1998 -<span id="L1171" rel="#L1171">1171</span>
  1.1999 -<span id="L1172" rel="#L1172">1172</span>
  1.2000 -<span id="L1173" rel="#L1173">1173</span>
  1.2001 -<span id="L1174" rel="#L1174">1174</span>
  1.2002 -<span id="L1175" rel="#L1175">1175</span>
  1.2003 -<span id="L1176" rel="#L1176">1176</span>
  1.2004 -<span id="L1177" rel="#L1177">1177</span>
  1.2005 -<span id="L1178" rel="#L1178">1178</span>
  1.2006 -<span id="L1179" rel="#L1179">1179</span>
  1.2007 -<span id="L1180" rel="#L1180">1180</span>
  1.2008 -<span id="L1181" rel="#L1181">1181</span>
  1.2009 -<span id="L1182" rel="#L1182">1182</span>
  1.2010 -<span id="L1183" rel="#L1183">1183</span>
  1.2011 -<span id="L1184" rel="#L1184">1184</span>
  1.2012 -<span id="L1185" rel="#L1185">1185</span>
  1.2013 -<span id="L1186" rel="#L1186">1186</span>
  1.2014 -<span id="L1187" rel="#L1187">1187</span>
  1.2015 -<span id="L1188" rel="#L1188">1188</span>
  1.2016 -<span id="L1189" rel="#L1189">1189</span>
  1.2017 -<span id="L1190" rel="#L1190">1190</span>
  1.2018 -<span id="L1191" rel="#L1191">1191</span>
  1.2019 -<span id="L1192" rel="#L1192">1192</span>
  1.2020 -<span id="L1193" rel="#L1193">1193</span>
  1.2021 -<span id="L1194" rel="#L1194">1194</span>
  1.2022 -<span id="L1195" rel="#L1195">1195</span>
  1.2023 -<span id="L1196" rel="#L1196">1196</span>
  1.2024 -<span id="L1197" rel="#L1197">1197</span>
  1.2025 -<span id="L1198" rel="#L1198">1198</span>
  1.2026 -<span id="L1199" rel="#L1199">1199</span>
  1.2027 -<span id="L1200" rel="#L1200">1200</span>
  1.2028 -<span id="L1201" rel="#L1201">1201</span>
  1.2029 -<span id="L1202" rel="#L1202">1202</span>
  1.2030 -<span id="L1203" rel="#L1203">1203</span>
  1.2031 -<span id="L1204" rel="#L1204">1204</span>
  1.2032 -<span id="L1205" rel="#L1205">1205</span>
  1.2033 -<span id="L1206" rel="#L1206">1206</span>
  1.2034 -<span id="L1207" rel="#L1207">1207</span>
  1.2035 -<span id="L1208" rel="#L1208">1208</span>
  1.2036 -<span id="L1209" rel="#L1209">1209</span>
  1.2037 -<span id="L1210" rel="#L1210">1210</span>
  1.2038 -<span id="L1211" rel="#L1211">1211</span>
  1.2039 -<span id="L1212" rel="#L1212">1212</span>
  1.2040 -<span id="L1213" rel="#L1213">1213</span>
  1.2041 -<span id="L1214" rel="#L1214">1214</span>
  1.2042 -<span id="L1215" rel="#L1215">1215</span>
  1.2043 -<span id="L1216" rel="#L1216">1216</span>
  1.2044 -<span id="L1217" rel="#L1217">1217</span>
  1.2045 -<span id="L1218" rel="#L1218">1218</span>
  1.2046 -<span id="L1219" rel="#L1219">1219</span>
  1.2047 -<span id="L1220" rel="#L1220">1220</span>
  1.2048 -<span id="L1221" rel="#L1221">1221</span>
  1.2049 -<span id="L1222" rel="#L1222">1222</span>
  1.2050 -<span id="L1223" rel="#L1223">1223</span>
  1.2051 -<span id="L1224" rel="#L1224">1224</span>
  1.2052 -<span id="L1225" rel="#L1225">1225</span>
  1.2053 -<span id="L1226" rel="#L1226">1226</span>
  1.2054 -<span id="L1227" rel="#L1227">1227</span>
  1.2055 -<span id="L1228" rel="#L1228">1228</span>
  1.2056 -<span id="L1229" rel="#L1229">1229</span>
  1.2057 -<span id="L1230" rel="#L1230">1230</span>
  1.2058 -<span id="L1231" rel="#L1231">1231</span>
  1.2059 -<span id="L1232" rel="#L1232">1232</span>
  1.2060 -<span id="L1233" rel="#L1233">1233</span>
  1.2061 -<span id="L1234" rel="#L1234">1234</span>
  1.2062 -<span id="L1235" rel="#L1235">1235</span>
  1.2063 -<span id="L1236" rel="#L1236">1236</span>
  1.2064 -<span id="L1237" rel="#L1237">1237</span>
  1.2065 -<span id="L1238" rel="#L1238">1238</span>
  1.2066 -<span id="L1239" rel="#L1239">1239</span>
  1.2067 -<span id="L1240" rel="#L1240">1240</span>
  1.2068 -<span id="L1241" rel="#L1241">1241</span>
  1.2069 -<span id="L1242" rel="#L1242">1242</span>
  1.2070 -<span id="L1243" rel="#L1243">1243</span>
  1.2071 -<span id="L1244" rel="#L1244">1244</span>
  1.2072 -<span id="L1245" rel="#L1245">1245</span>
  1.2073 -<span id="L1246" rel="#L1246">1246</span>
  1.2074 -<span id="L1247" rel="#L1247">1247</span>
  1.2075 -<span id="L1248" rel="#L1248">1248</span>
  1.2076 -<span id="L1249" rel="#L1249">1249</span>
  1.2077 -<span id="L1250" rel="#L1250">1250</span>
  1.2078 -<span id="L1251" rel="#L1251">1251</span>
  1.2079 -<span id="L1252" rel="#L1252">1252</span>
  1.2080 -<span id="L1253" rel="#L1253">1253</span>
  1.2081 -<span id="L1254" rel="#L1254">1254</span>
  1.2082 -<span id="L1255" rel="#L1255">1255</span>
  1.2083 -<span id="L1256" rel="#L1256">1256</span>
  1.2084 -<span id="L1257" rel="#L1257">1257</span>
  1.2085 -<span id="L1258" rel="#L1258">1258</span>
  1.2086 -<span id="L1259" rel="#L1259">1259</span>
  1.2087 -<span id="L1260" rel="#L1260">1260</span>
  1.2088 -<span id="L1261" rel="#L1261">1261</span>
  1.2089 -<span id="L1262" rel="#L1262">1262</span>
  1.2090 -<span id="L1263" rel="#L1263">1263</span>
  1.2091 -<span id="L1264" rel="#L1264">1264</span>
  1.2092 -<span id="L1265" rel="#L1265">1265</span>
  1.2093 -<span id="L1266" rel="#L1266">1266</span>
  1.2094 -<span id="L1267" rel="#L1267">1267</span>
  1.2095 -<span id="L1268" rel="#L1268">1268</span>
  1.2096 -<span id="L1269" rel="#L1269">1269</span>
  1.2097 -<span id="L1270" rel="#L1270">1270</span>
  1.2098 -<span id="L1271" rel="#L1271">1271</span>
  1.2099 -<span id="L1272" rel="#L1272">1272</span>
  1.2100 -<span id="L1273" rel="#L1273">1273</span>
  1.2101 -<span id="L1274" rel="#L1274">1274</span>
  1.2102 -<span id="L1275" rel="#L1275">1275</span>
  1.2103 -<span id="L1276" rel="#L1276">1276</span>
  1.2104 -<span id="L1277" rel="#L1277">1277</span>
  1.2105 -<span id="L1278" rel="#L1278">1278</span>
  1.2106 -<span id="L1279" rel="#L1279">1279</span>
  1.2107 -<span id="L1280" rel="#L1280">1280</span>
  1.2108 -<span id="L1281" rel="#L1281">1281</span>
  1.2109 -<span id="L1282" rel="#L1282">1282</span>
  1.2110 -<span id="L1283" rel="#L1283">1283</span>
  1.2111 -<span id="L1284" rel="#L1284">1284</span>
  1.2112 -<span id="L1285" rel="#L1285">1285</span>
  1.2113 -<span id="L1286" rel="#L1286">1286</span>
  1.2114 -<span id="L1287" rel="#L1287">1287</span>
  1.2115 -<span id="L1288" rel="#L1288">1288</span>
  1.2116 -<span id="L1289" rel="#L1289">1289</span>
  1.2117 -<span id="L1290" rel="#L1290">1290</span>
  1.2118 -<span id="L1291" rel="#L1291">1291</span>
  1.2119 -<span id="L1292" rel="#L1292">1292</span>
  1.2120 -<span id="L1293" rel="#L1293">1293</span>
  1.2121 -<span id="L1294" rel="#L1294">1294</span>
  1.2122 -<span id="L1295" rel="#L1295">1295</span>
  1.2123 -<span id="L1296" rel="#L1296">1296</span>
  1.2124 -<span id="L1297" rel="#L1297">1297</span>
  1.2125 -<span id="L1298" rel="#L1298">1298</span>
  1.2126 -<span id="L1299" rel="#L1299">1299</span>
  1.2127 -<span id="L1300" rel="#L1300">1300</span>
  1.2128 -<span id="L1301" rel="#L1301">1301</span>
  1.2129 -<span id="L1302" rel="#L1302">1302</span>
  1.2130 -<span id="L1303" rel="#L1303">1303</span>
  1.2131 -<span id="L1304" rel="#L1304">1304</span>
  1.2132 -<span id="L1305" rel="#L1305">1305</span>
  1.2133 -<span id="L1306" rel="#L1306">1306</span>
  1.2134 -<span id="L1307" rel="#L1307">1307</span>
  1.2135 -<span id="L1308" rel="#L1308">1308</span>
  1.2136 -<span id="L1309" rel="#L1309">1309</span>
  1.2137 -<span id="L1310" rel="#L1310">1310</span>
  1.2138 -<span id="L1311" rel="#L1311">1311</span>
  1.2139 -<span id="L1312" rel="#L1312">1312</span>
  1.2140 -<span id="L1313" rel="#L1313">1313</span>
  1.2141 -<span id="L1314" rel="#L1314">1314</span>
  1.2142 -<span id="L1315" rel="#L1315">1315</span>
  1.2143 -<span id="L1316" rel="#L1316">1316</span>
  1.2144 -<span id="L1317" rel="#L1317">1317</span>
  1.2145 -<span id="L1318" rel="#L1318">1318</span>
  1.2146 -<span id="L1319" rel="#L1319">1319</span>
  1.2147 -<span id="L1320" rel="#L1320">1320</span>
  1.2148 -<span id="L1321" rel="#L1321">1321</span>
  1.2149 -<span id="L1322" rel="#L1322">1322</span>
  1.2150 -<span id="L1323" rel="#L1323">1323</span>
  1.2151 -<span id="L1324" rel="#L1324">1324</span>
  1.2152 -<span id="L1325" rel="#L1325">1325</span>
  1.2153 -<span id="L1326" rel="#L1326">1326</span>
  1.2154 -<span id="L1327" rel="#L1327">1327</span>
  1.2155 -<span id="L1328" rel="#L1328">1328</span>
  1.2156 -<span id="L1329" rel="#L1329">1329</span>
  1.2157 -<span id="L1330" rel="#L1330">1330</span>
  1.2158 -<span id="L1331" rel="#L1331">1331</span>
  1.2159 -<span id="L1332" rel="#L1332">1332</span>
  1.2160 -<span id="L1333" rel="#L1333">1333</span>
  1.2161 -<span id="L1334" rel="#L1334">1334</span>
  1.2162 -<span id="L1335" rel="#L1335">1335</span>
  1.2163 -<span id="L1336" rel="#L1336">1336</span>
  1.2164 -<span id="L1337" rel="#L1337">1337</span>
  1.2165 -<span id="L1338" rel="#L1338">1338</span>
  1.2166 -<span id="L1339" rel="#L1339">1339</span>
  1.2167 -<span id="L1340" rel="#L1340">1340</span>
  1.2168 -<span id="L1341" rel="#L1341">1341</span>
  1.2169 -<span id="L1342" rel="#L1342">1342</span>
  1.2170 -<span id="L1343" rel="#L1343">1343</span>
  1.2171 -<span id="L1344" rel="#L1344">1344</span>
  1.2172 -<span id="L1345" rel="#L1345">1345</span>
  1.2173 -<span id="L1346" rel="#L1346">1346</span>
  1.2174 -<span id="L1347" rel="#L1347">1347</span>
  1.2175 -<span id="L1348" rel="#L1348">1348</span>
  1.2176 -<span id="L1349" rel="#L1349">1349</span>
  1.2177 -<span id="L1350" rel="#L1350">1350</span>
  1.2178 -<span id="L1351" rel="#L1351">1351</span>
  1.2179 -<span id="L1352" rel="#L1352">1352</span>
  1.2180 -<span id="L1353" rel="#L1353">1353</span>
  1.2181 -<span id="L1354" rel="#L1354">1354</span>
  1.2182 -<span id="L1355" rel="#L1355">1355</span>
  1.2183 -<span id="L1356" rel="#L1356">1356</span>
  1.2184 -<span id="L1357" rel="#L1357">1357</span>
  1.2185 -<span id="L1358" rel="#L1358">1358</span>
  1.2186 -<span id="L1359" rel="#L1359">1359</span>
  1.2187 -<span id="L1360" rel="#L1360">1360</span>
  1.2188 -<span id="L1361" rel="#L1361">1361</span>
  1.2189 -<span id="L1362" rel="#L1362">1362</span>
  1.2190 -<span id="L1363" rel="#L1363">1363</span>
  1.2191 -<span id="L1364" rel="#L1364">1364</span>
  1.2192 -<span id="L1365" rel="#L1365">1365</span>
  1.2193 -<span id="L1366" rel="#L1366">1366</span>
  1.2194 -<span id="L1367" rel="#L1367">1367</span>
  1.2195 -<span id="L1368" rel="#L1368">1368</span>
  1.2196 -<span id="L1369" rel="#L1369">1369</span>
  1.2197 -<span id="L1370" rel="#L1370">1370</span>
  1.2198 -<span id="L1371" rel="#L1371">1371</span>
  1.2199 -<span id="L1372" rel="#L1372">1372</span>
  1.2200 -<span id="L1373" rel="#L1373">1373</span>
  1.2201 -<span id="L1374" rel="#L1374">1374</span>
  1.2202 -<span id="L1375" rel="#L1375">1375</span>
  1.2203 -<span id="L1376" rel="#L1376">1376</span>
  1.2204 -<span id="L1377" rel="#L1377">1377</span>
  1.2205 -<span id="L1378" rel="#L1378">1378</span>
  1.2206 -<span id="L1379" rel="#L1379">1379</span>
  1.2207 -<span id="L1380" rel="#L1380">1380</span>
  1.2208 -<span id="L1381" rel="#L1381">1381</span>
  1.2209 -<span id="L1382" rel="#L1382">1382</span>
  1.2210 -<span id="L1383" rel="#L1383">1383</span>
  1.2211 -<span id="L1384" rel="#L1384">1384</span>
  1.2212 -<span id="L1385" rel="#L1385">1385</span>
  1.2213 -<span id="L1386" rel="#L1386">1386</span>
  1.2214 -<span id="L1387" rel="#L1387">1387</span>
  1.2215 -<span id="L1388" rel="#L1388">1388</span>
  1.2216 -<span id="L1389" rel="#L1389">1389</span>
  1.2217 -<span id="L1390" rel="#L1390">1390</span>
  1.2218 -<span id="L1391" rel="#L1391">1391</span>
  1.2219 -<span id="L1392" rel="#L1392">1392</span>
  1.2220 -<span id="L1393" rel="#L1393">1393</span>
  1.2221 -<span id="L1394" rel="#L1394">1394</span>
  1.2222 -<span id="L1395" rel="#L1395">1395</span>
  1.2223 -<span id="L1396" rel="#L1396">1396</span>
  1.2224 -<span id="L1397" rel="#L1397">1397</span>
  1.2225 -<span id="L1398" rel="#L1398">1398</span>
  1.2226 -<span id="L1399" rel="#L1399">1399</span>
  1.2227 -<span id="L1400" rel="#L1400">1400</span>
  1.2228 -<span id="L1401" rel="#L1401">1401</span>
  1.2229 -<span id="L1402" rel="#L1402">1402</span>
  1.2230 -<span id="L1403" rel="#L1403">1403</span>
  1.2231 -<span id="L1404" rel="#L1404">1404</span>
  1.2232 -<span id="L1405" rel="#L1405">1405</span>
  1.2233 -<span id="L1406" rel="#L1406">1406</span>
  1.2234 -<span id="L1407" rel="#L1407">1407</span>
  1.2235 -<span id="L1408" rel="#L1408">1408</span>
  1.2236 -<span id="L1409" rel="#L1409">1409</span>
  1.2237 -<span id="L1410" rel="#L1410">1410</span>
  1.2238 -<span id="L1411" rel="#L1411">1411</span>
  1.2239 -<span id="L1412" rel="#L1412">1412</span>
  1.2240 -<span id="L1413" rel="#L1413">1413</span>
  1.2241 -<span id="L1414" rel="#L1414">1414</span>
  1.2242 -<span id="L1415" rel="#L1415">1415</span>
  1.2243 -<span id="L1416" rel="#L1416">1416</span>
  1.2244 -<span id="L1417" rel="#L1417">1417</span>
  1.2245 -<span id="L1418" rel="#L1418">1418</span>
  1.2246 -<span id="L1419" rel="#L1419">1419</span>
  1.2247 -<span id="L1420" rel="#L1420">1420</span>
  1.2248 -<span id="L1421" rel="#L1421">1421</span>
  1.2249 -<span id="L1422" rel="#L1422">1422</span>
  1.2250 -<span id="L1423" rel="#L1423">1423</span>
  1.2251 -<span id="L1424" rel="#L1424">1424</span>
  1.2252 -<span id="L1425" rel="#L1425">1425</span>
  1.2253 -<span id="L1426" rel="#L1426">1426</span>
  1.2254 -<span id="L1427" rel="#L1427">1427</span>
  1.2255 -<span id="L1428" rel="#L1428">1428</span>
  1.2256 -<span id="L1429" rel="#L1429">1429</span>
  1.2257 -<span id="L1430" rel="#L1430">1430</span>
  1.2258 -<span id="L1431" rel="#L1431">1431</span>
  1.2259 -<span id="L1432" rel="#L1432">1432</span>
  1.2260 -<span id="L1433" rel="#L1433">1433</span>
  1.2261 -<span id="L1434" rel="#L1434">1434</span>
  1.2262 -<span id="L1435" rel="#L1435">1435</span>
  1.2263 -<span id="L1436" rel="#L1436">1436</span>
  1.2264 -<span id="L1437" rel="#L1437">1437</span>
  1.2265 -<span id="L1438" rel="#L1438">1438</span>
  1.2266 -<span id="L1439" rel="#L1439">1439</span>
  1.2267 -<span id="L1440" rel="#L1440">1440</span>
  1.2268 -<span id="L1441" rel="#L1441">1441</span>
  1.2269 -<span id="L1442" rel="#L1442">1442</span>
  1.2270 -<span id="L1443" rel="#L1443">1443</span>
  1.2271 -<span id="L1444" rel="#L1444">1444</span>
  1.2272 -<span id="L1445" rel="#L1445">1445</span>
  1.2273 -<span id="L1446" rel="#L1446">1446</span>
  1.2274 -<span id="L1447" rel="#L1447">1447</span>
  1.2275 -<span id="L1448" rel="#L1448">1448</span>
  1.2276 -<span id="L1449" rel="#L1449">1449</span>
  1.2277 -<span id="L1450" rel="#L1450">1450</span>
  1.2278 -<span id="L1451" rel="#L1451">1451</span>
  1.2279 -<span id="L1452" rel="#L1452">1452</span>
  1.2280 -<span id="L1453" rel="#L1453">1453</span>
  1.2281 -<span id="L1454" rel="#L1454">1454</span>
  1.2282 -<span id="L1455" rel="#L1455">1455</span>
  1.2283 -<span id="L1456" rel="#L1456">1456</span>
  1.2284 -<span id="L1457" rel="#L1457">1457</span>
  1.2285 -<span id="L1458" rel="#L1458">1458</span>
  1.2286 -<span id="L1459" rel="#L1459">1459</span>
  1.2287 -<span id="L1460" rel="#L1460">1460</span>
  1.2288 -<span id="L1461" rel="#L1461">1461</span>
  1.2289 -<span id="L1462" rel="#L1462">1462</span>
  1.2290 -<span id="L1463" rel="#L1463">1463</span>
  1.2291 -<span id="L1464" rel="#L1464">1464</span>
  1.2292 -<span id="L1465" rel="#L1465">1465</span>
  1.2293 -<span id="L1466" rel="#L1466">1466</span>
  1.2294 -<span id="L1467" rel="#L1467">1467</span>
  1.2295 -<span id="L1468" rel="#L1468">1468</span>
  1.2296 -<span id="L1469" rel="#L1469">1469</span>
  1.2297 -<span id="L1470" rel="#L1470">1470</span>
  1.2298 -<span id="L1471" rel="#L1471">1471</span>
  1.2299 -<span id="L1472" rel="#L1472">1472</span>
  1.2300 -<span id="L1473" rel="#L1473">1473</span>
  1.2301 -<span id="L1474" rel="#L1474">1474</span>
  1.2302 -<span id="L1475" rel="#L1475">1475</span>
  1.2303 -<span id="L1476" rel="#L1476">1476</span>
  1.2304 -<span id="L1477" rel="#L1477">1477</span>
  1.2305 -<span id="L1478" rel="#L1478">1478</span>
  1.2306 -<span id="L1479" rel="#L1479">1479</span>
  1.2307 -<span id="L1480" rel="#L1480">1480</span>
  1.2308 -<span id="L1481" rel="#L1481">1481</span>
  1.2309 -<span id="L1482" rel="#L1482">1482</span>
  1.2310 -<span id="L1483" rel="#L1483">1483</span>
  1.2311 -<span id="L1484" rel="#L1484">1484</span>
  1.2312 -<span id="L1485" rel="#L1485">1485</span>
  1.2313 -<span id="L1486" rel="#L1486">1486</span>
  1.2314 -<span id="L1487" rel="#L1487">1487</span>
  1.2315 -<span id="L1488" rel="#L1488">1488</span>
  1.2316 -<span id="L1489" rel="#L1489">1489</span>
  1.2317 -<span id="L1490" rel="#L1490">1490</span>
  1.2318 -<span id="L1491" rel="#L1491">1491</span>
  1.2319 -<span id="L1492" rel="#L1492">1492</span>
  1.2320 -<span id="L1493" rel="#L1493">1493</span>
  1.2321 -<span id="L1494" rel="#L1494">1494</span>
  1.2322 -<span id="L1495" rel="#L1495">1495</span>
  1.2323 -<span id="L1496" rel="#L1496">1496</span>
  1.2324 -<span id="L1497" rel="#L1497">1497</span>
  1.2325 -<span id="L1498" rel="#L1498">1498</span>
  1.2326 -<span id="L1499" rel="#L1499">1499</span>
  1.2327 -<span id="L1500" rel="#L1500">1500</span>
  1.2328 -<span id="L1501" rel="#L1501">1501</span>
  1.2329 -<span id="L1502" rel="#L1502">1502</span>
  1.2330 -<span id="L1503" rel="#L1503">1503</span>
  1.2331 -<span id="L1504" rel="#L1504">1504</span>
  1.2332 -<span id="L1505" rel="#L1505">1505</span>
  1.2333 -<span id="L1506" rel="#L1506">1506</span>
  1.2334 -<span id="L1507" rel="#L1507">1507</span>
  1.2335 -<span id="L1508" rel="#L1508">1508</span>
  1.2336 -<span id="L1509" rel="#L1509">1509</span>
  1.2337 -<span id="L1510" rel="#L1510">1510</span>
  1.2338 -<span id="L1511" rel="#L1511">1511</span>
  1.2339 -<span id="L1512" rel="#L1512">1512</span>
  1.2340 -<span id="L1513" rel="#L1513">1513</span>
  1.2341 -<span id="L1514" rel="#L1514">1514</span>
  1.2342 -<span id="L1515" rel="#L1515">1515</span>
  1.2343 -<span id="L1516" rel="#L1516">1516</span>
  1.2344 -<span id="L1517" rel="#L1517">1517</span>
  1.2345 -<span id="L1518" rel="#L1518">1518</span>
  1.2346 -<span id="L1519" rel="#L1519">1519</span>
  1.2347 -<span id="L1520" rel="#L1520">1520</span>
  1.2348 -<span id="L1521" rel="#L1521">1521</span>
  1.2349 -<span id="L1522" rel="#L1522">1522</span>
  1.2350 -<span id="L1523" rel="#L1523">1523</span>
  1.2351 -<span id="L1524" rel="#L1524">1524</span>
  1.2352 -<span id="L1525" rel="#L1525">1525</span>
  1.2353 -<span id="L1526" rel="#L1526">1526</span>
  1.2354 -<span id="L1527" rel="#L1527">1527</span>
  1.2355 -<span id="L1528" rel="#L1528">1528</span>
  1.2356 -<span id="L1529" rel="#L1529">1529</span>
  1.2357 -<span id="L1530" rel="#L1530">1530</span>
  1.2358 -<span id="L1531" rel="#L1531">1531</span>
  1.2359 -<span id="L1532" rel="#L1532">1532</span>
  1.2360 -<span id="L1533" rel="#L1533">1533</span>
  1.2361 -<span id="L1534" rel="#L1534">1534</span>
  1.2362 -<span id="L1535" rel="#L1535">1535</span>
  1.2363 -<span id="L1536" rel="#L1536">1536</span>
  1.2364 -<span id="L1537" rel="#L1537">1537</span>
  1.2365 -<span id="L1538" rel="#L1538">1538</span>
  1.2366 -<span id="L1539" rel="#L1539">1539</span>
  1.2367 -<span id="L1540" rel="#L1540">1540</span>
  1.2368 -<span id="L1541" rel="#L1541">1541</span>
  1.2369 -<span id="L1542" rel="#L1542">1542</span>
  1.2370 -<span id="L1543" rel="#L1543">1543</span>
  1.2371 -<span id="L1544" rel="#L1544">1544</span>
  1.2372 -<span id="L1545" rel="#L1545">1545</span>
  1.2373 -<span id="L1546" rel="#L1546">1546</span>
  1.2374 -<span id="L1547" rel="#L1547">1547</span>
  1.2375 -<span id="L1548" rel="#L1548">1548</span>
  1.2376 -<span id="L1549" rel="#L1549">1549</span>
  1.2377 -<span id="L1550" rel="#L1550">1550</span>
  1.2378 -<span id="L1551" rel="#L1551">1551</span>
  1.2379 -<span id="L1552" rel="#L1552">1552</span>
  1.2380 -<span id="L1553" rel="#L1553">1553</span>
  1.2381 -<span id="L1554" rel="#L1554">1554</span>
  1.2382 -<span id="L1555" rel="#L1555">1555</span>
  1.2383 -<span id="L1556" rel="#L1556">1556</span>
  1.2384 -<span id="L1557" rel="#L1557">1557</span>
  1.2385 -<span id="L1558" rel="#L1558">1558</span>
  1.2386 -<span id="L1559" rel="#L1559">1559</span>
  1.2387 -<span id="L1560" rel="#L1560">1560</span>
  1.2388 -<span id="L1561" rel="#L1561">1561</span>
  1.2389 -<span id="L1562" rel="#L1562">1562</span>
  1.2390 -<span id="L1563" rel="#L1563">1563</span>
  1.2391 -<span id="L1564" rel="#L1564">1564</span>
  1.2392 -<span id="L1565" rel="#L1565">1565</span>
  1.2393 -<span id="L1566" rel="#L1566">1566</span>
  1.2394 -<span id="L1567" rel="#L1567">1567</span>
  1.2395 -<span id="L1568" rel="#L1568">1568</span>
  1.2396 -<span id="L1569" rel="#L1569">1569</span>
  1.2397 -<span id="L1570" rel="#L1570">1570</span>
  1.2398 -<span id="L1571" rel="#L1571">1571</span>
  1.2399 -<span id="L1572" rel="#L1572">1572</span>
  1.2400 -<span id="L1573" rel="#L1573">1573</span>
  1.2401 -<span id="L1574" rel="#L1574">1574</span>
  1.2402 -<span id="L1575" rel="#L1575">1575</span>
  1.2403 -<span id="L1576" rel="#L1576">1576</span>
  1.2404 -<span id="L1577" rel="#L1577">1577</span>
  1.2405 -<span id="L1578" rel="#L1578">1578</span>
  1.2406 -<span id="L1579" rel="#L1579">1579</span>
  1.2407 -<span id="L1580" rel="#L1580">1580</span>
  1.2408 -<span id="L1581" rel="#L1581">1581</span>
  1.2409 -<span id="L1582" rel="#L1582">1582</span>
  1.2410 -<span id="L1583" rel="#L1583">1583</span>
  1.2411 -<span id="L1584" rel="#L1584">1584</span>
  1.2412 -<span id="L1585" rel="#L1585">1585</span>
  1.2413 -<span id="L1586" rel="#L1586">1586</span>
  1.2414 -<span id="L1587" rel="#L1587">1587</span>
  1.2415 -<span id="L1588" rel="#L1588">1588</span>
  1.2416 -<span id="L1589" rel="#L1589">1589</span>
  1.2417 -<span id="L1590" rel="#L1590">1590</span>
  1.2418 -<span id="L1591" rel="#L1591">1591</span>
  1.2419 -<span id="L1592" rel="#L1592">1592</span>
  1.2420 -<span id="L1593" rel="#L1593">1593</span>
  1.2421 -<span id="L1594" rel="#L1594">1594</span>
  1.2422 -<span id="L1595" rel="#L1595">1595</span>
  1.2423 -<span id="L1596" rel="#L1596">1596</span>
  1.2424 -<span id="L1597" rel="#L1597">1597</span>
  1.2425 -<span id="L1598" rel="#L1598">1598</span>
  1.2426 -<span id="L1599" rel="#L1599">1599</span>
  1.2427 -<span id="L1600" rel="#L1600">1600</span>
  1.2428 -<span id="L1601" rel="#L1601">1601</span>
  1.2429 -<span id="L1602" rel="#L1602">1602</span>
  1.2430 -<span id="L1603" rel="#L1603">1603</span>
  1.2431 -<span id="L1604" rel="#L1604">1604</span>
  1.2432 -<span id="L1605" rel="#L1605">1605</span>
  1.2433 -<span id="L1606" rel="#L1606">1606</span>
  1.2434 -<span id="L1607" rel="#L1607">1607</span>
  1.2435 -<span id="L1608" rel="#L1608">1608</span>
  1.2436 -<span id="L1609" rel="#L1609">1609</span>
  1.2437 -<span id="L1610" rel="#L1610">1610</span>
  1.2438 -<span id="L1611" rel="#L1611">1611</span>
  1.2439 -<span id="L1612" rel="#L1612">1612</span>
  1.2440 -<span id="L1613" rel="#L1613">1613</span>
  1.2441 -<span id="L1614" rel="#L1614">1614</span>
  1.2442 -<span id="L1615" rel="#L1615">1615</span>
  1.2443 -<span id="L1616" rel="#L1616">1616</span>
  1.2444 -<span id="L1617" rel="#L1617">1617</span>
  1.2445 -<span id="L1618" rel="#L1618">1618</span>
  1.2446 -<span id="L1619" rel="#L1619">1619</span>
  1.2447 -<span id="L1620" rel="#L1620">1620</span>
  1.2448 -<span id="L1621" rel="#L1621">1621</span>
  1.2449 -<span id="L1622" rel="#L1622">1622</span>
  1.2450 -<span id="L1623" rel="#L1623">1623</span>
  1.2451 -<span id="L1624" rel="#L1624">1624</span>
  1.2452 -<span id="L1625" rel="#L1625">1625</span>
  1.2453 -<span id="L1626" rel="#L1626">1626</span>
  1.2454 -<span id="L1627" rel="#L1627">1627</span>
  1.2455 -<span id="L1628" rel="#L1628">1628</span>
  1.2456 -<span id="L1629" rel="#L1629">1629</span>
  1.2457 -<span id="L1630" rel="#L1630">1630</span>
  1.2458 -<span id="L1631" rel="#L1631">1631</span>
  1.2459 -<span id="L1632" rel="#L1632">1632</span>
  1.2460 -<span id="L1633" rel="#L1633">1633</span>
  1.2461 -<span id="L1634" rel="#L1634">1634</span>
  1.2462 -<span id="L1635" rel="#L1635">1635</span>
  1.2463 -<span id="L1636" rel="#L1636">1636</span>
  1.2464 -<span id="L1637" rel="#L1637">1637</span>
  1.2465 -<span id="L1638" rel="#L1638">1638</span>
  1.2466 -<span id="L1639" rel="#L1639">1639</span>
  1.2467 -<span id="L1640" rel="#L1640">1640</span>
  1.2468 -<span id="L1641" rel="#L1641">1641</span>
  1.2469 -<span id="L1642" rel="#L1642">1642</span>
  1.2470 -<span id="L1643" rel="#L1643">1643</span>
  1.2471 -<span id="L1644" rel="#L1644">1644</span>
  1.2472 -<span id="L1645" rel="#L1645">1645</span>
  1.2473 -<span id="L1646" rel="#L1646">1646</span>
  1.2474 -<span id="L1647" rel="#L1647">1647</span>
  1.2475 -<span id="L1648" rel="#L1648">1648</span>
  1.2476 -<span id="L1649" rel="#L1649">1649</span>
  1.2477 -<span id="L1650" rel="#L1650">1650</span>
  1.2478 -<span id="L1651" rel="#L1651">1651</span>
  1.2479 -<span id="L1652" rel="#L1652">1652</span>
  1.2480 -<span id="L1653" rel="#L1653">1653</span>
  1.2481 -<span id="L1654" rel="#L1654">1654</span>
  1.2482 -<span id="L1655" rel="#L1655">1655</span>
  1.2483 -<span id="L1656" rel="#L1656">1656</span>
  1.2484 -<span id="L1657" rel="#L1657">1657</span>
  1.2485 -<span id="L1658" rel="#L1658">1658</span>
  1.2486 -<span id="L1659" rel="#L1659">1659</span>
  1.2487 -<span id="L1660" rel="#L1660">1660</span>
  1.2488 -<span id="L1661" rel="#L1661">1661</span>
  1.2489 -<span id="L1662" rel="#L1662">1662</span>
  1.2490 -<span id="L1663" rel="#L1663">1663</span>
  1.2491 -<span id="L1664" rel="#L1664">1664</span>
  1.2492 -<span id="L1665" rel="#L1665">1665</span>
  1.2493 -</pre>
  1.2494 -          </td>
  1.2495 -          <td width="100%">
  1.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>
  1.2497 -          </td>
  1.2498 -        </tr>
  1.2499 -      </table>
  1.2500 -  </div>
  1.2501 +;; private functions
  1.2502  
  1.2503 -          </div>
  1.2504 -        </div>
  1.2505 +(defun lua-prefix-key-update-bindings ()
  1.2506 +  (let (old-cons)
  1.2507 +    (if (eq lua-prefix-mode-map (keymap-parent lua-mode-map))
  1.2508 +        ;; if prefix-map is a parent, delete the parent
  1.2509 +        (set-keymap-parent lua-mode-map nil)
  1.2510 +      ;; otherwise, look for it among children
  1.2511 +      (if (setq old-cons (rassoc lua-prefix-mode-map lua-mode-map))
  1.2512 +          (delq old-cons lua-mode-map)))
  1.2513  
  1.2514 -        <a href="#jump-to-line" rel="facebox" data-hotkey="l" class="js-jump-to-line" style="display:none">Jump to Line</a>
  1.2515 -        <div id="jump-to-line" style="display:none">
  1.2516 -          <h2>Jump to Line</h2>
  1.2517 -          <form accept-charset="UTF-8" class="js-jump-to-line-form">
  1.2518 -            <input class="textfield js-jump-to-line-field" type="text">
  1.2519 -            <div class="full-button">
  1.2520 -              <button type="submit" class="button">Go</button>
  1.2521 -            </div>
  1.2522 -          </form>
  1.2523 -        </div>
  1.2524 +    (if (null lua-prefix-key)
  1.2525 +        (set-keymap-parent lua-mode-map lua-prefix-mode-map)
  1.2526 +      (define-key lua-mode-map (vector lua-prefix-key) lua-prefix-mode-map))))
  1.2527  
  1.2528 -      </div>
  1.2529 -    </div>
  1.2530 -</div>
  1.2531 +(defun lua-set-prefix-key (new-key-str)
  1.2532 +  "Changes `lua-prefix-key' properly and updates keymaps
  1.2533  
  1.2534 -<div id="js-frame-loading-template" class="frame frame-loading large-loading-area" style="display:none;">
  1.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">
  1.2536 -</div>
  1.2537 +This function replaces previous prefix-key binding with a new one."
  1.2538 +  (interactive "sNew prefix key (empty string means no key): ")
  1.2539 +  (lua--customize-set-prefix-key 'lua-prefix-key new-key-str)
  1.2540 +  (lua-prefix-key-update-bindings))
  1.2541  
  1.2542 +(defun lua-string-p (&optional pos)
  1.2543 +  "Returns true if the point is in a string."
  1.2544 +  (save-excursion (elt (syntax-ppss pos) 3)))
  1.2545  
  1.2546 -        </div>
  1.2547 -      </div>
  1.2548 -      <div class="context-overlay"></div>
  1.2549 -    </div>
  1.2550 +(defun lua-comment-p (&optional pos)
  1.2551 +  "Returns true if the point is in a comment."
  1.2552 +  (save-excursion (elt (syntax-ppss pos) 4)))
  1.2553  
  1.2554 -      <div id="footer-push"></div><!-- hack for sticky footer -->
  1.2555 -    </div><!-- end of wrapper - hack for sticky footer -->
  1.2556 +(defun lua-comment-or-string-p (&optional pos)
  1.2557 +  "Returns true if the point is in a comment or string."
  1.2558 +  (save-excursion (let ((parse-result (syntax-ppss pos)))
  1.2559 +                    (or (elt parse-result 3) (elt parse-result 4)))))
  1.2560  
  1.2561 -      <!-- footer -->
  1.2562 -      <div id="footer">
  1.2563 -  <div class="container clearfix">
  1.2564 +(defun lua-comment-or-string-start (&optional pos)
  1.2565 +  "Returns start position of string or comment which contains point.
  1.2566  
  1.2567 -      <dl class="footer_nav">
  1.2568 -        <dt>GitHub</dt>
  1.2569 -        <dd><a href="https://github.com/about">About us</a></dd>
  1.2570 -        <dd><a href="https://github.com/blog">Blog</a></dd>
  1.2571 -        <dd><a href="https://github.com/contact">Contact &amp; support</a></dd>
  1.2572 -        <dd><a href="http://enterprise.github.com/">GitHub Enterprise</a></dd>
  1.2573 -        <dd><a href="http://status.github.com/">Site status</a></dd>
  1.2574 -      </dl>
  1.2575 +If point is not inside string or comment, return nil."
  1.2576 +  (save-excursion (elt (syntax-ppss pos) 8)))
  1.2577  
  1.2578 -      <dl class="footer_nav">
  1.2579 -        <dt>Applications</dt>
  1.2580 -        <dd><a href="http://mac.github.com/">GitHub for Mac</a></dd>
  1.2581 -        <dd><a href="http://windows.github.com/">GitHub for Windows</a></dd>
  1.2582 -        <dd><a href="http://eclipse.github.com/">GitHub for Eclipse</a></dd>
  1.2583 -        <dd><a href="http://mobile.github.com/">GitHub mobile apps</a></dd>
  1.2584 -      </dl>
  1.2585 +(defun lua-indent-line ()
  1.2586 +  "Indent current line for Lua mode.
  1.2587 +Return the amount the indentation changed by."
  1.2588 +  (let (indent
  1.2589 +        (case-fold-search nil)
  1.2590 +        ;; save point as a distance to eob - it's invariant w.r.t indentation
  1.2591 +        (pos (- (point-max) (point))))
  1.2592 +    (back-to-indentation)
  1.2593 +    (if (lua-comment-or-string-p)
  1.2594 +        (setq indent (lua-calculate-string-or-comment-indentation)) ;; just restore point position
  1.2595 +      (setq indent (max 0 (lua-calculate-indentation nil))))
  1.2596  
  1.2597 -      <dl class="footer_nav">
  1.2598 -        <dt>Services</dt>
  1.2599 -        <dd><a href="http://get.gaug.es/">Gauges: Web analytics</a></dd>
  1.2600 -        <dd><a href="http://speakerdeck.com">Speaker Deck: Presentations</a></dd>
  1.2601 -        <dd><a href="https://gist.github.com">Gist: Code snippets</a></dd>
  1.2602 -        <dd><a href="http://jobs.github.com/">Job board</a></dd>
  1.2603 -      </dl>
  1.2604 +    (when (not (equal indent (current-column)))
  1.2605 +      (delete-region (line-beginning-position) (point))
  1.2606 +      (indent-to indent))
  1.2607  
  1.2608 -      <dl class="footer_nav">
  1.2609 -        <dt>Documentation</dt>
  1.2610 -        <dd><a href="http://help.github.com/">GitHub Help</a></dd>
  1.2611 -        <dd><a href="http://developer.github.com/">Developer API</a></dd>
  1.2612 -        <dd><a href="http://github.github.com/github-flavored-markdown/">GitHub Flavored Markdown</a></dd>
  1.2613 -        <dd><a href="http://pages.github.com/">GitHub Pages</a></dd>
  1.2614 -      </dl>
  1.2615 +    ;; If initial point was within line's indentation,
  1.2616 +    ;; position after the indentation.  Else stay at same point in text.
  1.2617 +    (if (> (- (point-max) pos) (point))
  1.2618 +        (goto-char (- (point-max) pos)))
  1.2619  
  1.2620 -      <dl class="footer_nav">
  1.2621 -        <dt>More</dt>
  1.2622 -        <dd><a href="http://training.github.com/">Training</a></dd>
  1.2623 -        <dd><a href="https://github.com/edu">Students &amp; teachers</a></dd>
  1.2624 -        <dd><a href="http://shop.github.com">The Shop</a></dd>
  1.2625 -        <dd><a href="/plans">Plans &amp; pricing</a></dd>
  1.2626 -        <dd><a href="http://octodex.github.com/">The Octodex</a></dd>
  1.2627 -      </dl>
  1.2628 +    indent))
  1.2629  
  1.2630 -      <hr class="footer-divider">
  1.2631 +(defun lua-calculate-string-or-comment-indentation ()
  1.2632 +  "This function should be run when point at (current-indentation) is inside string"
  1.2633 +  (if (and (lua-string-p) (not lua-indent-string-contents))
  1.2634 +      ;; if inside string and strings aren't to be indented, return current indentation
  1.2635 +      (current-indentation)
  1.2636 +    ;; Otherwise, indent as a comment
  1.2637 +    (save-excursion
  1.2638 +      (cond
  1.2639 +       ;; If it is the end of a multi-line comment, simply mirror the opening
  1.2640 +       ;; line's indent.
  1.2641 +       ((looking-at "\\s *\\(?:--\\)?\\]\\(?1:=*\\)\\]")
  1.2642 +        (re-search-backward (format "\\[%s\\["
  1.2643 +                                    (or (match-string-no-properties 1) ""))
  1.2644 +                            (lua-get-multiline-start)
  1.2645 +                            'noerror)
  1.2646 +        (current-indentation))
  1.2647 +       ;; otherwise indent by lua-indent-level relative to the line where literal starts
  1.2648 +       (t
  1.2649 +        (goto-char (lua-get-multiline-start))
  1.2650 +        (+ (current-indentation) lua-indent-level))))))
  1.2651  
  1.2652 +(defun lua-find-regexp (direction regexp &optional limit ignore-p)
  1.2653 +  "Searches for a regular expression in the direction specified.
  1.2654 +Direction is one of 'forward and 'backward.
  1.2655 +By default, matches in comments and strings are ignored, but what to ignore is
  1.2656 +configurable by specifying ignore-p. If the regexp is found, returns point
  1.2657 +position, nil otherwise.
  1.2658 +ignore-p returns true if the match at the current point position should be
  1.2659 +ignored, nil otherwise."
  1.2660 +  (let ((ignore-func (or ignore-p 'lua-comment-or-string-p))
  1.2661 +        (search-func (if (eq direction 'forward)
  1.2662 +                         're-search-forward 're-search-backward))
  1.2663 +        (case-fold-search nil))
  1.2664 +    (catch 'found
  1.2665 +      (while (funcall search-func regexp limit t)
  1.2666 +        (if (and (not (funcall ignore-func (match-beginning 0)))
  1.2667 +                 (not (funcall ignore-func (match-end 0))))
  1.2668 +            (throw 'found (point)))))))
  1.2669  
  1.2670 -    <p class="right">&copy; 2013 <span title="0.34901s from fe19.rs.github.com">GitHub</span> Inc. All rights reserved.</p>
  1.2671 -    <a class="left" href="https://github.com/">
  1.2672 -      <span class="mega-icon mega-icon-invertocat"></span>
  1.2673 -    </a>
  1.2674 -    <ul id="legal">
  1.2675 -        <li><a href="https://github.com/site/terms">Terms of Service</a></li>
  1.2676 -        <li><a href="https://github.com/site/privacy">Privacy</a></li>
  1.2677 -        <li><a href="https://github.com/security">Security</a></li>
  1.2678 -    </ul>
  1.2679 +(defconst lua-block-regexp
  1.2680 +  (eval-when-compile
  1.2681 +    (concat
  1.2682 +     "\\(\\_<"
  1.2683 +     (regexp-opt '("do" "function" "repeat" "then"
  1.2684 +                   "else" "elseif" "end" "until") t)
  1.2685 +     "\\_>\\)\\|"
  1.2686 +     (regexp-opt '("{" "(" "[" "]" ")" "}") t))))
  1.2687  
  1.2688 -  </div><!-- /.container -->
  1.2689 +(defconst lua-block-token-alist
  1.2690 +  '(("do"       "\\<end\\>"   "\\<for\\|while\\>"                       middle-or-open)
  1.2691 +    ("function" "\\<end\\>"   nil                                       open)
  1.2692 +    ("repeat"   "\\<until\\>" nil                                       open)
  1.2693 +    ("then"     "\\<\\(e\\(lse\\(if\\)?\\|nd\\)\\)\\>" "\\<\\(else\\)?if\\>" middle)
  1.2694 +    ("{"        "}"           nil                                       open)
  1.2695 +    ("["        "]"           nil                                       open)
  1.2696 +    ("("        ")"           nil                                       open)
  1.2697 +    ("if"       "\\<then\\>"  nil                                       open)
  1.2698 +    ("for"      "\\<do\\>"    nil                                       open)
  1.2699 +    ("while"    "\\<do\\>"    nil                                       open)
  1.2700 +    ("else"     "\\<end\\>"   "\\<then\\>"                              middle)
  1.2701 +    ("elseif"   "\\<then\\>"  "\\<then\\>"                              middle)
  1.2702 +    ("end"      nil           "\\<\\(do\\|function\\|then\\|else\\)\\>" close)
  1.2703 +    ("until"    nil           "\\<repeat\\>"                            close)
  1.2704 +    ("}"        nil           "{"                                       close)
  1.2705 +    ("]"        nil           "\\["                                     close)
  1.2706 +    (")"        nil           "("                                       close))
  1.2707 +  "This is a list of block token information blocks.
  1.2708 +Each token information entry is of the form:
  1.2709 +  KEYWORD FORWARD-MATCH-REGEXP BACKWARDS-MATCH-REGEXP TOKEN-TYPE
  1.2710 +KEYWORD is the token.
  1.2711 +FORWARD-MATCH-REGEXP is a regexp that matches all possble tokens when going forward.
  1.2712 +BACKWARDS-MATCH-REGEXP is a regexp that matches all possble tokens when going backwards.
  1.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.")
  1.2714  
  1.2715 -</div><!-- /.#footer -->
  1.2716 +(defconst lua-indentation-modifier-regexp
  1.2717 +  ;; The absence of else is deliberate, since it does not modify the
  1.2718 +  ;; indentation level per se. It only may cause the line, in which the
  1.2719 +  ;; else is, to be shifted to the left.
  1.2720 +  (concat
  1.2721 +   "\\(\\_<"
  1.2722 +   (regexp-opt '("do" "function" "repeat" "then" "if" "else" "elseif" "for" "while") t)
  1.2723 +   "\\_>\\|"
  1.2724 +   (regexp-opt '("{" "(" "["))
  1.2725 +   "\\)\\|\\(\\_<"
  1.2726 +   (regexp-opt '("end" "until") t)
  1.2727 +   "\\_>\\|"
  1.2728 +   (regexp-opt '("]" ")" "}"))
  1.2729 +   "\\)")
  1.2730 +  )
  1.2731  
  1.2732 +(defun lua-get-block-token-info (token)
  1.2733 +  "Returns the block token info entry for TOKEN from lua-block-token-alist"
  1.2734 +  (assoc token lua-block-token-alist))
  1.2735  
  1.2736 -    <div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">
  1.2737 -  <div class="fullscreen-container js-fullscreen-container">
  1.2738 -    <div class="textarea-wrap">
  1.2739 -      <textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea>
  1.2740 -          <div class="suggester-container">
  1.2741 -              <div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester"
  1.2742 -                 data-url="/immerrr/lua-mode/suggestions/commit/e6a46ee34362b5090748643d4b2bef1f849ea0a8">
  1.2743 -              </div>
  1.2744 -          </div>
  1.2745 -    </div>
  1.2746 -  </div>
  1.2747 -  <div class="fullscreen-sidebar">
  1.2748 -    <a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode">
  1.2749 -      <span class="mega-icon mega-icon-normalscreen"></span>
  1.2750 -    </a>
  1.2751 -    <a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards"
  1.2752 -      title="Switch themes">
  1.2753 -      <span class="mini-icon mini-icon-brightness"></span>
  1.2754 -    </a>
  1.2755 -  </div>
  1.2756 -</div>
  1.2757 +(defun lua-get-token-match-re (token-info direction)
  1.2758 +  "Returns the relevant match regexp from token info"
  1.2759 +  (cond
  1.2760 +   ((eq direction 'forward) (cadr token-info))
  1.2761 +   ((eq direction 'backward) (caddr token-info))
  1.2762 +   (t nil)))
  1.2763  
  1.2764 +(defun lua-get-token-type (token-info)
  1.2765 +  "Returns the relevant match regexp from token info"
  1.2766 +   (cadddr token-info))
  1.2767  
  1.2768 +(defun lua-backwards-to-block-begin-or-end ()
  1.2769 +  "Move backwards to nearest block begin or end.  Returns nil if not successful."
  1.2770 +  (interactive)
  1.2771 +  (lua-find-regexp 'backward lua-block-regexp))
  1.2772  
  1.2773 -    <div id="ajax-error-message" class="flash flash-error">
  1.2774 -      <span class="mini-icon mini-icon-exclamation"></span>
  1.2775 -      Something went wrong with that request. Please try again.
  1.2776 -      <a href="#" class="mini-icon mini-icon-remove-close ajax-error-dismiss"></a>
  1.2777 -    </div>
  1.2778 +(defun lua-find-matching-token-word (token search-start &optional direction)
  1.2779 +  (let* ((token-info (lua-get-block-token-info token))
  1.2780 +         (match-type (lua-get-token-type token-info))
  1.2781 +         ;; If we are on a middle token, go backwards. If it is a middle or open,
  1.2782 +         ;; go forwards
  1.2783 +         (search-direction (or direction
  1.2784 +                               (if (or (eq match-type 'open)
  1.2785 +                                       (eq match-type 'middle-or-open))
  1.2786 +                                   'forward
  1.2787 +                                 'backward)
  1.2788 +                               'backward))
  1.2789 +         (match (lua-get-token-match-re token-info search-direction))
  1.2790 +         maybe-found-pos)
  1.2791 +    ;; if we are searching forward from the token at the current point
  1.2792 +    ;; (i.e. for a closing token), need to step one character forward
  1.2793 +    ;; first, or the regexp will match the opening token.
  1.2794 +    (if (eq search-direction 'forward) (forward-char 1))
  1.2795 +    (if search-start (goto-char search-start))
  1.2796 +    (catch 'found
  1.2797 +      ;; If we are attempting to find a matching token for a terminating token
  1.2798 +      ;; (i.e. a token that starts a statement when searching back, or a token
  1.2799 +      ;; that ends a statement when searching forward), then we don't need to look
  1.2800 +      ;; any further.
  1.2801 +      (if (or (and (eq search-direction 'forward)
  1.2802 +                   (eq match-type 'close))
  1.2803 +              (and (eq search-direction 'backward)
  1.2804 +                   (eq match-type 'open)))
  1.2805 +          (throw 'found nil))
  1.2806 +      (while (lua-find-regexp search-direction lua-indentation-modifier-regexp)
  1.2807 +        ;; have we found a valid matching token?
  1.2808 +        (let ((found-token (match-string 0))
  1.2809 +              (found-pos (match-beginning 0)))
  1.2810 +          (let ((found-type (lua-get-token-type
  1.2811 +                             (lua-get-block-token-info found-token))))
  1.2812 +            (if (not (and match (string-match match found-token)))
  1.2813 +                ;; no - then there is a nested block. If we were looking for
  1.2814 +                ;; a block begin token, found-token must be a block end
  1.2815 +                ;; token; likewise, if we were looking for a block end token,
  1.2816 +                ;; found-token must be a block begin token, otherwise there
  1.2817 +                ;; is a grammatical error in the code.
  1.2818 +                (if (not (and
  1.2819 +                          (or (eq match-type 'middle)
  1.2820 +                              (eq found-type 'middle)
  1.2821 +                              (eq match-type 'middle-or-open)
  1.2822 +                              (eq found-type 'middle-or-open)
  1.2823 +                              (eq match-type found-type))
  1.2824 +                          (lua-find-matching-token-word found-token nil
  1.2825 +                                                        search-direction)))
  1.2826 +                    (when maybe-found-pos
  1.2827 +                      (goto-char maybe-found-pos)
  1.2828 +                      (throw 'found maybe-found-pos)))
  1.2829 +              ;; yes.
  1.2830 +              ;; if it is a not a middle kind, report the location
  1.2831 +              (when (not (or (eq found-type 'middle)
  1.2832 +                             (eq found-type 'middle-or-open)))
  1.2833 +                (throw 'found found-pos))
  1.2834 +              ;; if it is a middle-or-open type, record location, but keep searching.
  1.2835 +              ;; If we fail to complete the search, we'll report the location
  1.2836 +              (when (eq found-type 'middle-or-open)
  1.2837 +                (setq maybe-found-pos found-pos))
  1.2838 +              ;; Cannot use tail recursion. too much nesting on long chains of
  1.2839 +              ;; if/elseif. Will reset variables instead.
  1.2840 +              (setq token found-token)
  1.2841 +              (setq token-info (lua-get-block-token-info token))
  1.2842 +              (setq match (lua-get-token-match-re token-info search-direction))
  1.2843 +              (setq match-type (lua-get-token-type token-info))))))
  1.2844 +      maybe-found-pos)))
  1.2845  
  1.2846 -    
  1.2847 -    
  1.2848 -    <span id='server_response_time' data-time='0.34954' data-host='fe19'></span>
  1.2849 -    
  1.2850 -  </body>
  1.2851 -</html>
  1.2852 +(defun lua-goto-matching-block-token (&optional search-start parse-start direction)
  1.2853 +  "Find block begion/end token matching the one at the point.
  1.2854 +This function moves the point to the token that matches the one
  1.2855 +at the current point. Returns the point position of the first character of
  1.2856 +the matching token if successful, nil otherwise."
  1.2857 +  (if parse-start (goto-char parse-start))
  1.2858 +  (let ((case-fold-search nil))
  1.2859 +    (if (looking-at lua-indentation-modifier-regexp)
  1.2860 +        (let ((position (lua-find-matching-token-word (match-string 0)
  1.2861 +                                                      search-start direction)))
  1.2862 +          (and position
  1.2863 +               (goto-char position))))))
  1.2864  
  1.2865 +(defun lua-goto-matching-block (&optional noreport)
  1.2866 +  "Go to the keyword balancing the one under the point.
  1.2867 +If the point is on a keyword/brace that starts a block, go to the
  1.2868 +matching keyword that ends the block, and vice versa."
  1.2869 +  (interactive)
  1.2870 +  ;; search backward to the beginning of the keyword if necessary
  1.2871 +  (if (eq (char-syntax (following-char)) ?w)
  1.2872 +      (re-search-backward "\\_<" nil t))
  1.2873 +  (let ((position (lua-goto-matching-block-token)))
  1.2874 +    (if (and (not position)
  1.2875 +             (not noreport))
  1.2876 +        (error "Not on a block control keyword or brace")
  1.2877 +      position)))
  1.2878 +
  1.2879 +(defun lua-forward-line-skip-blanks (&optional back)
  1.2880 +  "Move 1 line forward (back if BACK is non-nil) skipping blank lines.
  1.2881 +
  1.2882 +Moves point 1 line forward (or backward) skipping lines that contain
  1.2883 +no Lua code besides comments. The point is put to the beginning of
  1.2884 +the line.
  1.2885 +
  1.2886 +Returns final value of point as integer or nil if operation failed."
  1.2887 +  (catch 'found
  1.2888 +    (while t
  1.2889 +      (unless (eql (forward-line (if back -1 1)) 0)    ;; 0 means success
  1.2890 +        (throw 'found nil))
  1.2891 +      (unless (or (looking-at "\\s *\\(--.*\\)?$")
  1.2892 +                  (lua-comment-or-string-p))
  1.2893 +        (throw 'found (point))))))
  1.2894 +
  1.2895 +(eval-when-compile
  1.2896 +  (defconst lua-operator-class
  1.2897 +    "-+*/^.=<>~"))
  1.2898 +
  1.2899 +(defconst lua-cont-eol-regexp
  1.2900 +  (eval-when-compile
  1.2901 +    (concat
  1.2902 +     "\\(\\_<"
  1.2903 +     (regexp-opt '("and" "or" "not" "in" "for" "while"
  1.2904 +                   "local" "function" "if" "until" "elseif" "return") t)
  1.2905 +     "\\_>\\|"
  1.2906 +     "\\(^\\|[^" lua-operator-class "]\\)"
  1.2907 +     (regexp-opt '("+" "-" "*" "/" "^" ".." "==" "=" "<" ">" "<=" ">=" "~=") t)
  1.2908 +     "\\)"
  1.2909 +     "\\s *\\=")
  1.2910 +    )
  1.2911 +  "Regexp that matches the ending of a line that needs continuation
  1.2912 +
  1.2913 +This regexp starts from eol and looks for a binary operator or an unclosed
  1.2914 +block intro (i.e. 'for' without 'do' or 'if' without 'then') followed by
  1.2915 +an optional whitespace till the end of the line.")
  1.2916 +
  1.2917 +(defconst lua-cont-bol-regexp
  1.2918 +  (eval-when-compile
  1.2919 +    (concat
  1.2920 +     "\\=\\s *"
  1.2921 +     "\\(\\_<"
  1.2922 +     (regexp-opt '("and" "or" "not") t)
  1.2923 +     "\\_>\\|"
  1.2924 +     (regexp-opt '("+" "-" "*" "/" "^" ".." "==" "=" "<" ">" "<=" ">=" "~=") t)
  1.2925 +     "\\($\\|[^" lua-operator-class "]\\)"
  1.2926 +     "\\)")
  1.2927 +
  1.2928 +    )
  1.2929 +  "Regexp that matches a line that continues previous one
  1.2930 +
  1.2931 +This regexp means, starting from point there is an optional whitespace followed
  1.2932 +by Lua binary operator. Lua is very liberal when it comes to continuation line,
  1.2933 +so we're safe to assume that every line that starts with a binop continues
  1.2934 +previous one even though it looked like an end-of-statement.")
  1.2935 +
  1.2936 +(defun lua-last-token-continues-p ()
  1.2937 +  "Returns true if the last token on this line is a continuation token."
  1.2938 +  (let ((line-begin (line-beginning-position))
  1.2939 +        (line-end (line-end-position)))
  1.2940 +    (save-excursion
  1.2941 +      (end-of-line)
  1.2942 +      ;; we need to check whether the line ends in a comment and
  1.2943 +      ;; skip that one.
  1.2944 +      (while (lua-find-regexp 'backward "-" line-begin 'lua-string-p)
  1.2945 +        (if (looking-at "--")
  1.2946 +            (setq line-end (point))))
  1.2947 +      (goto-char line-end)
  1.2948 +      (re-search-backward lua-cont-eol-regexp line-begin t))))
  1.2949 +
  1.2950 +(defun lua-first-token-continues-p ()
  1.2951 +  "Returns true if the first token on this line is a continuation token."
  1.2952 +  (let ((line-end (line-end-position)))
  1.2953 +    (save-excursion
  1.2954 +      (beginning-of-line)
  1.2955 +      ;; if first character of the line is inside string, it's a continuation
  1.2956 +      ;; if strings aren't supposed to be indented, `lua-calculate-indentation' won't even let
  1.2957 +      ;; the control inside this function
  1.2958 +      (re-search-forward lua-cont-bol-regexp line-end t))))
  1.2959 +
  1.2960 +(defun lua-is-continuing-statement-p (&optional parse-start)
  1.2961 +  "Return non-nil if the line continues a statement.
  1.2962 +More specifically, return the point in the line that is continued.
  1.2963 +The criteria for a continuing statement are:
  1.2964 +
  1.2965 +* the last token of the previous line is a continuing op,
  1.2966 +  OR the first token of the current line is a continuing op
  1.2967 +
  1.2968 +"
  1.2969 +  (let ((prev-line nil))
  1.2970 +    (save-excursion
  1.2971 +      (if parse-start (goto-char parse-start))
  1.2972 +      (save-excursion (setq prev-line (lua-forward-line-skip-blanks 'back)))
  1.2973 +      (and prev-line
  1.2974 +           (or (lua-first-token-continues-p)
  1.2975 +               (and (goto-char prev-line)
  1.2976 +                    ;; check last token of previous nonblank line
  1.2977 +                    (lua-last-token-continues-p)))))))
  1.2978 +
  1.2979 +(defun lua-make-indentation-info-pair (found-token found-pos)
  1.2980 +  "This is a helper function to lua-calculate-indentation-info. Don't
  1.2981 +use standalone."
  1.2982 +  (cond
  1.2983 +   ;; function is a bit tricky to indent right. They can appear in a lot ot
  1.2984 +   ;; different contexts. Until I find a shortcut, I'll leave it with a simple
  1.2985 +   ;; relative indentation.
  1.2986 +   ;; The special cases are for indenting according to the location of the
  1.2987 +   ;; function. i.e.:
  1.2988 +   ;;       (cons 'absolute (+ (current-column) lua-indent-level))
  1.2989 +   ;; TODO: Fix this. It causes really ugly indentations for in-line functions.
  1.2990 +   ((string-equal found-token "function")
  1.2991 +    (cons 'relative lua-indent-level))
  1.2992 +
  1.2993 +   ;; block openers
  1.2994 +   ((member found-token (list "{" "(" "["))
  1.2995 +	 (save-excursion
  1.2996 +	   ;; expression follows -> indent at start of next expression
  1.2997 +       ;; Last token on the line -> simple relative indent
  1.2998 +	   (if (and (not (search-forward-regexp "[[:space:]]--" (line-end-position) t))
  1.2999 +                (search-forward-regexp "[^[:space:]]" (line-end-position) t))
  1.3000 +           (cons 'absolute (1- (current-column)))
  1.3001 +         (cons 'relative lua-indent-level))))
  1.3002 +
  1.3003 +   ;; These are not really block starters. They should not add to indentation.
  1.3004 +   ;; The corresponding "then" and "do" handle the indentation.
  1.3005 +   ((member found-token (list "if" "for" "while"))
  1.3006 +    (cons 'relative 0))
  1.3007 +   ;; closing tokens follow: These are usually taken care of by
  1.3008 +   ;; lua-calculate-indentation-override.
  1.3009 +   ;; elseif is a bit of a hack. It is not handled separately, but it needs to
  1.3010 +   ;; nullify a previous then if on the same line.
  1.3011 +   ((member found-token (list "until" "elseif"))
  1.3012 +    (save-excursion
  1.3013 +      (let ((line (line-number-at-pos)))
  1.3014 +        (if (and (lua-goto-matching-block-token nil found-pos 'backward)
  1.3015 +                 (= line (line-number-at-pos)))
  1.3016 +            (cons 'remove-matching 0)
  1.3017 +          (cons 'relative 0)))))
  1.3018 +
  1.3019 +   ;; else is a special case; if its matching block token is on the same line,
  1.3020 +   ;; instead of removing the matching token, it has to replace it, so that
  1.3021 +   ;; either the next line will be indented correctly, or the end on the same
  1.3022 +   ;; line will remove the effect of the else.
  1.3023 +   ((string-equal found-token "else")
  1.3024 +     (save-excursion
  1.3025 +       (let ((line (line-number-at-pos)))
  1.3026 +         (if (and (lua-goto-matching-block-token nil found-pos 'backward)
  1.3027 +                  (= line (line-number-at-pos)))
  1.3028 +             (cons 'replace-matching (cons 'relative lua-indent-level))
  1.3029 +                   (cons 'relative lua-indent-level)))))
  1.3030 +
  1.3031 +   ;; Block closers. If they are on the same line as their openers, they simply
  1.3032 +   ;; eat up the matching indentation modifier. Otherwise, they pull
  1.3033 +   ;; indentation back to the matching block opener.
  1.3034 +   ((member found-token (list ")" "}" "]" "end"))
  1.3035 +    (save-excursion
  1.3036 +      (let ((line (line-number-at-pos)))
  1.3037 +        (lua-goto-matching-block-token nil found-pos 'backward)
  1.3038 +        (if (/= line (line-number-at-pos))
  1.3039 +            (cons 'absolute
  1.3040 +                  (+ (current-indentation)
  1.3041 +                     (lua-calculate-indentation-block-modifier
  1.3042 +                      nil (point))))
  1.3043 +          (cons 'remove-matching 0)))))
  1.3044 +
  1.3045 +   ;; Everything else. This is from the original code: If opening a block
  1.3046 +   ;; (match-data 1 exists), then push indentation one level up, if it is
  1.3047 +   ;; closing a block, pull it one level down.
  1.3048 +   ('other-indentation-modifier
  1.3049 +    (cons 'relative (if (nth 2 (match-data))
  1.3050 +                        ;; beginning of a block matched
  1.3051 +                        lua-indent-level
  1.3052 +                      ;; end of a block matched
  1.3053 +                      (- lua-indent-level))))))
  1.3054 +
  1.3055 +(defun  lua-add-indentation-info-pair (pair info)
  1.3056 +  "Add the given indentation info pair to the list of indentation information.
  1.3057 +This function has special case handling for two tokens: remove-matching,
  1.3058 +and replace-matching. These two tokens are cleanup tokens that remove or
  1.3059 +alter the effect of a previously recorded indentation info.
  1.3060 +
  1.3061 +When a remove-matching token is encountered, the last recorded info, i.e.
  1.3062 +the car of the list is removed. This is used to roll-back an indentation of a
  1.3063 +block opening statement when it is closed.
  1.3064 +
  1.3065 +When a replace-matching token is seen, the last recorded info is removed,
  1.3066 +and the cdr of the replace-matching info is added in its place. This is used
  1.3067 +when a middle-of the block (the only case is 'else') is seen on the same line
  1.3068 +the block is opened."
  1.3069 +  (cond
  1.3070 +   ( (eq 'remove-matching (car pair))
  1.3071 +     ; Remove head of list
  1.3072 +     (cdr info))
  1.3073 +   ( (eq 'replace-matching (car pair))
  1.3074 +     ; remove head of list, and add the cdr of pair instead
  1.3075 +     (cons (cdr pair) (cdr info)))
  1.3076 +   ( t
  1.3077 +     ; Just add the pair
  1.3078 +     (cons pair info))))
  1.3079 +
  1.3080 +(defun lua-calculate-indentation-info (&optional parse-start parse-end)
  1.3081 +  "For each block token on the line, computes how it affects the indentation.
  1.3082 +The effect of each token can be either a shift relative to the current
  1.3083 +indentation level, or indentation to some absolute column. This information
  1.3084 +is collected in a list of indentation info pairs, which denote absolute
  1.3085 +and relative each, and the shift/column to indent to."
  1.3086 +  (let ((combined-line-end (line-end-position))
  1.3087 +        (start-indentation (current-indentation)))
  1.3088 +    (save-excursion
  1.3089 +      (while (lua-last-token-continues-p)
  1.3090 +        (lua-forward-line-skip-blanks)
  1.3091 +        (setq combined-line-end (line-end-position))))
  1.3092 +    (let ((search-stop (if parse-end
  1.3093 +                           (min parse-end combined-line-end)
  1.3094 +                         combined-line-end))
  1.3095 +          (indentation-info nil))
  1.3096 +      (if parse-start (goto-char parse-start))
  1.3097 +      (save-excursion
  1.3098 +        (beginning-of-line)
  1.3099 +        (while (lua-find-regexp 'forward lua-indentation-modifier-regexp
  1.3100 +                                search-stop)
  1.3101 +          (let ((found-token (match-string 0))
  1.3102 +                (found-pos (match-beginning 0))
  1.3103 +                (found-end (match-end 0))
  1.3104 +                (data (match-data)))
  1.3105 +            (setq indentation-info
  1.3106 +		  (lua-add-indentation-info-pair
  1.3107 +		   (lua-make-indentation-info-pair found-token found-pos)
  1.3108 +		   indentation-info))))
  1.3109 +	(or indentation-info
  1.3110 +	    (list (cons 'absolute start-indentation)))))))
  1.3111 +
  1.3112 +(defun lua-accumulate-indentation-info (info)
  1.3113 +  "Accumulates the indentation information previously calculated by
  1.3114 +lua-calculate-indentation-info. Returns either the relative indentation
  1.3115 +shift, or the absolute column to indent to."
  1.3116 +  (let ((info-list (reverse info))
  1.3117 +        (type 'relative)
  1.3118 +        (accu 0))
  1.3119 +    (mapc (lambda (x)
  1.3120 +            (setq accu (if (eq 'absolute (car x))
  1.3121 +                           (progn (setq type 'absolute)
  1.3122 +                                  (cdr x))
  1.3123 +                         (+ accu (cdr x)))))
  1.3124 +          info-list)
  1.3125 +    (cons type accu)))
  1.3126 +
  1.3127 +(defun lua-calculate-indentation-block-modifier (&optional parse-start
  1.3128 +                                                           parse-end)
  1.3129 +  "Return amount by which this line modifies the indentation.
  1.3130 +Beginnings of blocks add lua-indent-level once each, and endings
  1.3131 +of blocks subtract lua-indent-level once each. This function is used
  1.3132 +to determine how the indentation of the following line relates to this
  1.3133 +one."
  1.3134 +  (if parse-start (goto-char parse-start))
  1.3135 +  ;; First go back to the line that starts it all
  1.3136 +  ;; lua-calculate-indentation-info will scan through the whole thing
  1.3137 +  (while (lua-is-continuing-statement-p)
  1.3138 +    (lua-forward-line-skip-blanks 'back))
  1.3139 +  (let ((case-fold-search nil)
  1.3140 +        (indentation-info (lua-accumulate-indentation-info
  1.3141 +                           (lua-calculate-indentation-info nil parse-end))))
  1.3142 +    (if (eq (car indentation-info) 'absolute)
  1.3143 +        (- (cdr indentation-info) (current-indentation))
  1.3144 +      (cdr indentation-info))))
  1.3145 +
  1.3146 +(defun lua-point-is-after-left-shifter-p ()
  1.3147 +  "Check if point is at a left-shifter.
  1.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:
  1.3149 +   local a = function()
  1.3150 +      ....
  1.3151 +   end
  1.3152 +   ^         ^
  1.3153 +   |         +- not here
  1.3154 +   +- Close here"
  1.3155 +  (save-excursion
  1.3156 +    (let ((old-point (point)))
  1.3157 +      (back-to-indentation)
  1.3158 +      (and
  1.3159 +       (or (looking-at "local\\s +\\(?:\\(?:\\sw\\|\\s_\\)+\\s *\\(,\\s *\\(?:\\sw\\|\\s_\\)+\\s *\\)*=\\s *\\)?")
  1.3160 +           ;; This is too generic, and will screw up a lot of indentations. Will need
  1.3161 +           ;; a better regexp for assignments
  1.3162 +           (looking-at "[^=]*=\\s *"))
  1.3163 +       (= old-point (match-end 0))))))
  1.3164 +
  1.3165 +(defun lua-calculate-indentation-override (&optional parse-start)
  1.3166 +  "Return overriding indentation amount for special cases.
  1.3167 +Look for an uninterrupted sequence of block-closing tokens that starts
  1.3168 +at the beginning of the line. For each of these tokens, shift indentation
  1.3169 +to the left by the amount specified in lua-indent-level."
  1.3170 +  (let ((indentation-modifier 0)
  1.3171 +        (case-fold-search nil)
  1.3172 +        (block-token nil))
  1.3173 +    (save-excursion
  1.3174 +      (if parse-start (goto-char parse-start))
  1.3175 +      ;; Look for the last block closing token
  1.3176 +      (back-to-indentation)
  1.3177 +      (if (and (not (lua-comment-or-string-p))
  1.3178 +               (looking-at lua-indentation-modifier-regexp)
  1.3179 +               (let ((token-info (lua-get-block-token-info (match-string 0))))
  1.3180 +                 (and token-info
  1.3181 +                      (not (eq 'open (lua-get-token-type token-info))))))
  1.3182 +          (when (lua-goto-matching-block-token nil nil 'backward)
  1.3183 +            ;; Exception cases: when the start of the line is an assignment,
  1.3184 +            ;; go to the start of the assignment instead of the matching item
  1.3185 +            (let ((block-start-column (current-column))
  1.3186 +                  (block-start-point (point)))
  1.3187 +              (if (lua-point-is-after-left-shifter-p)
  1.3188 +                  (current-indentation)
  1.3189 +                block-start-column)))))))
  1.3190 +
  1.3191 +(defun lua-calculate-indentation (&optional parse-start)
  1.3192 +  "Return appropriate indentation for current line as Lua code."
  1.3193 +  (save-excursion
  1.3194 +    (let ((continuing-p (lua-is-continuing-statement-p)))
  1.3195 +      (or
  1.3196 +       ;; when calculating indentation, do the following:
  1.3197 +       ;; 1. check, if the line starts with indentation-modifier (open/close brace)
  1.3198 +       ;;    and if it should be indented/unindented in special way
  1.3199 +       (lua-calculate-indentation-override)
  1.3200 +
  1.3201 +       ;; 2. otherwise, use indentation modifiers from previous line + it's own indentation
  1.3202 +       ;; 3. if previous line doesn't contain indentation modifiers, additionally check
  1.3203 +       ;;    if current line is a continuation line and add lua-indent-level if it is
  1.3204 +       (when (lua-forward-line-skip-blanks 'back)
  1.3205 +         ;; the order of function calls here is important. block modifier
  1.3206 +         ;; call may change the point to another line
  1.3207 +         (let ((modifier
  1.3208 +                (lua-calculate-indentation-block-modifier nil (line-end-position))))
  1.3209 +           (+ (if (and continuing-p (= 0 modifier))
  1.3210 +                  lua-indent-level
  1.3211 +                modifier)
  1.3212 +              (current-indentation))))
  1.3213 +
  1.3214 +       ;; 4. if there's no previous line, indentation is 0
  1.3215 +       0))))
  1.3216 +
  1.3217 +(defun lua-beginning-of-proc (&optional arg)
  1.3218 +  "Move backward to the beginning of a lua proc (or similar).
  1.3219 +With argument, do it that many times.  Negative arg -N
  1.3220 +means move forward to Nth following beginning of proc.
  1.3221 +Returns t unless search stops due to beginning or end of buffer."
  1.3222 +  (interactive "P")
  1.3223 +  (or arg
  1.3224 +      (setq arg 1))
  1.3225 +  (let ((found nil)
  1.3226 +        (ret t))
  1.3227 +    (while (< arg 0)
  1.3228 +      (if (re-search-forward "^function[ \t]" nil t)
  1.3229 +          (setq arg (1+ arg)
  1.3230 +                found t)
  1.3231 +        (setq ret nil
  1.3232 +              arg 0)))
  1.3233 +    (if found
  1.3234 +        (beginning-of-line))
  1.3235 +    (if (> arg 0)
  1.3236 +        (if (re-search-forward "^function[ \t]" nil t)
  1.3237 +            (setq arg (1+ arg))
  1.3238 +          (goto-char (point-max))))
  1.3239 +    (while (> arg 0)
  1.3240 +      (if (re-search-backward "^function[ \t]" nil t)
  1.3241 +          (setq arg (1- arg))
  1.3242 +        (setq ret nil
  1.3243 +              arg 0)))
  1.3244 +    ret))
  1.3245 +
  1.3246 +(defun lua-end-of-proc (&optional arg)
  1.3247 +  "Move forward to next end of lua proc (or similar).
  1.3248 +With argument, do it that many times.  Negative argument -N means move
  1.3249 +back to Nth preceding end of proc.
  1.3250 +
  1.3251 +This function just searches for a `end' at the beginning of a line."
  1.3252 +  (interactive "P")
  1.3253 +  (or arg
  1.3254 +      (setq arg 1))
  1.3255 +  (let ((found nil)
  1.3256 +        (ret t))
  1.3257 +    (if (and (< arg 0)
  1.3258 +             (not (bolp))
  1.3259 +             (save-excursion
  1.3260 +               (beginning-of-line)
  1.3261 +               (eq (following-char) ?})))
  1.3262 +        (forward-char -1))
  1.3263 +    (while (> arg 0)
  1.3264 +      (if (re-search-forward "^end" nil t)
  1.3265 +          (setq arg (1- arg)
  1.3266 +                found t)
  1.3267 +        (setq ret nil
  1.3268 +              arg 0)))
  1.3269 +    (while (< arg 0)
  1.3270 +      (if (re-search-backward "^end" nil t)
  1.3271 +          (setq arg (1+ arg)
  1.3272 +                found t)
  1.3273 +        (setq ret nil
  1.3274 +              arg 0)))
  1.3275 +    (if found
  1.3276 +        (progn
  1.3277 +          (beginning-of-line)
  1.3278 +          (forward-line)))
  1.3279 +    ret))
  1.3280 +
  1.3281 +(defun lua-start-process (&optional name program startfile &rest switches)
  1.3282 +  "Start a lua process named NAME, running PROGRAM.
  1.3283 +PROGRAM defaults to NAME, which defaults to `lua-default-application'.
  1.3284 +When called interactively, switch to the process buffer."
  1.3285 +  (interactive)
  1.3286 +  (or switches
  1.3287 +      (setq switches lua-default-command-switches))
  1.3288 +  (setq name (or name lua-default-application))
  1.3289 +  (setq program (or program name))
  1.3290 +  (setq lua-process-buffer (apply 'make-comint name program startfile switches))
  1.3291 +  (setq lua-process (get-buffer-process lua-process-buffer))
  1.3292 +  ;; wait for prompt
  1.3293 +  (with-current-buffer lua-process-buffer
  1.3294 +    (while (not (lua-prompt-line))
  1.3295 +      (accept-process-output (get-buffer-process (current-buffer)))
  1.3296 +      (goto-char (point-max))))
  1.3297 +  ;; when called interactively, switch to process buffer
  1.3298 +  (if (lua--called-interactively-p 'any)
  1.3299 +      (switch-to-buffer lua-process-buffer)))
  1.3300 +
  1.3301 +(defun lua-kill-process ()
  1.3302 +  "Kill lua subprocess and its buffer."
  1.3303 +  (interactive)
  1.3304 +  (if lua-process-buffer
  1.3305 +      (kill-buffer lua-process-buffer)))
  1.3306 +
  1.3307 +(defun lua-set-lua-region-start (&optional arg)
  1.3308 +  "Set start of region for use with `lua-send-lua-region'."
  1.3309 +  (interactive)
  1.3310 +  (set-marker lua-region-start (or arg (point))))
  1.3311 +
  1.3312 +(defun lua-set-lua-region-end (&optional arg)
  1.3313 +  "Set end of region for use with `lua-send-lua-region'."
  1.3314 +  (interactive)
  1.3315 +  (set-marker lua-region-end (or arg (point))))
  1.3316 +
  1.3317 +(defun lua-send-current-line ()
  1.3318 +  "Send current line to lua subprocess, found in `lua-process'.
  1.3319 +If `lua-process' is nil or dead, start a new process first."
  1.3320 +  (interactive)
  1.3321 +  (lua-send-region (line-beginning-position) (line-end-position)))
  1.3322 +
  1.3323 +(defun lua-send-region (start end)
  1.3324 +  "Send region to lua subprocess."
  1.3325 +  (interactive "r")
  1.3326 +  ;; make temporary lua file
  1.3327 +  (let ((tempfile (lua-make-temp-file "lua-"))
  1.3328 +        (last-prompt nil)
  1.3329 +        (prompt-found nil)
  1.3330 +        (lua-stdin-line-offset (count-lines (point-min) start))
  1.3331 +        (lua-stdin-buffer (current-buffer))
  1.3332 +        current-prompt )
  1.3333 +    (write-region start end tempfile)
  1.3334 +    (or (and lua-process
  1.3335 +             (comint-check-proc lua-process-buffer))
  1.3336 +        (lua-start-process lua-default-application))
  1.3337 +    ;; kill lua process without query
  1.3338 +    (if (fboundp 'process-kill-without-query)
  1.3339 +        (process-kill-without-query lua-process))
  1.3340 +    ;; send dofile(tempfile)
  1.3341 +    (with-current-buffer lua-process-buffer
  1.3342 +      (goto-char (point-max))
  1.3343 +      (setq last-prompt (point-max))
  1.3344 +      (comint-simple-send (get-buffer-process (current-buffer))
  1.3345 +                          (format "dofile(\"%s\")"
  1.3346 +                                  (replace-regexp-in-string "\\\\" "\\\\\\\\" tempfile)))
  1.3347 +      ;; wait for prompt
  1.3348 +      (while (not prompt-found)
  1.3349 +        (accept-process-output (get-buffer-process (current-buffer)))
  1.3350 +        (goto-char (point-max))
  1.3351 +        (setq prompt-found (and (lua-prompt-line) (< last-prompt (point-max)))))
  1.3352 +      ;; remove temp. lua file
  1.3353 +      (delete-file tempfile)
  1.3354 +      (lua-postprocess-output-buffer lua-process-buffer last-prompt lua-stdin-line-offset)
  1.3355 +      (if lua-always-show
  1.3356 +          (display-buffer lua-process-buffer)))))
  1.3357 +
  1.3358 +(defun lua-postprocess-output-buffer (buf start &optional lua-stdin-line-offset)
  1.3359 +  "Highlight tracebacks found in buf. If an traceback occurred return
  1.3360 +t, otherwise return nil.  BUF must exist."
  1.3361 +  (let ((lua-stdin-line-offset (or lua-stdin-line-offset 0))
  1.3362 +        line file bol err-p)
  1.3363 +    (with-current-buffer buf
  1.3364 +      (goto-char start)
  1.3365 +      (beginning-of-line)
  1.3366 +      (if (re-search-forward lua-traceback-line-re nil t)
  1.3367 +          (setq file (match-string 1)
  1.3368 +                line (string-to-number (match-string 2)))))
  1.3369 +    (when (and lua-jump-on-traceback line)
  1.3370 +      (beep)
  1.3371 +      ;; FIXME: highlight
  1.3372 +      (lua-jump-to-traceback file line lua-stdin-line-offset)
  1.3373 +      (setq err-p t))
  1.3374 +    err-p))
  1.3375 +
  1.3376 +(defun lua-jump-to-traceback (file line lua-stdin-line-offset)
  1.3377 +  "Jump to the Lua code in FILE at LINE."
  1.3378 +  ;; sanity check: temporary-file-directory
  1.3379 +  (if (string= (substring file 0 3)  "...")
  1.3380 +      (message "Lua traceback output truncated: customize 'temporary-file-directory' or increase 'LUA_IDSIZE' in 'luaconf.h'.")
  1.3381 +    (let ((buffer (cond ((or (string-equal file tempfile) (string-equal file "stdin"))
  1.3382 +                         (setq line (+ line lua-stdin-line-offset))
  1.3383 +                         lua-stdin-buffer)
  1.3384 +                        (t (find-file-noselect file)))))
  1.3385 +      (pop-to-buffer buffer)
  1.3386 +      ;; Force Lua mode
  1.3387 +      (if (not (eq major-mode 'lua-mode))
  1.3388 +          (lua-mode))
  1.3389 +      ;; FIXME: fix offset when executing region
  1.3390 +      (goto-char (point-min)) (forward-line (1- line))
  1.3391 +      (message "Jumping to error in file %s on line %d" file line))))
  1.3392 +
  1.3393 +(defun lua-prompt-line ()
  1.3394 +  (save-excursion
  1.3395 +    (save-match-data
  1.3396 +      (forward-line 0)
  1.3397 +      (if (looking-at comint-prompt-regexp)
  1.3398 +          (match-end 0)))))
  1.3399 +
  1.3400 +(defun lua-send-lua-region ()
  1.3401 +  "Send preset lua region to lua subprocess."
  1.3402 +  (interactive)
  1.3403 +  (or (and lua-region-start lua-region-end)
  1.3404 +      (error "lua-region not set"))
  1.3405 +  (or (and lua-process
  1.3406 +           (comint-check-proc lua-process-buffer))
  1.3407 +      (lua-start-process lua-default-application))
  1.3408 +  (comint-simple-send lua-process
  1.3409 +                      (buffer-substring lua-region-start lua-region-end)
  1.3410 +                      )
  1.3411 +  (if lua-always-show
  1.3412 +      (display-buffer lua-process-buffer)))
  1.3413 +
  1.3414 +(defun lua-send-proc ()
  1.3415 +  "Send proc around point to lua subprocess."
  1.3416 +  (interactive)
  1.3417 +  (let (beg end)
  1.3418 +    (save-excursion
  1.3419 +      (lua-beginning-of-proc)
  1.3420 +      (setq beg (point))
  1.3421 +      (lua-end-of-proc)
  1.3422 +      (setq end (point)))
  1.3423 +    (or (and lua-process
  1.3424 +             (comint-check-proc lua-process-buffer))
  1.3425 +        (lua-start-process lua-default-application))
  1.3426 +    (comint-simple-send lua-process
  1.3427 +                        (buffer-substring beg end))
  1.3428 +    (if lua-always-show
  1.3429 +        (display-buffer lua-process-buffer))))
  1.3430 +
  1.3431 +;; FIXME: This needs work... -Bret
  1.3432 +(defun lua-send-buffer ()
  1.3433 +  "Send whole buffer to lua subprocess."
  1.3434 +  (interactive)
  1.3435 +  (lua-send-region (point-min) (point-max)))
  1.3436 +
  1.3437 +(defun lua-restart-with-whole-file ()
  1.3438 +  "Restart lua subprocess and send whole file as input."
  1.3439 +  (interactive)
  1.3440 +  (lua-kill-process)
  1.3441 +  (lua-start-process lua-default-application)
  1.3442 +  (lua-send-buffer))
  1.3443 +
  1.3444 +(defun lua-show-process-buffer ()
  1.3445 +  "Make sure `lua-process-buffer' is being displayed."
  1.3446 +  (interactive)
  1.3447 +  (display-buffer lua-process-buffer))
  1.3448 +
  1.3449 +(defun lua-hide-process-buffer ()
  1.3450 +  "Delete all windows that display `lua-process-buffer'."
  1.3451 +  (interactive)
  1.3452 +  (delete-windows-on lua-process-buffer))
  1.3453 +
  1.3454 +(defun lua-search-documentation ()
  1.3455 +  "Search Lua documentation for the word at the point."
  1.3456 +  (interactive)
  1.3457 +  (browse-url (concat lua-search-url-prefix (current-word t))))
  1.3458 +
  1.3459 +(defun lua-toggle-electric-state (&optional arg)
  1.3460 +  "Toggle the electric indentation feature.
  1.3461 +Optional numeric ARG, if supplied, turns on electric indentation when
  1.3462 +positive, turns it off when negative, and just toggles it when zero or
  1.3463 +left out."
  1.3464 +  (interactive "P")
  1.3465 +  (let ((num_arg (prefix-numeric-value arg)))
  1.3466 +    (setq lua-electric-flag (cond ((or (null arg)
  1.3467 +                                       (zerop num_arg)) (not lua-electric-flag))
  1.3468 +                                  ((< num_arg 0) nil)
  1.3469 +                                  ((> num_arg 0) t))))
  1.3470 +  (message "%S" lua-electric-flag))
  1.3471 +
  1.3472 +(defun lua-forward-sexp (&optional count)
  1.3473 +  "Forward to block end"
  1.3474 +  (interactive "p")
  1.3475 +  (save-match-data
  1.3476 +    (let* ((count (or count 1))
  1.3477 +           (block-start (mapcar 'car lua-sexp-alist))
  1.3478 +           (block-end (mapcar 'cdr lua-sexp-alist))
  1.3479 +           (block-regex (regexp-opt (append  block-start block-end) 'words))
  1.3480 +           current-exp
  1.3481 +           )
  1.3482 +      (while (> count 0)
  1.3483 +        ;; skip whitespace
  1.3484 +        (skip-chars-forward " \t\n")
  1.3485 +        (if (looking-at (regexp-opt block-start 'words))
  1.3486 +            (let ((keyword (match-string 1)))
  1.3487 +              (lua-find-matching-token-word keyword nil))
  1.3488 +          ;; If the current keyword is not a "begin" keyword, then just
  1.3489 +          ;; perform the normal forward-sexp.
  1.3490 +          (forward-sexp 1))
  1.3491 +        (setq count (1- count))))))
  1.3492 +
  1.3493 +
  1.3494 +;; menu bar
  1.3495 +
  1.3496 +(define-key lua-mode-menu [restart-with-whole-file]
  1.3497 +  '("Restart With Whole File" .  lua-restart-with-whole-file))
  1.3498 +(define-key lua-mode-menu [kill-process]
  1.3499 +  '("Kill Process" . lua-kill-process))
  1.3500 +
  1.3501 +(define-key lua-mode-menu [hide-process-buffer]
  1.3502 +  '("Hide Process Buffer" . lua-hide-process-buffer))
  1.3503 +(define-key lua-mode-menu [show-process-buffer]
  1.3504 +  '("Show Process Buffer" . lua-show-process-buffer))
  1.3505 +
  1.3506 +(define-key lua-mode-menu [end-of-proc]
  1.3507 +  '("End Of Proc" . lua-end-of-proc))
  1.3508 +(define-key lua-mode-menu [beginning-of-proc]
  1.3509 +  '("Beginning Of Proc" . lua-beginning-of-proc))
  1.3510 +
  1.3511 +(define-key lua-mode-menu [send-lua-region]
  1.3512 +  '("Send Lua-Region" . lua-send-lua-region))
  1.3513 +(define-key lua-mode-menu [set-lua-region-end]
  1.3514 +  '("Set Lua-Region End" . lua-set-lua-region-end))
  1.3515 +(define-key lua-mode-menu [set-lua-region-start]
  1.3516 +  '("Set Lua-Region Start" . lua-set-lua-region-start))
  1.3517 +
  1.3518 +(define-key lua-mode-menu [send-current-line]
  1.3519 +  '("Send Current Line" . lua-send-current-line))
  1.3520 +(define-key lua-mode-menu [send-region]
  1.3521 +  '("Send Region" . lua-send-region))
  1.3522 +(define-key lua-mode-menu [send-proc]
  1.3523 +  '("Send Proc" . lua-send-proc))
  1.3524 +(define-key lua-mode-menu [send-buffer]
  1.3525 +  '("Send Buffer" . lua-send-buffer))
  1.3526 +(define-key lua-mode-menu [search-documentation]
  1.3527 +  '("Search Documentation" . lua-search-documentation))
  1.3528 +
  1.3529 +(defsubst lua-put-char-property (pos property value &optional object)
  1.3530 +  (lua--with-silent-modifications
  1.3531 +
  1.3532 +   (if value
  1.3533 +       (put-text-property pos (1+ pos) property value object)
  1.3534 +     (remove-text-properties pos (1+ pos) (list property nil))))
  1.3535 +
  1.3536 +  ;; `lua--with-silent-modifications' inhibits modification hooks, one of which
  1.3537 +  ;; is the hook that keeps `syntax-ppss' internal cache up-to-date. If this
  1.3538 +  ;; isn't done, the results of subsequent calls to `syntax-ppss' are
  1.3539 +  ;; invalid. To avoid such cache discrepancy, the hook must be run manually.
  1.3540 +  (syntax-ppss-flush-cache pos))
  1.3541 +
  1.3542 +(defsubst lua-put-char-syntax-table (pos value &optional object)
  1.3543 +  (lua-put-char-property pos 'syntax-table value object))
  1.3544 +
  1.3545 +(defsubst lua-get-multiline-delim-syntax (type)
  1.3546 +  (cond ((eq type 'string) '(15))
  1.3547 +        ((eq type 'comment) '(14))
  1.3548 +        (nil)))
  1.3549 +
  1.3550 +(defun lua-mark-char-multiline-delim (pos type)
  1.3551 +  "Mark character as a delimiter of Lua multiline construct
  1.3552 +
  1.3553 +If TYPE is string, mark char  as string delimiter. If TYPE is comment,
  1.3554 +mark char as comment delimiter.  Otherwise, remove the mark if any."
  1.3555 +   (lua-put-char-syntax-table pos (lua-get-multiline-delim-syntax type)))
  1.3556 +
  1.3557 +(defsubst lua-inside-multiline-p (&optional pos)
  1.3558 +  (let ((status (syntax-ppss pos)))
  1.3559 +    (or (eq (elt status 3) t)                ;; inside generic string
  1.3560 +        (eq (elt status 7) 'syntax-table)))) ;; inside generic comment
  1.3561 +
  1.3562 +(defun lua-get-multiline-start (&optional pos)
  1.3563 +  (interactive)
  1.3564 +  (when (lua-inside-multiline-p pos) ;; return string/comment start
  1.3565 +    (elt (syntax-ppss pos) 8)))
  1.3566 +
  1.3567 +(defun lua-unmark-multiline-literals (&optional begin end)
  1.3568 +  "Clears all Lua multiline construct markers in region
  1.3569 +
  1.3570 +If BEGIN is nil, start from `beginning-of-buffer'.
  1.3571 +If END is nil, stop at `end-of-buffer'."
  1.3572 +  (interactive)
  1.3573 +
  1.3574 +  (setq begin (or begin (point-min))
  1.3575 +        end   (or end   (point-max)))
  1.3576 +
  1.3577 +  (lua--with-silent-modifications
  1.3578 +   (remove-text-properties begin end '(syntax-table ())))
  1.3579 +
  1.3580 +  ;; `lua--with-silent-modifications' inhibits modification hooks, one of which
  1.3581 +  ;; is the hook that keeps `syntax-ppss' internal cache up-to-date. If this
  1.3582 +  ;; isn't done, the results of subsequent calls to `syntax-ppss' are
  1.3583 +  ;; invalid. To avoid such cache discrepancy, the hook must be run manually.
  1.3584 +  (syntax-ppss-flush-cache begin)
  1.3585 +
  1.3586 +  (font-lock-fontify-buffer))
  1.3587 +
  1.3588 +(defun lua-mark-multiline-region (begin end)
  1.3589 +  (let ((type (if (eq ?- (char-after begin)) 'comment 'string)))
  1.3590 +  (lua-mark-char-multiline-delim begin type)
  1.3591 +  (when end
  1.3592 +    (lua-mark-char-multiline-delim (1- end) type))))
  1.3593 +
  1.3594 +(defun lua-mark-all-multiline-literals (&optional begin end)
  1.3595 +  "Marks all Lua multiline constructs in region
  1.3596 +
  1.3597 +If BEGIN is nil, start from `beginning-of-buffer'.
  1.3598 +If END is nil, stop at `end-of-buffer'."
  1.3599 +  (interactive)
  1.3600 +
  1.3601 +  (if (and (lua--called-interactively-p 'any) (use-region-p))
  1.3602 +      (setq begin (region-beginning)
  1.3603 +            end (region-end)))
  1.3604 +
  1.3605 +  (lua-unmark-multiline-literals begin end)
  1.3606 +  (save-excursion
  1.3607 +    (goto-char (or begin (point-min)))
  1.3608 +
  1.3609 +    (while (and
  1.3610 +            ;; must check  for point range,  because matching previous
  1.3611 +            ;; multiline  end might  move  point beyond  end and  this
  1.3612 +            ;; drives `re-search-forward' crazy
  1.3613 +            (if end (< (point) end) t)
  1.3614 +            ;; look for
  1.3615 +            ;; 1. (optional) two or more dashes followed by
  1.3616 +            ;; 2. lua multiline delimiter [[
  1.3617 +            (re-search-forward "\\(?2:--\\)?\\[\\(?1:=*\\)\\[" end 'noerror))
  1.3618 +      ;; match-start + 1 is considered instead of match-start, because
  1.3619 +      ;; such  approach  handles  '---[[' situation  correctly:  Emacs
  1.3620 +      ;; thinks 2nd dash (i.e.  match-start) is not yet a comment, but
  1.3621 +      ;; the third one is, hence the +1.  In all the other situations,
  1.3622 +      ;; '+1'  is safe  to use  because  it bears  the same  syntactic
  1.3623 +      ;; properties, i.e.  if match-start is inside string-or-comment,
  1.3624 +      ;; then '+1' is too and vice versa.
  1.3625 +      ;;
  1.3626 +      ;; PS. ping me if you find a situation in which this is not true
  1.3627 +      (unless (lua-comment-or-string-p (1+ (match-beginning 0)))
  1.3628 +        (let (ml-begin ml-end)
  1.3629 +          (setq ml-begin (match-beginning 0))
  1.3630 +          (when (re-search-forward (format "\\]%s\\]" (or (match-string 1) "")) nil 'noerror)
  1.3631 +            ;; (message "found match %s" (match-string 0))
  1.3632 +            (setq ml-end (match-end 0)))
  1.3633 +          (lua-mark-multiline-region ml-begin ml-end))))))
  1.3634 +
  1.3635 +(defvar lua-automark-multiline-timer nil
  1.3636 +  "Contains idle-timer object used for automatical multiline literal markup which must be cleaned up on exit.")
  1.3637 +(make-variable-buffer-local 'lua-automark-multiline-timer)
  1.3638 +
  1.3639 +(defvar lua-automark-multiline-start-pos nil
  1.3640 +  "Contains position from which automark procedure should start.
  1.3641 +
  1.3642 +Automarking shall start at the point before which no modification has been
  1.3643 +made since last automark. Additionally, if such point is inside string or
  1.3644 +comment, rewind start position to its beginning.
  1.3645 +
  1.3646 +nil means automark is unnecessary because there were no updates.")
  1.3647 +(make-variable-buffer-local 'lua-automark-multiline-start-pos)
  1.3648 +
  1.3649 +(defun lua--automark-update-start-pos (change-begin change-end old-len)
  1.3650 +  "Updates `lua-automark-multiline-start-pos' upon buffer modification."
  1.3651 +  (save-excursion
  1.3652 +    (goto-char change-begin)
  1.3653 +    (beginning-of-line)
  1.3654 +    (setq lua-automark-multiline-start-pos
  1.3655 +          (or (lua-comment-or-string-start) (point)))))
  1.3656 +
  1.3657 +(defun lua--automark-multiline-update-timer ()
  1.3658 +  (lua--automark-multiline-cleanup)  ;; reset previous timer if it existed
  1.3659 +  (when lua-automark-multiline-interval
  1.3660 +    (add-hook 'change-major-mode-hook 'lua--automark-multiline-cleanup nil 'local)
  1.3661 +    (add-hook 'after-change-functions 'lua--automark-update-start-pos  nil 'local)
  1.3662 +    (setq lua-automark-multiline-timer
  1.3663 +          (run-with-idle-timer lua-automark-multiline-interval 'repeat
  1.3664 +                               'lua--automark-multiline-run))))
  1.3665 +
  1.3666 +(defun lua--automark-multiline-cleanup ()
  1.3667 +  "Disable automatical multiline construct marking"
  1.3668 +  (unless (null lua-automark-multiline-timer)
  1.3669 +    (cancel-timer lua-automark-multiline-timer)
  1.3670 +    (setq lua-automark-multiline-timer nil)))
  1.3671 +
  1.3672 +(defun lua--automark-multiline-run ()
  1.3673 +  (when (<= (buffer-size) lua-automark-multiline-maxsize)
  1.3674 +    (when lua-automark-multiline-start-pos
  1.3675 +      (lua-mark-all-multiline-literals lua-automark-multiline-start-pos)
  1.3676 +      (setq lua-automark-multiline-start-pos nil))))
  1.3677 +
  1.3678 +(defun lua--customize-set-automark-multiline-interval (symbol value)
  1.3679 +  (set symbol value)
  1.3680 +  (dolist (buf (buffer-list))
  1.3681 +    (with-current-buffer buf
  1.3682 +      (when (eq major-mode 'lua-mode)
  1.3683 +        (lua--automark-multiline-update-timer)))))
  1.3684 +
  1.3685 +(defcustom lua-automark-multiline-interval 1
  1.3686 +  "If not 0, specifies idle time in seconds after which lua-mode will mark multiline literals."
  1.3687 +  :group 'lua
  1.3688 +  :type 'integer
  1.3689 +  :set 'lua--customize-set-automark-multiline-interval)
  1.3690 +
  1.3691 +(defcustom lua-automark-multiline-maxsize 100000
  1.3692 +  "Maximum buffer size for which lua-mode will mark multiline literals automatically."
  1.3693 +  :group 'lua
  1.3694 +  :type 'integer)
  1.3695 +
  1.3696 +(provide 'lua-mode)
  1.3697 +
  1.3698 +;;; lua-mode.el ends here