[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: saving a buffer without images



In [emacs-w3m : No.12597]
	On Tue, 06 Sep 2016 23:48:26 -0400, Boruch Baum wrote:
> I don't see anything there regarding caddr or cadar, although I do see
> that w3m-hist.el also calls such undefined functions. Running C-h f
> and C-h v on both `cadar' and `caddr' also yield nothing.

(cadar x) = (car (cdr (car x)))
(caddr x) = (car (cdr (cdr x)))

(eval-when-compile (require 'cl))
which many emacs-w3m modules have will load those macros only
when performing byte-compile.  You can load it by:

M-x load-library RET cl RET

But you'd better not load it usually except for developing or
debugging, since an Elisp program should work without it in
principle.

>>> * there seems to be a bug in the function call to
>>>   `w3m-history-set-current', so that function call was removed in
>>>   order to illustrate an error-free test.

>> Why bug?  After saving a w3m buffer, `w3m-view-next-page' in the
>> buffer shows the saved one as designed.

> It was generating an error message (in my *Messages* buffer)
>   w3m-history-previous-position: Wrong type argument: numberp, nil

I saw it by your personal mail.  I don't know why the buffer
name is modified into "*server*-nnnnn text" in your system, but
I think what you should do first would be to fix it anyway, or
we cannot stand on the same footing.

>> The docstring should mention what it is in one line:
>> ,---- (info "(elisp)Documentation Tips")
>>| • Format the documentation string so that it fits in an Emacs window
>>|   on an 80-column screen.  It is a good idea for most lines to be no
>>|   wider than 60 characters.  The first line should not be wider than
>>|   67 characters or it will look bad in the output of ‘apropos’.
>> `----
>> Not a few emacs-w3m objects violate it though.

> I don't understand. The documentation that you're quoting is talking
> about line width, not number of lines.

I misquoted it, sorry.  Here is the right part:

,---- (info "(elisp)Documentation Tips")
| • The first line of the documentation string should consist of one or
|   two complete sentences that stand on their own as a summary.  ‘M-x
|   apropos’ displays just the first line, and if that line’s contents
|   don’t stand on their own, the result looks bad.
`----
[...]
>> BTW, there seems to be another way to achieve your personal
>> purpose in a simple way, e.g.:

> You alternative wasn't viewable in my email, but if it does the job
> and you prefer it, it's fine with me.

--8<---------------cut here---------------start------------->8---
(defvar my-w3m-save-buffer-html-only nil
  "docstring")

(defadvice w3m-save-buffer (around switch-no-image-flag
                                   (name &optional no-image)
                                   activate)
  "Complement the meaning of NO-IMAGE flag; don't modify history."
  (if my-w3m-save-buffer-html-only
      (setq no-image (not no-image)))
  (let ((history (copy-sequence w3m-history)))
    (unwind-protect
        ad-do-it
      (setq w3m-history history))))
--8<---------------cut here---------------end--------------->8---