>>107213760
>sure, I've added the var, if you write the function and it works, I'll add that too.
>I've also added refresh buttons to the top of the catalog and thread views.
I would have responded much sooner, but I ran into some weirdness with setq-local and with-current-buffer. For some strange reason, the values set by setq-local disappear once the with-current-buffer expression is over. My unfortunate workaround was to run setq-local again after the (switch-to-buffer out) so that my function could see the right values for 4g--boardname and 4g--threadno. The attached webm demonstrates the problem.
- First, I run the original 4g-thread by clicking the Refresh link.
- I then eval =(list 4g--boardname 4g--threadno)= to show that it returns =(nil nil)=.
- Then, I uncomment my late setq-local, reevaluate 4g-thread, and then click the Refresh link again.
- When I eval =(list 4g--boardname 4g--threadno)= this time, it returns =("jp" 50302252)=.
If I can rely on 4g--boardname and 4g-threadno, the 4g-reload function becomes much smaller.
;;;###autoload
(defun 4g-reload ()
"Figure out what kind of buffer we're in, and regenerate it."
(interactive)
(pcase `(,4g--boardname ,4g--threadno)
(`( nil nil) (4g-board-list))
(`(,board nil) (4g-catalog board))
(`(,board ,thread) (4g-thread board thread))))
This would be useful to people like me who want to bind the act of reloading to a key (although the refresh links are nice too).
Here's my updated code:
https://bpa.st/EFRQ
I changed:
4g-catalog
4g-thread
4g-board-list
I added:
4g-reload