wasamasa / nov.el

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

most-positive-fixnum is too big #51

Closed tboevil closed 4 years ago

tboevil commented 5 years ago
Debugger entered--Lisp error: (args-out-of-range nil 2305843009213693951)
  vertical-motion((2305843009213693951 . 0))
  shr-vertical-motion(2305843009213693951)
  shr-fill-line()
  shr-fill-lines(1 5339)
  shr-insert-document((html ((xmlns . "http://www.w3.org/1999/xhtml")) (head nil (title nil "Programming Elixir ≥ 1.6") (link ((rel . "stylesheet") (type . "text/css") (href . "css/bookshelf.css"))) (link ((rel . "stylesheet") (type . "text/css") (href . "css/book_local.css")))) (body nil "\n" (h2 ((id . "d25e218")) "Programming Should Be About Transforming Data") "\n" (p ((id . "d25e221")) "\nIf you come from an object-oriented world, then you are\nused to thinking in terms of classes and their instances. A class\ndefines behavior, and objects hold state. Developers spend time coming\nup with intricate hierarchies of classes that try to model their\nproblem, much as Victorian scientists created taxonomies of\nbutterflies.") "\n" (p ((id . "d25e225")) "\nWhen we code with objects, we’re thinking about state. Much of our\ntime is spent calling methods in objects and passing them other\nobjects. Based on these calls, objects update their own state, and\npossibly the state of other objects. In this world, the class is\nking—it defines what each instance can do, and it implicitly controls\nthe state of the data its instances hold. Our goal is data-hiding.") "\n" (p ((id . "d25e236")) "But that’s not the real world. In the real world, we don’t want to\nmodel abstract hierarchies (because in reality there aren’t that\nmany true hierarchies). We want to get things done,\nnot maintain state.") "\n" (p ((id . "d25e238")) "Right now, for instance, I’m taking empty computer files and transforming them into files\ncontaining text. Soon I’ll transform those files into a\nformat you can read. A web server somewhere will transform your\nrequest to download the book into an HTTP response containing the\ncontent.") "\n" (p ((id . "d25e240")) "I don’t want to hide data. I want to transform it.") (h3 nil "Combine Transformations with Pipelines") "\n" (p ((id . "d25e245")) "\n\n\n\nUnix users are accustomed to the philosophy of small, focused command-line\ntools that can be combined in arbitrary ways. Each tool takes an\ninput, transforms it, and writes the result in a format the next\ntool (or a human) can use.") "\n" (p ((id . "d25e273")) "This philosophy is incredibly flexible and leads to fantastic\nreuse. The Unix utilities can be combined in ways undreamed of by\ntheir authors. And each one multiplies the potential of the others.") "\n" (p ((id . "d25e275")) "It’s also highly reliable—each small program does one thing well,\nwhich makes it easier to test.") "\n" (p ((id . "d25e277")) "\nThere’s another benefit. A command pipeline can operate in\nparallel. If I write") (table ((shr-fixed-table . t) (shr-suggested-widths ((2 . 2) (51 . 51)))) (tr nil (td ((class . "codeinfo") (shr-td-cache-natural . 2) (shr-td-cache-1152921504606846976-nil 2 2 1 ... 1 nil nil)) "​" (span (...) " ")) (td ((class . "codeline") (shr-td-cache-natural . 51) (shr-td-cache-1152921504606846976-nil 51 51 1 ... 1 nil nil)) "​" (span (...) "$ ") "​​" (strong (...) "grep") "​​" (strong (...) " ") "​​" (strong (...) "Elixir") "​​" (strong (...) " ") "​​" (strong (...) "*.pml") "​​" (strong (...) " ") "​​" (strong (...) "|") "​​" (strong (...) " ") "​​" (strong (...) "wc") "​​" (strong (...) " ") "​​" (strong (...) "-l") "​"))) (p ((id . "d25e309")) "the word-count program, " (span ((class . "cf ic")) "wc") ", runs at the same time as the " (span ((class . "cf ic")) "grep") "\ncommand. Because " (span ((class . "cf ic")) "wc") " consumes " (span ((class . "cf ic")) "grep") "’s output as it is produced, the\nanswer is ready with virtually no delay once " (span ((class . "cf ic")) "grep") " finishes.") "\n" (p ((id . "d25e326")) "\n\n\nJust to give you a taste of this, here’s an Elixir\nfunction called " (span ((class . "cf ic")) "pmap") ". It takes a collection and a function, and\nreturns the list that results from applying that function to each\nelement of the collection. But…it runs a separate process to do the\nconversion of each element. Don’t worry about the details for now.") (div ((class . "livecodelozenge")) (a ((href . "http://media.pragprog.com/titles/elixir16/code/spawn/pmap1.exs")) "spawn/pmap1.exs")) (table ((shr-fixed-table . t) (shr-suggested-widths ((2 . 2) (25 . 25)) ((2 . 2) (33 . 33)) ((2 . 2) (10 . 10)) ((2 . 2) (51 . 51)) ((2 . 2) (26 . 26)) ((2 . 2) (5 . 5)) ((2 . 2) (5 . 5)))) (tr nil (td ((class . "codeinfo") (shr-td-cache-natural . 2) (shr-td-cache-1152921504606846976-nil 2 2 1 ... 1 nil nil)) "​" (span (...) " ")) (td ((class . "codeline") (shr-td-cache-natural . 25) (shr-td-cache-1152921504606846976-nil 25 25 1 ... 1 nil nil)) "​" (strong (...) "defmodule") "​ Parallel ​" (strong (...) "do") "​")) (tr nil (td ((class . "codeinfo") (shr-td-cache-natural . 2) (shr-td-cache-1152921504606846976-nil 2 2 1 ... 1 nil nil)) "​" (span (...) " ")) (td ((class . "codeline") (shr-td-cache-natural . 33) (shr-td-cache-1152921504606846976-nil 33 33 1 ... 1 nil nil)) "  ​" (strong (...) "def") "​ pmap(collection, func) ​" (strong (...) "do") "​")) (tr nil (td ((class . "codeinfo") (shr-td-cache-natural . 2) (shr-td-cache-1152921504606846976-nil 2 2 1 ... 1 nil nil)) "​" (span (...) " ")) (td ((class . "codeline") (shr-td-cache-natural . 10) (shr-td-cache-1152921504606846976-nil 10 10 1 ... 1 nil nil)) "    collection")) (tr nil (td ((class . "codeinfo") (shr-td-cache-natural . 2) (shr-td-cache-1152921504606846976-nil 2 2 1 ... 1 nil nil)) "​" (span (...) " ")) (td ((class . "codeline") (shr-td-cache-natural . 51) (shr-td-cache-1152921504606846976-nil 51 51 1 ... 1 nil nil)) "    |> Enum.map(&(Task.async(​" (strong (...) "fn") "​ -> func.(&1) ​" (strong (...) "end") "​)))")) (tr nil (td ((class . "codeinfo") (shr-td-cache-natural . 2) (shr-td-cache-1152921504606846976-nil 2 2 1 ... 1 nil nil)) "​" (span (...) " ")) (td ((class . "codeline") (shr-td-cache-natural . 26) (shr-td-cache-1152921504606846976-nil 26 26 1 ... 1 nil nil)) "    |> Enum.map(&Task.await/1)")) (tr nil (td ((class . "codeinfo") (shr-td-cache-natural . 2) (shr-td-cache-1152921504606846976-nil 2 2 1 ... 1 nil nil)) "​" (span (...) " ")) (td ((class . "codeline") (shr-td-cache-natural . 5) (shr-td-cache-1152921504606846976-nil 5 5 1 ... 1 nil nil)) "  ​" (strong (...) "end") "​")) (tr nil (td ((class . "codeinfo") (shr-td-cache-natural . 2) (shr-td-cache-1152921504606846976-nil 2 2 1 ... 1 nil nil)) "​" (span (...) " ")) (td ((class . "codeline") (shr-td-cache-natural . 5) (shr-td-cache-1152921504606846976-nil 5 5 1 ... 1 nil nil)) "​" (strong (...) "end") "​"))) (p ((id . "d25e377")) "We could run this function to get the squares of the numbers from 1 to\n1,000.") (table ((shr-fixed-table . t) (shr-suggested-widths ((2 . 2) (44 . 44)))) (tr nil (td ((class . "codeinfo") (shr-td-cache-natural . 2) (shr-td-cache-1152921504606846976-nil 2 2 1 ... 1 nil nil)) "​" (span (...) " ")) (td ((class . "codeline") (shr-td-cache-natural . 44) (shr-td-cache-1152921504606846976-nil 44 44 1 ... 1 nil nil)) "result = Parallel.pmap 1..1000, &(&1 ​" (strong (...) "*") "​ &1)"))) (p ((id . "d25e386")) "And, yes, I just kicked off 1,000 background processes, and I used all\nthe cores and processors on my machine.") "\n" (p ((id . "d25e388")) "The code may not make much sense, but by about halfway through the\nbook, you’ll be writing this kind of thing for yourself.") (h3 nil "Functions Are Data Transformers") "\n" (p ((id . "d25e393")) "\nElixir lets us solve the problem in the same way the Unix shell\ndoes. Rather than have command-line utilities, we have functions. And\nwe can string them together as we please. The smaller—more\nfocused—those functions, the more flexibility we have when combining\nthem.") "\n" (p ((id . "d25e399")) "\n\n\n\n\n\nIf we want, we can make these functions run in parallel—Elixir has a\nsimple but powerful mechanism for passing messages between them. And\nthese are not your father’s boring old processes or threads—we’re\ntalking about the potential to run millions of them on a single\nmachine and have hundreds of these machines interoperating. Bruce\nTate commented on this paragraph with this thought: “Most programmers treat threads\nand processes as a necessary evil; Elixir developers feel they are an\nimportant simplification.” As we get deeper into the book, you’ll\nstart to see what he means.") "\n" (p ((id . "d25e422")) "This idea of transformation lies at the heart of functional\nprogramming: a function transforms its inputs into its output. The\ntrigonometric function " (span ((class . "emph")) "sin") " is an example—give it\n" (span ((style . "font-family:Quivira;")) "π") "/4, and you’ll get\nback 0.7071. An HTML templating system is a function; it takes a\ntemplate containing placeholders and a list of named\nvalues, and produces a completed HTML document.") "\n" (p ((id . "d25e433")) "But this power comes at a price. You’re going to have to unlearn a\nwhole lot of what you " (span ((class . "emph")) "know") " about programming. Many of your instincts\nwill be wrong. And this will be frustrating, because you’re going to\nfeel like a total n00b.") "\n" (p ((id . "d25e438")) "Personally, I feel that’s part of the fun.\nYou didn’t learn, say, object-oriented programming overnight. You are\nunlikely to become a functional programming expert by breakfast,\neither.") "\n" (p ((id . "d25e440")) "But at some point things will click. You’ll start thinking about\nproblems in a different way, and you’ll find yourself writing code\nthat does amazing things with very little effort on your part. You’ll\nfind yourself writing small chunks of code that can be used over and\nover, often in unexpected ways (just as " (span ((class . "cf ic")) "wc") " and " (span ((class . "cf ic")) "grep") " can be).") "\n" (p ((id . "d25e448")) "Your\nview of the world may even change a little as you stop thinking in terms of responsibilities and start thinking in terms of\ngetting things done.\nAnd just about everyone can agree that will be fun.\n\n\n\n") "\n")))
  shr-render-region(1 8047)
  nov-render-html()
  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 ProgrammingElixir.epub • book> "~/Documents/book/ProgrammingElixir.epub" nil nil "~/Documents/book/ProgrammingElixir.epub" (4771104 16777222))
  find-file-noselect("/Users/tboevil/Documents/book/ProgrammingElixir.epub")
  server-visit-files((("/Users/tboevil/Documents/book/ProgrammingElixir.epub")) #<process server <24>> nil)
  server-execute(#<process server <24>> (("/Users/tboevil/Documents/book/ProgrammingElixir.epub")) nil nil t #<frame F19 0x106672ed0> "/dev/ttys002")
  #f(compiled-function () #<bytecode 0x42747629>)()
  server-execute-continuation(#<process server <24>>)
  server-process-filter(#<process server <24>> "-env ALL_PROXY=http://127.0.0.1:6152 -env Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.11PLeZPvB7/Render -env COLORFGBG=12;8 -env COLORTERM=truecolor -env COMMAND_MODE=unix2003 -env EDITOR=emacsclient&_-t -env FTP_PROXY=http://127.0.0.1:6152 -env GEM_HOME=/Users/tboevil/.rvm/gems/ruby-2.5.5 -env GEM_PATH=/Users/tboevil/.rvm/gems/ruby-2.5.5:/Users/tboevil/.rvm/gems/ruby-2.5.5@global -env HOME=/Users/tboevil -env HTTPS_PROXY=http://127.0.0.1:6152 -env HTTP_PROXY=http://127.0.0.1:6152 -env ITERM_PROFILE=Hotkey&_Window -env ITERM_SESSION_ID=w0t3p1:DA0EFFBA-BFBF-4294-BD96-6FB9A517D499 -env LC_CTYPE=UTF-8 -env LOGNAME=tboevil -env NVM_BIN=/Users/tboevil/.nvm/versions/node/v11.10.1/bin -env NVM_CD_FLAGS= -env NVM_DIR=/Users/tboevil/.nvm -env OMF_CONFIG=/Users/tboevil/.config/omf -env OMF_PATH=/Users/tboevil/.local/share/omf -env PASSWORD_STORE_CHARACTER_SET=abcdefghijklmnopqrstuvwxyz1234567890,.\\+\\-()@:;* -env PATH=/Users/tboevil/.rvm/gems/ruby-2.5.5/bin:/Users/tboevil/.rvm/gems/ruby-2.5.5@global/bin:/Users/tboevil/.rvm/rubies/ruby-2.5.5/bin:/Users/tboevil/.nvm/versions/node/v11.10.1/bin:/Users/tboevil/.my_script/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/tboevil/.rvm/bin -env PWD=/Users/tboevil/.emacs.d/package -env RUBY_VERSION=ruby-2.5.5 -env SECURITYSESSIONID=186a8 -env SHELL=/usr/local/bin/fish -env SHLVL=1 -env SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.LFyMXlg29Q/Listeners -env TERM=xterm-256color -env TERM_PROGRAM=iTerm.app -env TERM_PROGRAM_VERSION=3.2.8 -env TERM_SESSION_ID=w0t3p1:DA0EFFBA-BFBF-4294-BD96-6FB9A517D499 -env TMPDIR=/var/folders/0r/r_0tt7wj1p1b9ysmy19sklph0000gn/T/ -env USER=tboevil -env XPC_FLAGS=0x0 -env XPC_SERVICE_NAME=0 -env __CF_USER_TEXT_ENCODING=0x0:0:0 -env all_proxy=http://127.0.0.1:6152 -env ftp_proxy=http://127.0.0.1:6152 -env http_proxy=http://127.0.0.1:6152 -env https_proxy=http://127.0.0.1:6152 -env rvm_bin_path=/Users/tboevil/.rvm/bin -env rvm_path=/Users/tboevil/.rvm -env rvm_prefix=/Users/tboevil -env rvm_version=1.29.7&_latest -dir /Users/tboevil/.emacs.d/package/ -tty /dev/ttys002 xterm-256color -file /Users/tboevil/Documents/book/ProgrammingElixir.epub \n")

I think should remove it from document

wasamasa commented 5 years ago

What exactly is the problem? Please provide a reproduction because I cannot reproduce this error. If it only happens for you, feel free to not use max-positive-fixnum.

tboevil commented 5 years ago

I mean, this number in the document is too big. Unusable in 64-bit systems will cause problems for some newcomers (such as me), so I suggest to modify the documentation.

wasamasa commented 5 years ago

It works perfectly fine in my 64bit system. Again, please show that there is a problem for other people than just you by providing reproduction instructions.

wasamasa commented 4 years ago

Closing due to lack of a reproducer.

bricewge commented 4 years ago

I have the same issue here too. I can provide more info if need be.

EDIT: #21 is the same issue.

wasamasa commented 4 years ago

I don't believe it's the same issue because you link to a vastly different issue that I've fixed two years ago. Please open a new thread with a full reproducer.

bricewge commented 4 years ago

Sorry I was referencing to #29.

wasamasa commented 4 years ago

Same thing really, this is an issue I fixed long time ago.