Skip to content

Commit

Permalink
Fix crash caused when set-process-* family of calls reset filter to n…
Browse files Browse the repository at this point in the history
…il. (#45)

set-process-filter allows nil as a filter callback, which resets the
filter to the internal default filter. Do not wrap the internal
default filter.
  • Loading branch information
lastquestion committed Jun 21, 2020
1 parent 258f5ac commit 318dace
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions explain-pause-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1874,14 +1874,18 @@ generated. ORIGINAL-CALLBACK is the function to be wrapped."
(defun explain--wrap-set-process-filter-callback (args)
"Advise that modifies the arguments ARGS to `process-filter' by wrapping the callback."
(seq-let [arg-process original-callback] args
(list arg-process
(explain--generate-wrapper (explain--generate-command-set 'process-filter) original-callback))))
(if (not original-callback)
args
(list arg-process
(explain--generate-wrapper (explain--generate-command-set 'process-filter) original-callback)))))

(defun explain--wrap-set-process-sentinel-callback (args)
"Advise that modifies the arguments ARGS to `process-sentinel' by wrapping the callback."
(seq-let [arg-process original-callback] args
(list arg-process
(explain--generate-wrapper (explain--generate-command-set 'sentinel-filter) original-callback))))
(if (not original-callback)
args
(list arg-process
(explain--generate-wrapper (explain--generate-command-set 'sentinel-filter) original-callback)))))

(defun explain--wrap-idle-timer-callback (args)
"Advise that modifies the arguments ARGS to `run-with-idle-timer' by wrapping the callback."
Expand Down

0 comments on commit 318dace

Please sign in to comment.