vermiculus / sx.el

Stack Exchange for Emacs
http://stackapps.com/q/3950
709 stars 40 forks source link

`sx-question-mode-hide-show-section` fn interactive? #282

Closed kaushalmodi closed 9 years ago

kaushalmodi commented 9 years ago

In the process of figuring out how to unhide a question ( https://github.com/vermiculus/sx.el/issues/281 ), I tried out M-x sxhide (hoping that smex will help me find a command related to hiding/unhiding in sx).

A new function did show up: sx-question-mode-hide-show-section

I tried to run it and I got this error:

Debugger entered--Lisp error: (wrong-type-argument overlayp nil)
  overlay-start(nil)
  sx-question-mode-hide-show-section()
  funcall-interactively(sx-question-mode-hide-show-section)
  #<subr call-interactively>(sx-question-mode-hide-show-section record nil)
  ad-Advice-call-interactively(#<subr call-interactively> sx-question-mode-hide-show-section record nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (sx-question-mode-hide-show-section record nil))
  call-interactively(sx-question-mode-hide-show-section record nil)
  command-execute(sx-question-mode-hide-show-section record)
  execute-extended-command(nil "sx-question-mode-hide-show-section")
  smex-read-and-run(("toggle-debug-on-error" "sx-question-mode-hide-show-section" "sx-question-list-hide" "desktop-read" "nlinum-mode" "report-emacs-bug" "emacs-version" "sos-sel" "sos-diff" "list-packages" "count-words-region" "sos-discardco-force" "customize" "kmacro-insert-counter" "paradox-list-packages" "sos-up" "sos-co-nolock" "list-colors-display" "modi-mode" "global-unset-key" "edebug-defun" "customize-face" "unbind-from-modi-map" "modi/set-linum" "fci-mode" "rpn-calc" "mc/insert-numbers" "mc--insert-number-and-increase" "bzg-big-fringe-mode" "interleave" "describe-char" "electric-verilog-terminate-line" "ediff-buffers" "sos-discardco" "ggtags-update-tags" "browse-url-firefox" "describe-personal-keybindings" "load-file" "toggle-truncate-lines" "revert-all-buffers" "sx-tab-newest" "calc" "shell-script-mode" "query-exchange" "benchmark-init/show-durations-tabulated" "number/add" "matlab-shell" "emacs-lisp-mode" "gist-list" "verilog-mode" ...))
  smex()
  funcall-interactively(smex)
  #<subr call-interactively>(smex nil nil)
  ad-Advice-call-interactively(#<subr call-interactively> smex nil nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (smex nil nil))
  call-interactively(smex nil nil)
  command-execute(smex)

Looking into the source code, this function is probably not what I thought it was. But if it is interactive, should it error out in this fashion that requires a backtrace debug?

Malabarba commented 9 years ago

Looking into the source code, this function is probably not what I thought it was.

Indeed.

But if it is interactive, should it error out in this fashion that requires a backtrace debug?

No, we should check where it's being invoked and throw a user-error instead.