summaryrefslogtreecommitdiff
path: root/devdocs/elisp/excess-close.html
blob: f060809c6eb252b2a632c8d79e7c8463b9128d0a (plain)
1
2
3
4
5
6
 <h4 class="subsection">Excess Close Parentheses</h4>  <p>To deal with an excess close parenthesis, first go to the beginning of the file, then type <kbd>C-u -1 C-M-u</kbd> (<code>backward-up-list</code> with an argument of -1) to find the end of the first unbalanced defun. </p> <p>Then find the actual matching close parenthesis by typing <kbd>C-M-f</kbd> (<code>forward-sexp</code>, see <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Expressions.html#Expressions">Expressions</a> in <cite>The GNU Emacs Manual</cite>) at the beginning of that defun. This will leave you somewhere short of the place where the defun ought to end. It is possible that you will find a spurious close parenthesis in that vicinity. </p> <p>If you don’t see a problem at that point, the next thing to do is to type <kbd>C-M-q</kbd> (<code>indent-pp-sexp</code>) at the beginning of the defun. A range of lines will probably shift left; if so, the missing open parenthesis or spurious close parenthesis is probably near the first of those lines. (However, don’t assume this is true; study the code to make sure.) Once you have found the discrepancy, undo the <kbd>C-M-q</kbd> with <kbd>C-_</kbd> (<code>undo</code>), since the old indentation is probably appropriate to the intended parentheses. </p> <p>After you think you have fixed the problem, use <kbd>C-M-q</kbd> again. If the old indentation actually fits the intended nesting of parentheses, and you have put back those parentheses, <kbd>C-M-q</kbd> should not change anything. </p><div class="_attribution">
  <p class="_attribution-p">
    Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
    <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Excess-Close.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Excess-Close.html</a>
  </p>
</div>