all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pat Maddox <pat.maddox@gmail.com>
To: emacs-pretest-bug@gnu.org
Subject: bug#2481: 23.0.91; javascript-mode indentation weirdness
Date: Thu, 26 Feb 2009 02:00:10 -0800	[thread overview]
Message-ID: <2c7e61990902260200q2495ab7fqe7cbe6acb583c9b1@mail.gmail.com> (raw)

If I'm on the last line of a file in javascript-mode and press tab to
indent, it beeps and says "End of buffer".  This doesn't happen in any
other modes as far as I can tell.

There's another problem with indentation or parsing, I'm not sure if
it's related or not...I've written some code to automatically format
braces:

(add-hook 'javascript-mode-hook
          (lambda ()
            (textmate-mode)
            (local-set-key "\r"
                           (lambda () (interactive)
                             (insert-line-before-closing-braces)
                             (newline-and-indent)))))

(defun insert-line-before-closing-braces ()
  (interactive)
  (save-excursion
    (let ((content (buffer-substring (point) (line-end-position))))
      (if (and (> (length content) 0)
               (string= (replace-regexp-in-string ")\\\|}" "" content)  ""))
          (newline-and-indent)))))

If I'm on the first line of a file and type (), and move between the
parens and press return, I get an error.  It works fine in every other
mode I've tried, or on any line other than #1.  Here's the error

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  =(nil 41)
  (if (= (char-before) 41) (progn (backward-list)))
  (when (= (char-before) 41) (backward-list))
  (progn (skip-syntax-backward " ") (when (= ... 41) (backward-list))
(back-to-indentation) (cond (same-indent-p ...) (continued-expr-p ...)
(t ...)))
  (if (looking-at "[({[][ 	]*\\(/[/*]\\|$\\)") (progn
(skip-syntax-backward " ") (when ... ...) (back-to-indentation) (cond
... ... ...)) (unless same-indent-p (forward-char) (skip-chars-forward
" 	")) (current-column))
  (cond (ctrl-stmt-indent) ((js-continued-var-decl-list-p)
(js-re-search-backward "\\<var\\>" nil t) (+ ...
javascript-indent-level)) ((nth 1 parse-status) (goto-char ...) (if
... ... ... ...)) (continued-expr-p javascript-indent-level) (t (let
... ... ind)))
  (let ((ctrl-stmt-indent ...) (same-indent-p ...) (continued-expr-p
...)) (cond (ctrl-stmt-indent) (... ... ...) (... ... ...)
(continued-expr-p javascript-indent-level) (t ...)))
  (save-excursion (back-to-indentation) (let (... ... ...) (cond ...
... ... ... ...)))
  js-proper-indentation((1 1 nil nil nil nil 0 nil nil (1)))
  (indent-line-to (js-proper-indentation parse-status))
  (progn (indent-line-to (js-proper-indentation parse-status)) (when
(> offset 0) (forward-char offset)))
  (if (not (nth 8 parse-status)) (progn (indent-line-to ...) (when ... ...)))
  (when (not (nth 8 parse-status)) (indent-line-to
(js-proper-indentation parse-status)) (when (> offset 0) (forward-char
offset)))
  (let ((parse-status ...) (offset ...)) (when (not ...)
(indent-line-to ...) (when ... ...)))
  javascript-indent-line()
  indent-according-to-mode()
  newline-and-indent()
  (if (and (> ... 0) (string= ... "")) (newline-and-indent))
  (let ((content ...)) (if (and ... ...) (newline-and-indent)))
  (save-excursion (let (...) (if ... ...)))
  insert-line-before-closing-braces()
  (lambda nil (interactive) (insert-line-before-closing-braces)
(newline-and-indent))()
  call-interactively((lambda nil (interactive)
(insert-line-before-closing-braces) (newline-and-indent)) nil nil)


In GNU Emacs 23.0.91.1 (i386-apple-darwin9.6.0, NS apple-appkit-949.43)
 of 2009-02-26 on booyah.local
Windowing system distributor `Apple', version 10.3.949
configured using `configure  '--with-ns''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  nxhtml-global-minor-mode: t
  global-auto-revert-mode: t
  show-paren-mode: t
  yas/minor-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x b b l a <return> y M-x j a v a s c <tab> <return>
( <return> q C-x h C-w / / <return> ( <return> C-x
h C-w C-x C-f j a v a <return> <down> <down> C-SPC
<C-down> <down> <down> C-w <backspace> C-x C-s M-x
s u b m i <tab> <backspace> <backspace> <backspace>
<backspace> <backspace> b u g <tab> <tab> <M-backspace>
<M-backspace> r e p o <tab> r t <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
No buffer matching `bla', create one? (y or n)
Entering debugger...
Back to top level.
Mark set [4 times]
Loading tramp...done
Mark set
Saving file /Users/padillac/code/emacs/javascript.el...
Wrote /Users/padillac/code/emacs/javascript.el
Making completion list... [2 times]






             reply	other threads:[~2009-02-26 10:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-26 10:00 Pat Maddox [this message]
2009-02-26 18:19 ` bug#2481: 23.0.91; javascript-mode indentation weirdness Glenn Morris
2009-02-26 18:30   ` Processed: " Emacs bug Tracking System
2011-02-26 22:06   ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2c7e61990902260200q2495ab7fqe7cbe6acb583c9b1@mail.gmail.com \
    --to=pat.maddox@gmail.com \
    --cc=2481@emacsbugs.donarmstrong.com \
    --cc=emacs-pretest-bug@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.