wasamasa / nov.el

Major mode for reading EPUBs in Emacs
GNU General Public License v3.0
655 stars 34 forks source link

readme example triggering arg-out-of-range #57

Closed bricewge closed 5 years ago

bricewge commented 5 years ago

I was trying to achieve the same rendering as the screenshot in the readme by following the instructions but I keep getting this error: File mode specification error: (args-out-of-range nil 256204778801521549). I opened this issue as asked at https://github.com/wasamasa/nov.el/issues/51.

Following is the minimal configuration triggering the issue, my-nov-post-html-render-hook is from README.org file:

(use-package! nov
  :mode ("\\.epub\\'" . nov-mode)
  :requires (justify-kp)
  :hook ((nov-mode . my-nov-post-html-render-hook))
  :config
  (setq nov-text-width most-positive-fixnum))

On NixOS 19.03 with emacs 26.1.

wasamasa commented 5 years ago

This is not minimal as a use-package! macro is involved. A minimal configuration is one that you can trigger from emacs -Q, loading up nov.el manually and extra configuration.

wasamasa commented 5 years ago

That being said, I cannot reproduce it with the following config:

(package-initialize)
(require 'cl)
(require 's)
(load-file "~/downloads/justify-kp.el")

(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
(setq nov-text-width most-positive-fixnum)

(defun my-nov-window-configuration-change-hook ()
  (my-nov-post-html-render-hook)
  (remove-hook 'window-configuration-change-hook
               'my-nov-window-configuration-change-hook
               t))

(defun my-nov-post-html-render-hook ()
  (if (get-buffer-window)
      (let ((max-width (pj-line-width))
            buffer-read-only)
        (save-excursion
          (goto-char (point-min))
          (while (not (eobp))
            (when (not (looking-at "^[[:space:]]*$"))
              (goto-char (line-end-position))
              (when (> (shr-pixel-column) max-width)
                (goto-char (line-beginning-position))
                (pj-justify)))
            (forward-line 1))))
    (add-hook 'window-configuration-change-hook
              'my-nov-window-configuration-change-hook
              nil t)))

(add-hook 'nov-post-html-render-hook 'my-nov-post-html-render-hook)

Please provide more info, such as a complete backtrace and the compilation flags used (check system-configuration-options).

bricewge commented 5 years ago

ATM the above configuration return fail with the folowing backtrace:

Debugger entered--Lisp error: (args-out-of-range nil 256204778801521549)
  vertical-motion((256204778801521549 . 0))
  shr-vertical-motion(2305843009213693943)
  shr-fill-line()
  shr-fill-lines(1 1482)
  shr-insert-document((html nil (body nil (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_cvi_r1.htm#b04-cvi")) "COVER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_tp_r1.htm")) "TITLE PAGE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_cop_r1.htm")) "COPYRIGHT") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_qts_r1.htm")) "PRAISE FOR GEORGE R. R. MARTIN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_toc_r1.htm")) "CONTENTS") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_ded_r1.htm")) "DEDICATION") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_fm_r1.htm")) "MAP") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_prl_r1.htm")) "PROLOGUE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c01_r1.htm")) "THE PROPHET") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c02_r1.htm")) "THE CAPTAIN OF GUARDS") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c03_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c04_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c05_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c06_r1.htm")) "ARYA") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c07_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c08_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c09_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c10_r1.htm")) "SANSA") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c11_r1.htm")) "THE KRAKEN’S DAUGHTER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c12_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c13_r1.htm")) "THE SOILED KNIGHT") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c14_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c15_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c16_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c17_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c18_r1.htm")) "THE IRON CAPTAIN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c19_r1.htm")) "THE DROWNED MAN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c20_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c21_r1.htm")) "THE QUEENMAKER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c22_r1.htm")) "ARYA") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c23_r1.htm")) "ALAYNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c24_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c25_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c26_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c27_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c28_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c29_r1.htm")) "THE REAVER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c30_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c31_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c32_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c33_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c34_r1.htm")) "CAT OF THE CANALS") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c35_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c36_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c37_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c38_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c39_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c40_r1.htm")) "THE PRINCESS IN THE TOWER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c41_r1.htm")) "ALAYNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c42_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c43_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c44_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c45_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c46_r1.htm")) "MEANWHILE, BACK ON THE WALL . . .") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app1_r1.htm")) "APPENDIX I: THE KINGS AND THEIR COURTS") "\n" (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app1_r1.htm#app1s01.01")) "THE QUEEN REGENT") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app1_r1.htm#app1s01.02")) "THE KING AT THE WALL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app1_r1.htm#app1s01.03")) "KING OF THE ISLES AND THE NORTH") "\n") "\n")) "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm")) "APPENDIX II: OTHER HOUSES GREAT AND SMALL") "\n" (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.01")) "HOUSE ARRYN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.02")) "HOUSE FLORENT") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.03")) "HOUSE FREY") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.04")) "HOUSE HIGHTOWER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.05")) "HOUSE LANNISTER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.06")) "HOUSE MARTELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.07")) "HOUSE STARK") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.08")) "HOUSE TULLY") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.09")) "HOUSE TYRELL") "\n") "\n")) "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm")) "APPENDIX III: REBELS AND ROGUES SMALLFOLK AND SWORN BROTHERS") "\n" (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm#app3s01.01")) "LORDLINGS, WANDERERS, AND COMMON MEN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm#app3s01.02")) "OUTLAWS AND BROKEN MEN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm#app3s01.03")) "THE SWORN BROTHERS OF THE NIGHT’S WATCH") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm#app3s01.04")) "THE WILDLINGS, OR THE FREE FOLK") "\n") "\n")) "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app4_r1.htm")) "APPENDIX IV: BEYOND THE NARROW SEA") "\n" (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app4_r1.htm#app4s01.01")) "THE QUEEN ACROSS THE WATER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app4_r1.htm#app4s01.02")) "IN BRAAVOS") "\n") "\n")) "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_ack_r1.htm")) "ACKNOWLEDGMENTS") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_ata_r1.htm")) "ABOUT THE AUTHOR") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_adc_r1.htm")) "ALSO BY GEORGE R.R. MARTIN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_bm1_r1.htm")) "EXCERPT FROM A DANCE WITH DRAGONS") "\n") "\n"))))
  shr-render-region(1 6661)
  (progn (fset 'shr-tag-img 'nov-render-img) (shr-render-region (point-min) (point-max)))
  (unwind-protect (progn (fset 'shr-tag-img 'nov-render-img) (shr-render-region (point-min) (point-max))) (fset 'shr-tag-img old))
  (let* ((old (symbol-function 'shr-tag-img))) (unwind-protect (progn (fset 'shr-tag-img 'nov-render-img) (shr-render-region (point-min) (point-max))) (fset 'shr-tag-img old)))
  (let ((shr-map nov-mode-map) (shr-external-rendering-functions nov-shr-rendering-functions) (shr-use-fonts nov-variable-pitch) (shr-width nov-text-width)) (let* ((old (symbol-function 'shr-tag-img))) (unwind-protect (progn (fset 'shr-tag-img 'nov-render-img) (shr-render-region (point-min) (point-max))) (fset 'shr-tag-img old))))
  nov-render-html()
  funcall(nov-render-html)
  (progn (funcall nov-render-html-function))
  (if (not imagep) (progn (funcall nov-render-html-function)))
  (let* ((document (aref nov-documents nov-documents-index)) (id (car document)) (path (cdr document)) (imagep (let (needle) (let ((list image-type-file-name-regexps) (continue t) (it-index 0)) (while (and list continue) (let ((it (car list))) (if (not (not needle)) (setq continue nil) (if (string-match-p (car it) path) (progn (setq needle it))))) (setq it-index (1+ it-index)) (setq list (cdr list)))) needle)) (default-directory (file-name-directory path)) buffer-read-only) (erase-buffer) (cond (imagep (nov-insert-image path "")) ((and (version< nov-epub-version "3.0") (eq id nov-toc-id)) (insert (nov-ncx-to-html path))) (t (insert (nov-slurp path)))) (if (not imagep) (progn (funcall nov-render-html-function))) (goto-char (point-min)))
  nov-render-document()
  (if place (let ((index (cdr (assq 'index place))) (point (cdr (assq 'point place)))) (if (nov--index-valid-p nov-documents index) (progn (setq nov-documents-index index) (nov-render-document) (goto-char point)) (warn "Couldn't restore last position") (nov-render-document))) (nov-render-document))
  (let ((place (nov-saved-place (cdr (assq 'identifier nov-metadata))))) (if place (let ((index (cdr (assq 'index place))) (point (cdr (assq 'point place)))) (if (nov--index-valid-p nov-documents index) (progn (setq nov-documents-index index) (nov-render-document) (goto-char point)) (warn "Couldn't restore last position") (nov-render-document))) (nov-render-document)))
  (let ((delay-mode-hooks t)) (special-mode) (setq major-mode 'nov-mode) (setq mode-name "EPUB") (progn (if (get 'special-mode 'mode-class) (put 'nov-mode 'mode-class (get 'special-mode 'mode-class))) (if (keymap-parent nov-mode-map) nil (set-keymap-parent nov-mode-map (current-local-map))) (let ((parent (char-table-parent nov-mode-syntax-table))) (if (and parent (not (eq parent (standard-syntax-table)))) nil (set-char-table-parent nov-mode-syntax-table (syntax-table)))) (if (or (abbrev-table-get nov-mode-abbrev-table :parents) (eq nov-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put nov-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map nov-mode-map) (set-syntax-table nov-mode-syntax-table) (setq local-abbrev-table nov-mode-abbrev-table) (add-hook 'kill-buffer-hook 'nov-clean-up nil t) (add-hook 'kill-emacs-hook 'nov-clean-up-all) (add-hook 'change-major-mode-hook 'nov-clean-up nil t) (if (not buffer-file-name) (progn (error "EPUB must be associated with file"))) (setq nov-temp-dir (make-temp-file "nov-" t ".epub")) (let ((exit-code (nov-unzip-epub nov-temp-dir buffer-file-name))) (if (not (integerp exit-code)) (progn (nov-clean-up) (error "EPUB extraction aborted by signal %s" exit-code))) (if (not (= 0 exit-code)) (progn (nov-clean-up) (error "EPUB extraction failed with exit code %d" exit-code)))) (if (not (nov-epub-valid-p nov-temp-dir)) (progn (nov-clean-up) (error "Invalid EPUB file"))) (let* ((content (nov-slurp (nov-container-filename nov-temp-dir) t)) (content-file (nov-make-path nov-temp-dir (nov-container-content-filename content))) (work-dir (file-name-directory content-file)) (content (nov-slurp content-file t))) (setq nov-content-file content-file) (setq nov-epub-version (nov-content-version content)) (setq nov-metadata (nov-content-metadata content)) (setq nov-documents (apply 'vector (nov-content-files work-dir content))) (setq nov-documents-index 0)) (setq buffer-undo-list t) (setq nov-file-name (buffer-file-name)) (set-visited-file-name nil t) (let ((place (nov-saved-place (cdr (assq 'identifier nov-metadata))))) (if place (let ((index (cdr (assq 'index place))) (point (cdr (assq 'point place)))) (if (nov--index-valid-p nov-documents index) (progn (setq nov-documents-index index) (nov-render-document) (goto-char point)) (warn "Couldn't restore last position") (nov-render-document))) (nov-render-document))))
  (progn (make-local-variable 'delay-mode-hooks) (let ((delay-mode-hooks t)) (special-mode) (setq major-mode 'nov-mode) (setq mode-name "EPUB") (progn (if (get 'special-mode 'mode-class) (put 'nov-mode 'mode-class (get 'special-mode 'mode-class))) (if (keymap-parent nov-mode-map) nil (set-keymap-parent nov-mode-map (current-local-map))) (let ((parent (char-table-parent nov-mode-syntax-table))) (if (and parent (not (eq parent (standard-syntax-table)))) nil (set-char-table-parent nov-mode-syntax-table (syntax-table)))) (if (or (abbrev-table-get nov-mode-abbrev-table :parents) (eq nov-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put nov-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map nov-mode-map) (set-syntax-table nov-mode-syntax-table) (setq local-abbrev-table nov-mode-abbrev-table) (add-hook 'kill-buffer-hook 'nov-clean-up nil t) (add-hook 'kill-emacs-hook 'nov-clean-up-all) (add-hook 'change-major-mode-hook 'nov-clean-up nil t) (if (not buffer-file-name) (progn (error "EPUB must be associated with file"))) (setq nov-temp-dir (make-temp-file "nov-" t ".epub")) (let ((exit-code (nov-unzip-epub nov-temp-dir buffer-file-name))) (if (not (integerp exit-code)) (progn (nov-clean-up) (error "EPUB extraction aborted by signal %s" exit-code))) (if (not (= 0 exit-code)) (progn (nov-clean-up) (error "EPUB extraction failed with exit code %d" exit-code)))) (if (not (nov-epub-valid-p nov-temp-dir)) (progn (nov-clean-up) (error "Invalid EPUB file"))) (let* ((content (nov-slurp (nov-container-filename nov-temp-dir) t)) (content-file (nov-make-path nov-temp-dir (nov-container-content-filename content))) (work-dir (file-name-directory content-file)) (content (nov-slurp content-file t))) (setq nov-content-file content-file) (setq nov-epub-version (nov-content-version content)) (setq nov-metadata (nov-content-metadata content)) (setq nov-documents (apply 'vector (nov-content-files work-dir content))) (setq nov-documents-index 0)) (setq buffer-undo-list t) (setq nov-file-name (buffer-file-name)) (set-visited-file-name nil t) (let ((place (nov-saved-place (cdr (assq 'identifier nov-metadata))))) (if place (let ((index (cdr (assq 'index place))) (point (cdr (assq 'point place)))) (if (nov--index-valid-p nov-documents index) (progn (setq nov-documents-index index) (nov-render-document) (goto-char point)) (warn "Couldn't restore last position") (nov-render-document))) (nov-render-document)))))
  nov-mode()
  set-auto-mode-0(nov-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer 04 A Feast for Crows - George R R Martin.epub> "~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" nil nil "~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" (15790022 50))
  find-file-noselect("~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" nil nil t)
  find-file("~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" t)
  funcall-interactively(find-file "~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" t)
  call-interactively(find-file nil nil)
  command-execute(find-file)
Debugger entered--Lisp error: (args-out-of-range nil 256204778801521549)
  vertical-motion((256204778801521549 . 0))
  shr-vertical-motion(2305843009213693943)
  shr-fill-line()
  shr-fill-lines(1 1482)
  shr-insert-document((html nil (body nil (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_cvi_r1.htm#b04-cvi")) "COVER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_tp_r1.htm")) "TITLE PAGE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_cop_r1.htm")) "COPYRIGHT") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_qts_r1.htm")) "PRAISE FOR GEORGE R. R. MARTIN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_toc_r1.htm")) "CONTENTS") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_ded_r1.htm")) "DEDICATION") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_fm_r1.htm")) "MAP") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_prl_r1.htm")) "PROLOGUE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c01_r1.htm")) "THE PROPHET") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c02_r1.htm")) "THE CAPTAIN OF GUARDS") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c03_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c04_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c05_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c06_r1.htm")) "ARYA") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c07_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c08_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c09_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c10_r1.htm")) "SANSA") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c11_r1.htm")) "THE KRAKEN’S DAUGHTER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c12_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c13_r1.htm")) "THE SOILED KNIGHT") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c14_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c15_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c16_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c17_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c18_r1.htm")) "THE IRON CAPTAIN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c19_r1.htm")) "THE DROWNED MAN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c20_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c21_r1.htm")) "THE QUEENMAKER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c22_r1.htm")) "ARYA") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c23_r1.htm")) "ALAYNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c24_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c25_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c26_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c27_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c28_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c29_r1.htm")) "THE REAVER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c30_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c31_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c32_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c33_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c34_r1.htm")) "CAT OF THE CANALS") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c35_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c36_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c37_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c38_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c39_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c40_r1.htm")) "THE PRINCESS IN THE TOWER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c41_r1.htm")) "ALAYNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c42_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c43_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c44_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c45_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c46_r1.htm")) "MEANWHILE, BACK ON THE WALL . . .") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app1_r1.htm")) "APPENDIX I: THE KINGS AND THEIR COURTS") "\n" (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app1_r1.htm#app1s01.01")) "THE QUEEN REGENT") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app1_r1.htm#app1s01.02")) "THE KING AT THE WALL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app1_r1.htm#app1s01.03")) "KING OF THE ISLES AND THE NORTH") "\n") "\n")) "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm")) "APPENDIX II: OTHER HOUSES GREAT AND SMALL") "\n" (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.01")) "HOUSE ARRYN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.02")) "HOUSE FLORENT") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.03")) "HOUSE FREY") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.04")) "HOUSE HIGHTOWER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.05")) "HOUSE LANNISTER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.06")) "HOUSE MARTELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.07")) "HOUSE STARK") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.08")) "HOUSE TULLY") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.09")) "HOUSE TYRELL") "\n") "\n")) "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm")) "APPENDIX III: REBELS AND ROGUES SMALLFOLK AND SWORN BROTHERS") "\n" (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm#app3s01.01")) "LORDLINGS, WANDERERS, AND COMMON MEN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm#app3s01.02")) "OUTLAWS AND BROKEN MEN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm#app3s01.03")) "THE SWORN BROTHERS OF THE NIGHT’S WATCH") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm#app3s01.04")) "THE WILDLINGS, OR THE FREE FOLK") "\n") "\n")) "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app4_r1.htm")) "APPENDIX IV: BEYOND THE NARROW SEA") "\n" (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app4_r1.htm#app4s01.01")) "THE QUEEN ACROSS THE WATER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app4_r1.htm#app4s01.02")) "IN BRAAVOS") "\n") "\n")) "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_ack_r1.htm")) "ACKNOWLEDGMENTS") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_ata_r1.htm")) "ABOUT THE AUTHOR") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_adc_r1.htm")) "ALSO BY GEORGE R.R. MARTIN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_bm1_r1.htm")) "EXCERPT FROM A DANCE WITH DRAGONS") "\n") "\n"))))
  shr-render-region(1 6661)
  (progn (fset 'shr-tag-img 'nov-render-img) (shr-render-region (point-min) (point-max)))
  (unwind-protect (progn (fset 'shr-tag-img 'nov-render-img) (shr-render-region (point-min) (point-max))) (fset 'shr-tag-img old))
  (let* ((old (symbol-function 'shr-tag-img))) (unwind-protect (progn (fset 'shr-tag-img 'nov-render-img) (shr-render-region (point-min) (point-max))) (fset 'shr-tag-img old)))
  (let ((shr-map nov-mode-map) (shr-external-rendering-functions nov-shr-rendering-functions) (shr-use-fonts nov-variable-pitch) (shr-width nov-text-width)) (let* ((old (symbol-function 'shr-tag-img))) (unwind-protect (progn (fset 'shr-tag-img 'nov-render-img) (shr-render-region (point-min) (point-max))) (fset 'shr-tag-img old))))
  nov-render-html()
  funcall(nov-render-html)
  (progn (funcall nov-render-html-function))
  (if (not imagep) (progn (funcall nov-render-html-function)))
  (let* ((document (aref nov-documents nov-documents-index)) (id (car document)) (path (cdr document)) (imagep (let (needle) (let ((list image-type-file-name-regexps) (continue t) (it-index 0)) (while (and list continue) (let ((it (car list))) (if (not (not needle)) (setq continue nil) (if (string-match-p (car it) path) (progn (setq needle it))))) (setq it-index (1+ it-index)) (setq list (cdr list)))) needle)) (default-directory (file-name-directory path)) buffer-read-only) (erase-buffer) (cond (imagep (nov-insert-image path "")) ((and (version< nov-epub-version "3.0") (eq id nov-toc-id)) (insert (nov-ncx-to-html path))) (t (insert (nov-slurp path)))) (if (not imagep) (progn (funcall nov-render-html-function))) (goto-char (point-min)))
  nov-render-document()
  (if place (let ((index (cdr (assq 'index place))) (point (cdr (assq 'point place)))) (if (nov--index-valid-p nov-documents index) (progn (setq nov-documents-index index) (nov-render-document) (goto-char point)) (warn "Couldn't restore last position") (nov-render-document))) (nov-render-document))
  (let ((place (nov-saved-place (cdr (assq 'identifier nov-metadata))))) (if place (let ((index (cdr (assq 'index place))) (point (cdr (assq 'point place)))) (if (nov--index-valid-p nov-documents index) (progn (setq nov-documents-index index) (nov-render-document) (goto-char point)) (warn "Couldn't restore last position") (nov-render-document))) (nov-render-document)))
  (let ((delay-mode-hooks t)) (special-mode) (setq major-mode 'nov-mode) (setq mode-name "EPUB") (progn (if (get 'special-mode 'mode-class) (put 'nov-mode 'mode-class (get 'special-mode 'mode-class))) (if (keymap-parent nov-mode-map) nil (set-keymap-parent nov-mode-map (current-local-map))) (let ((parent (char-table-parent nov-mode-syntax-table))) (if (and parent (not (eq parent (standard-syntax-table)))) nil (set-char-table-parent nov-mode-syntax-table (syntax-table)))) (if (or (abbrev-table-get nov-mode-abbrev-table :parents) (eq nov-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put nov-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map nov-mode-map) (set-syntax-table nov-mode-syntax-table) (setq local-abbrev-table nov-mode-abbrev-table) (add-hook 'kill-buffer-hook 'nov-clean-up nil t) (add-hook 'kill-emacs-hook 'nov-clean-up-all) (add-hook 'change-major-mode-hook 'nov-clean-up nil t) (if (not buffer-file-name) (progn (error "EPUB must be associated with file"))) (setq nov-temp-dir (make-temp-file "nov-" t ".epub")) (let ((exit-code (nov-unzip-epub nov-temp-dir buffer-file-name))) (if (not (integerp exit-code)) (progn (nov-clean-up) (error "EPUB extraction aborted by signal %s" exit-code))) (if (not (= 0 exit-code)) (progn (nov-clean-up) (error "EPUB extraction failed with exit code %d" exit-code)))) (if (not (nov-epub-valid-p nov-temp-dir)) (progn (nov-clean-up) (error "Invalid EPUB file"))) (let* ((content (nov-slurp (nov-container-filename nov-temp-dir) t)) (content-file (nov-make-path nov-temp-dir (nov-container-content-filename content))) (work-dir (file-name-directory content-file)) (content (nov-slurp content-file t))) (setq nov-content-file content-file) (setq nov-epub-version (nov-content-version content)) (setq nov-metadata (nov-content-metadata content)) (setq nov-documents (apply 'vector (nov-content-files work-dir content))) (setq nov-documents-index 0)) (setq buffer-undo-list t) (setq nov-file-name (buffer-file-name)) (set-visited-file-name nil t) (let ((place (nov-saved-place (cdr (assq 'identifier nov-metadata))))) (if place (let ((index (cdr (assq 'index place))) (point (cdr (assq 'point place)))) (if (nov--index-valid-p nov-documents index) (progn (setq nov-documents-index index) (nov-render-document) (goto-char point)) (warn "Couldn't restore last position") (nov-render-document))) (nov-render-document))))
  (progn (make-local-variable 'delay-mode-hooks) (let ((delay-mode-hooks t)) (special-mode) (setq major-mode 'nov-mode) (setq mode-name "EPUB") (progn (if (get 'special-mode 'mode-class) (put 'nov-mode 'mode-class (get 'special-mode 'mode-class))) (if (keymap-parent nov-mode-map) nil (set-keymap-parent nov-mode-map (current-local-map))) (let ((parent (char-table-parent nov-mode-syntax-table))) (if (and parent (not (eq parent (standard-syntax-table)))) nil (set-char-table-parent nov-mode-syntax-table (syntax-table)))) (if (or (abbrev-table-get nov-mode-abbrev-table :parents) (eq nov-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put nov-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map nov-mode-map) (set-syntax-table nov-mode-syntax-table) (setq local-abbrev-table nov-mode-abbrev-table) (add-hook 'kill-buffer-hook 'nov-clean-up nil t) (add-hook 'kill-emacs-hook 'nov-clean-up-all) (add-hook 'change-major-mode-hook 'nov-clean-up nil t) (if (not buffer-file-name) (progn (error "EPUB must be associated with file"))) (setq nov-temp-dir (make-temp-file "nov-" t ".epub")) (let ((exit-code (nov-unzip-epub nov-temp-dir buffer-file-name))) (if (not (integerp exit-code)) (progn (nov-clean-up) (error "EPUB extraction aborted by signal %s" exit-code))) (if (not (= 0 exit-code)) (progn (nov-clean-up) (error "EPUB extraction failed with exit code %d" exit-code)))) (if (not (nov-epub-valid-p nov-temp-dir)) (progn (nov-clean-up) (error "Invalid EPUB file"))) (let* ((content (nov-slurp (nov-container-filename nov-temp-dir) t)) (content-file (nov-make-path nov-temp-dir (nov-container-content-filename content))) (work-dir (file-name-directory content-file)) (content (nov-slurp content-file t))) (setq nov-content-file content-file) (setq nov-epub-version (nov-content-version content)) (setq nov-metadata (nov-content-metadata content)) (setq nov-documents (apply 'vector (nov-content-files work-dir content))) (setq nov-documents-index 0)) (setq buffer-undo-list t) (setq nov-file-name (buffer-file-name)) (set-visited-file-name nil t) (let ((place (nov-saved-place (cdr (assq 'identifier nov-metadata))))) (if place (let ((index (cdr (assq 'index place))) (point (cdr (assq 'point place)))) (if (nov--index-valid-p nov-documents index) (progn (setq nov-documents-index index) (nov-render-document) (goto-char point)) (warn "Couldn't restore last position") (nov-render-document))) (nov-render-document)))))
  nov-mode()
  set-auto-mode-0(nov-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer 04 A Feast for Crows - George R R Martin.epub> "~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" nil nil "~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" (15790022 50))
  find-file-noselect("~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" nil nil t)
  find-file("~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" t)
  funcall-interactively(find-file "~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" t)
  call-interactively(find-file nil nil)
  command-execute(find-file)
Debugger entered--Lisp error: (args-out-of-range nil 256204778801521549)
  vertical-motion((256204778801521549 . 0))
  shr-vertical-motion(2305843009213693943)
  shr-fill-line()
  shr-fill-lines(1 1482)
  shr-insert-document((html nil (body nil (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_cvi_r1.htm#b04-cvi")) "COVER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_tp_r1.htm")) "TITLE PAGE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_cop_r1.htm")) "COPYRIGHT") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_qts_r1.htm")) "PRAISE FOR GEORGE R. R. MARTIN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_toc_r1.htm")) "CONTENTS") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_ded_r1.htm")) "DEDICATION") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_fm_r1.htm")) "MAP") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_prl_r1.htm")) "PROLOGUE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c01_r1.htm")) "THE PROPHET") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c02_r1.htm")) "THE CAPTAIN OF GUARDS") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c03_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c04_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c05_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c06_r1.htm")) "ARYA") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c07_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c08_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c09_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c10_r1.htm")) "SANSA") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c11_r1.htm")) "THE KRAKEN’S DAUGHTER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c12_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c13_r1.htm")) "THE SOILED KNIGHT") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c14_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c15_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c16_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c17_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c18_r1.htm")) "THE IRON CAPTAIN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c19_r1.htm")) "THE DROWNED MAN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c20_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c21_r1.htm")) "THE QUEENMAKER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c22_r1.htm")) "ARYA") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c23_r1.htm")) "ALAYNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c24_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c25_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c26_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c27_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c28_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c29_r1.htm")) "THE REAVER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c30_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c31_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c32_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c33_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c34_r1.htm")) "CAT OF THE CANALS") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c35_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c36_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c37_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c38_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c39_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c40_r1.htm")) "THE PRINCESS IN THE TOWER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c41_r1.htm")) "ALAYNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c42_r1.htm")) "BRIENNE") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c43_r1.htm")) "CERSEI") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c44_r1.htm")) "JAIME") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c45_r1.htm")) "SAMWELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_c46_r1.htm")) "MEANWHILE, BACK ON THE WALL . . .") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app1_r1.htm")) "APPENDIX I: THE KINGS AND THEIR COURTS") "\n" (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app1_r1.htm#app1s01.01")) "THE QUEEN REGENT") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app1_r1.htm#app1s01.02")) "THE KING AT THE WALL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app1_r1.htm#app1s01.03")) "KING OF THE ISLES AND THE NORTH") "\n") "\n")) "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm")) "APPENDIX II: OTHER HOUSES GREAT AND SMALL") "\n" (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.01")) "HOUSE ARRYN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.02")) "HOUSE FLORENT") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.03")) "HOUSE FREY") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.04")) "HOUSE HIGHTOWER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.05")) "HOUSE LANNISTER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.06")) "HOUSE MARTELL") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.07")) "HOUSE STARK") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.08")) "HOUSE TULLY") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app2_r1.htm#app2s01.09")) "HOUSE TYRELL") "\n") "\n")) "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm")) "APPENDIX III: REBELS AND ROGUES SMALLFOLK AND SWORN BROTHERS") "\n" (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm#app3s01.01")) "LORDLINGS, WANDERERS, AND COMMON MEN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm#app3s01.02")) "OUTLAWS AND BROKEN MEN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm#app3s01.03")) "THE SWORN BROTHERS OF THE NIGHT’S WATCH") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app3_r1.htm#app3s01.04")) "THE WILDLINGS, OR THE FREE FOLK") "\n") "\n")) "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app4_r1.htm")) "APPENDIX IV: BEYOND THE NARROW SEA") "\n" (ol nil (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app4_r1.htm#app4s01.01")) "THE QUEEN ACROSS THE WATER") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_app4_r1.htm#app4s01.02")) "IN BRAAVOS") "\n") "\n")) "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_ack_r1.htm")) "ACKNOWLEDGMENTS") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_ata_r1.htm")) "ABOUT THE AUTHOR") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_adc_r1.htm")) "ALSO BY GEORGE R.R. MARTIN") "\n") "\n" (li nil "\n" (a ((href . "Text/Mart_9780553900323_epub_bm1_r1.htm")) "EXCERPT FROM A DANCE WITH DRAGONS") "\n") "\n"))))
  shr-render-region(1 6661)
  (progn (fset 'shr-tag-img 'nov-render-img) (shr-render-region (point-min) (point-max)))
  (unwind-protect (progn (fset 'shr-tag-img 'nov-render-img) (shr-render-region (point-min) (point-max))) (fset 'shr-tag-img old))
  (let* ((old (symbol-function 'shr-tag-img))) (unwind-protect (progn (fset 'shr-tag-img 'nov-render-img) (shr-render-region (point-min) (point-max))) (fset 'shr-tag-img old)))
  (let ((shr-map nov-mode-map) (shr-external-rendering-functions nov-shr-rendering-functions) (shr-use-fonts nov-variable-pitch) (shr-width nov-text-width)) (let* ((old (symbol-function 'shr-tag-img))) (unwind-protect (progn (fset 'shr-tag-img 'nov-render-img) (shr-render-region (point-min) (point-max))) (fset 'shr-tag-img old))))
  nov-render-html()
  funcall(nov-render-html)
  (progn (funcall nov-render-html-function))
  (if (not imagep) (progn (funcall nov-render-html-function)))
  (let* ((document (aref nov-documents nov-documents-index)) (id (car document)) (path (cdr document)) (imagep (let (needle) (let ((list image-type-file-name-regexps) (continue t) (it-index 0)) (while (and list continue) (let ((it (car list))) (if (not (not needle)) (setq continue nil) (if (string-match-p (car it) path) (progn (setq needle it))))) (setq it-index (1+ it-index)) (setq list (cdr list)))) needle)) (default-directory (file-name-directory path)) buffer-read-only) (erase-buffer) (cond (imagep (nov-insert-image path "")) ((and (version< nov-epub-version "3.0") (eq id nov-toc-id)) (insert (nov-ncx-to-html path))) (t (insert (nov-slurp path)))) (if (not imagep) (progn (funcall nov-render-html-function))) (goto-char (point-min)))
  nov-render-document()
  (if place (let ((index (cdr (assq 'index place))) (point (cdr (assq 'point place)))) (if (nov--index-valid-p nov-documents index) (progn (setq nov-documents-index index) (nov-render-document) (goto-char point)) (warn "Couldn't restore last position") (nov-render-document))) (nov-render-document))
  (let ((place (nov-saved-place (cdr (assq 'identifier nov-metadata))))) (if place (let ((index (cdr (assq 'index place))) (point (cdr (assq 'point place)))) (if (nov--index-valid-p nov-documents index) (progn (setq nov-documents-index index) (nov-render-document) (goto-char point)) (warn "Couldn't restore last position") (nov-render-document))) (nov-render-document)))
  (let ((delay-mode-hooks t)) (special-mode) (setq major-mode 'nov-mode) (setq mode-name "EPUB") (progn (if (get 'special-mode 'mode-class) (put 'nov-mode 'mode-class (get 'special-mode 'mode-class))) (if (keymap-parent nov-mode-map) nil (set-keymap-parent nov-mode-map (current-local-map))) (let ((parent (char-table-parent nov-mode-syntax-table))) (if (and parent (not (eq parent (standard-syntax-table)))) nil (set-char-table-parent nov-mode-syntax-table (syntax-table)))) (if (or (abbrev-table-get nov-mode-abbrev-table :parents) (eq nov-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put nov-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map nov-mode-map) (set-syntax-table nov-mode-syntax-table) (setq local-abbrev-table nov-mode-abbrev-table) (add-hook 'kill-buffer-hook 'nov-clean-up nil t) (add-hook 'kill-emacs-hook 'nov-clean-up-all) (add-hook 'change-major-mode-hook 'nov-clean-up nil t) (if (not buffer-file-name) (progn (error "EPUB must be associated with file"))) (setq nov-temp-dir (make-temp-file "nov-" t ".epub")) (let ((exit-code (nov-unzip-epub nov-temp-dir buffer-file-name))) (if (not (integerp exit-code)) (progn (nov-clean-up) (error "EPUB extraction aborted by signal %s" exit-code))) (if (not (= 0 exit-code)) (progn (nov-clean-up) (error "EPUB extraction failed with exit code %d" exit-code)))) (if (not (nov-epub-valid-p nov-temp-dir)) (progn (nov-clean-up) (error "Invalid EPUB file"))) (let* ((content (nov-slurp (nov-container-filename nov-temp-dir) t)) (content-file (nov-make-path nov-temp-dir (nov-container-content-filename content))) (work-dir (file-name-directory content-file)) (content (nov-slurp content-file t))) (setq nov-content-file content-file) (setq nov-epub-version (nov-content-version content)) (setq nov-metadata (nov-content-metadata content)) (setq nov-documents (apply 'vector (nov-content-files work-dir content))) (setq nov-documents-index 0)) (setq buffer-undo-list t) (setq nov-file-name (buffer-file-name)) (set-visited-file-name nil t) (let ((place (nov-saved-place (cdr (assq 'identifier nov-metadata))))) (if place (let ((index (cdr (assq 'index place))) (point (cdr (assq 'point place)))) (if (nov--index-valid-p nov-documents index) (progn (setq nov-documents-index index) (nov-render-document) (goto-char point)) (warn "Couldn't restore last position") (nov-render-document))) (nov-render-document))))
  (progn (make-local-variable 'delay-mode-hooks) (let ((delay-mode-hooks t)) (special-mode) (setq major-mode 'nov-mode) (setq mode-name "EPUB") (progn (if (get 'special-mode 'mode-class) (put 'nov-mode 'mode-class (get 'special-mode 'mode-class))) (if (keymap-parent nov-mode-map) nil (set-keymap-parent nov-mode-map (current-local-map))) (let ((parent (char-table-parent nov-mode-syntax-table))) (if (and parent (not (eq parent (standard-syntax-table)))) nil (set-char-table-parent nov-mode-syntax-table (syntax-table)))) (if (or (abbrev-table-get nov-mode-abbrev-table :parents) (eq nov-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put nov-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map nov-mode-map) (set-syntax-table nov-mode-syntax-table) (setq local-abbrev-table nov-mode-abbrev-table) (add-hook 'kill-buffer-hook 'nov-clean-up nil t) (add-hook 'kill-emacs-hook 'nov-clean-up-all) (add-hook 'change-major-mode-hook 'nov-clean-up nil t) (if (not buffer-file-name) (progn (error "EPUB must be associated with file"))) (setq nov-temp-dir (make-temp-file "nov-" t ".epub")) (let ((exit-code (nov-unzip-epub nov-temp-dir buffer-file-name))) (if (not (integerp exit-code)) (progn (nov-clean-up) (error "EPUB extraction aborted by signal %s" exit-code))) (if (not (= 0 exit-code)) (progn (nov-clean-up) (error "EPUB extraction failed with exit code %d" exit-code)))) (if (not (nov-epub-valid-p nov-temp-dir)) (progn (nov-clean-up) (error "Invalid EPUB file"))) (let* ((content (nov-slurp (nov-container-filename nov-temp-dir) t)) (content-file (nov-make-path nov-temp-dir (nov-container-content-filename content))) (work-dir (file-name-directory content-file)) (content (nov-slurp content-file t))) (setq nov-content-file content-file) (setq nov-epub-version (nov-content-version content)) (setq nov-metadata (nov-content-metadata content)) (setq nov-documents (apply 'vector (nov-content-files work-dir content))) (setq nov-documents-index 0)) (setq buffer-undo-list t) (setq nov-file-name (buffer-file-name)) (set-visited-file-name nil t) (let ((place (nov-saved-place (cdr (assq 'identifier nov-metadata))))) (if place (let ((index (cdr (assq 'index place))) (point (cdr (assq 'point place)))) (if (nov--index-valid-p nov-documents index) (progn (setq nov-documents-index index) (nov-render-document) (goto-char point)) (warn "Couldn't restore last position") (nov-render-document))) (nov-render-document)))))
  nov-mode()
  set-auto-mode-0(nov-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer 04 A Feast for Crows - George R R Martin.epub> "~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" nil nil "~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" (15790022 50))
  find-file-noselect("~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" nil nil t)
  find-file("~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" t)
  funcall-interactively(find-file "~/book/literature/fantasy/A Song of Ice and Fire - George R R Martin (EPUB)/04 A Feast for Crows - George R R Martin.epub" t)
  call-interactively(find-file nil nil)
  command-execute(find-file)

Here is the value of system-configuration-options: "--prefix=/nix/store/ccd0cnxkiqgshd2ic5x2wsrz4wn6inak-emacs-26.1 --with-modules --with-x-toolkit=gtk3 --with-xft CFLAGS=-DMAC_OS_X_VERSION_MAX_ALLOWED=101200"

wasamasa commented 5 years ago

One more thing that would help would be having the actual EPUB triggering this at hand, so please send me it. Who knows, maybe it has excessively long paragraphs or something...

I've been able to trigger the error by manually evaluating the last few lines of the backtrace, but not by merely viewing an EPUB.

bricewge commented 5 years ago

I have send you an email with some of the books failing,

wasamasa commented 5 years ago

Debugging this a bit further, I suspect this is a matter of the font rendering, meaning it depends on the font family, size, window width and who knows what else. I'll come up with an alternative way to disable filling in shr.el.

wasamasa commented 5 years ago

So yeah, there it is. Set nov-text-width to t. Bonus: Rendering is faster because filling is skipped completely.