"alert here" in Emacs.

作者:   發佈於: ,更新於:   #emacs #javascript #debug

When debugging javascript, sometimes it's quite helpful to put alerts. Here's a function for Emacs to insert an alert that shows current file name and line number:


(defun js-insert-alert-at-here ()
  (interactive)
  (insert (concat "alert(\\""
                  (buffer-name)
                  ": "
                  (number-to-string (line-number-at-pos))
                  "\\");")))