12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301 |
- (defvar texinfmt-version "2.42 of 7 Jul 2006")
- (defun texinfmt-version (&optional here)
- "Show the version of texinfmt.el in the minibuffer.
- If optional argument HERE is non-nil, insert info at point."
- (interactive "P")
- (let ((version-string
- (format "Version of \`texinfmt.el\': %s" texinfmt-version)))
- (if here
- (insert version-string)
- (if (called-interactively-p 'interactive)
- (message "%s" version-string)
- version-string))))
- (require 'texinfo)
- (require 'texnfo-upd)
- (defvar texinfo-vindex)
- (defvar texinfo-findex)
- (defvar texinfo-cindex)
- (defvar texinfo-pindex)
- (defvar texinfo-tindex)
- (defvar texinfo-kindex)
- (defvar texinfo-last-node)
- (defvar texinfo-node-names)
- (defvar texinfo-enclosure-list)
- (defvar texinfo-alias-list)
- (defvar texinfo-fold-nodename-case nil)
- (defvar texinfo-command-start)
- (defvar texinfo-command-end)
- (defvar texinfo-command-name)
- (defvar texinfo-defun-type)
- (defvar texinfo-last-node-pos)
- (defvar texinfo-stack)
- (defvar texinfo-short-index-cmds-alist)
- (defvar texinfo-short-index-format-cmds-alist)
- (defvar texinfo-format-filename)
- (defvar texinfo-footnote-number)
- (defvar texinfo-raisesections-alist
- '((@chapter . @chapter)
- (@unnumbered . @unnumbered)
- (@centerchap . @unnumbered)
- (@majorheading . @majorheading)
- (@chapheading . @chapheading)
- (@appendix . @appendix)
- (@section . @chapter)
- (@unnumberedsec . @unnumbered)
- (@heading . @chapheading)
- (@appendixsec . @appendix)
- (@subsection . @section)
- (@unnumberedsubsec . @unnumberedsec)
- (@subheading . @heading)
- (@appendixsubsec . @appendixsec)
- (@subsubsection . @subsection)
- (@unnumberedsubsubsec . @unnumberedsubsec)
- (@subsubheading . @subheading)
- (@appendixsubsubsec . @appendixsubsec))
- "*An alist of next higher levels for chapters, sections, etc...
- For example, section to chapter, subsection to section.
- Used by `texinfo-raise-lower-sections'.
- The keys specify types of section; the values correspond to the next
- higher types.")
- (defvar texinfo-lowersections-alist
- '((@chapter . @section)
- (@unnumbered . @unnumberedsec)
- (@centerchap . @unnumberedsec)
- (@majorheading . @heading)
- (@chapheading . @heading)
- (@appendix . @appendixsec)
- (@section . @subsection)
- (@unnumberedsec . @unnumberedsubsec)
- (@heading . @subheading)
- (@appendixsec . @appendixsubsec)
- (@subsection . @subsubsection)
- (@unnumberedsubsec . @unnumberedsubsubsec)
- (@subheading . @subsubheading)
- (@appendixsubsec . @appendixsubsubsec)
- (@subsubsection . @subsubsection)
- (@unnumberedsubsubsec . @unnumberedsubsubsec)
- (@subsubheading . @subsubheading)
- (@appendixsubsubsec . @appendixsubsubsec))
- "*An alist of next lower levels for chapters, sections, etc...
- For example, chapter to section, section to subsection.
- Used by `texinfo-raise-lower-sections'.
- The keys specify types of section; the values correspond to the next
- lower types.")
- (defvar texinfo-format-syntax-table
- (let ((st (make-syntax-table)))
- (modify-syntax-entry ?\" " " st)
- (modify-syntax-entry ?\\ " " st)
- (modify-syntax-entry ?@ "\\" st)
- (modify-syntax-entry ?\^q "\\" st)
- (modify-syntax-entry ?\[ "." st)
- (modify-syntax-entry ?\] "." st)
- (modify-syntax-entry ?\( "." st)
- (modify-syntax-entry ?\) "." st)
- (modify-syntax-entry ?{ "(}" st)
- (modify-syntax-entry ?} "){" st)
- (modify-syntax-entry ?\' "." st)
- st))
- ;;; Top level buffer and region formatting functions
- ;;;###autoload
- (defun texinfo-format-buffer (&optional nosplit)
- "Process the current buffer as texinfo code, into an Info file.
- The Info file output is generated in a buffer visiting the Info file
- name specified in the @setfilename command.
- Non-nil argument (prefix, if interactive) means don't make tag table
- and don't split the file if large. You can use `Info-tagify' and
- `Info-split' to do these manually."
- (interactive "P")
- (let ((lastmessage "Formatting Info file...")
- (coding-system-for-write buffer-file-coding-system))
- (message lastmessage)
- (widen)
- (texinfo-format-buffer-1)
- (Info-tagify)
- (if nosplit
- nil
- (if (> (buffer-size) (+ 50000 Info-split-threshold))
- (progn
- (message (setq lastmessage "Splitting Info file..."))
- (Info-split))))
- (message (concat lastmessage
- (if (called-interactively-p 'interactive)
- "done. Now save it." "done.")))))
- (defvar texinfo-region-buffer-name "*Info Region*"
- "*Name of the temporary buffer used by \\[texinfo-format-region].")
- (defvar texinfo-pre-format-hook nil
- "Hook called before the conversion of the Texinfo file to Info format.
- The functions on this hook are called with argument BUFFER, the buffer
- containing the Texinfo file.")
- ;; These come from tex-mode.el.
- (defvar tex-start-of-header)
- (defvar tex-end-of-header)
- ;;;###autoload
- (defun texinfo-format-region (region-beginning region-end)
- "Convert the current region of the Texinfo file to Info format.
- This lets you see what that part of the file will look like in Info.
- The command is bound to \\[texinfo-format-region]. The text that is
- converted to Info is stored in a temporary buffer."
- (interactive "r")
- (message "Converting region to Info format...")
- (let (texinfo-command-start
- texinfo-command-end
- texinfo-command-name
- texinfo-vindex
- texinfo-findex
- texinfo-cindex
- texinfo-pindex
- texinfo-tindex
- texinfo-kindex
- texinfo-stack
- (texinfo-format-filename "")
- texinfo-example-start
- texinfo-last-node-pos
- texinfo-last-node
- texinfo-node-names
- (texinfo-footnote-number 0)
- last-input-buffer
- (fill-column-for-info fill-column)
- (input-buffer (current-buffer))
- (input-directory default-directory)
- (header-text "")
- (header-beginning 1)
- (header-end 1))
- ;;; Copy lines between beginning and end of header lines,
- ;;; if any, or else copy the `@setfilename' line, if any.
- (save-excursion
- (save-restriction
- (widen)
- (goto-char (point-min))
- (let ((search-end (line-beginning-position 101)))
- (if (or
- ;; Either copy header text.
- (and
- (prog1
- (search-forward tex-start-of-header search-end t)
- (forward-line 1)
- ;; Mark beginning of header.
- (setq header-beginning (point)))
- (prog1
- (search-forward tex-end-of-header nil t)
- (beginning-of-line)
- ;; Mark end of header
- (setq header-end (point))))
- ;; Or copy @filename line.
- (prog2
- (goto-char (point-min))
- (search-forward "@setfilename" search-end t)
- (beginning-of-line)
- (setq header-beginning (point))
- (forward-line 1)
- (setq header-end (point))))
- ;; Copy header
- (setq header-text
- (buffer-substring-no-properties
- (min header-beginning region-beginning)
- header-end))))))
- ;;; Find a buffer to use.
- (switch-to-buffer (get-buffer-create texinfo-region-buffer-name))
- (setq buffer-read-only t)
- (let ((inhibit-read-only t))
- (erase-buffer)
- ;; Insert the header into the buffer.
- (insert header-text)
- ;; Insert the region into the buffer.
- (insert-buffer-substring
- input-buffer
- (max region-beginning header-end)
- region-end)
- (run-hook-with-args 'texinfo-pre-format-hook input-buffer)
- ;; Make sure region ends in a newline.
- (or (= (preceding-char) ?\n)
- (insert "\n"))
- (goto-char (point-min))
- (texinfo-mode)
- (message "Converting region to Info format...")
- (setq fill-column fill-column-for-info)
- ;; Install a syntax table useful for scanning command operands.
- (set-syntax-table texinfo-format-syntax-table)
- ;; Insert @include files so `texinfo-raise-lower-sections' can
- ;; work on them without losing track of multiple
- ;; @raise/@lowersections commands.
- (while (re-search-forward "^@include" nil t)
- (setq texinfo-command-end (point))
- (let ((filename (concat input-directory
- (texinfo-parse-line-arg))))
- (re-search-backward "^@include")
- (delete-region (point) (line-beginning-position 2))
- (message "Reading included file: %s" filename)
- (save-excursion
- (save-restriction
- (narrow-to-region
- (point)
- (+ (point) (car (cdr (insert-file-contents filename)))))
- (goto-char (point-min))
- ;; Remove `@setfilename' line from included file, if any,
- ;; so @setfilename command not duplicated.
- (if (re-search-forward "^@setfilename" (line-end-position 100) t)
- (delete-region (line-beginning-position 1)
- (line-beginning-position 2)))))))
- ;; Raise or lower level of each section, if necessary.
- (goto-char (point-min))
- (texinfo-raise-lower-sections)
- ;; Append @refill to appropriate paragraphs for filling.
- (goto-char (point-min))
- (texinfo-append-refill)
- ;; If the region includes the effective end of the data,
- ;; discard everything after that.
- (goto-char (point-max))
- (if (re-search-backward "^@bye" nil t)
- (delete-region (point) (point-max)))
- ;; Make sure buffer ends in a newline.
- (or (= (preceding-char) ?\n)
- (insert "\n"))
- ;; Don't use a previous value of texinfo-enclosure-list.
- (setq texinfo-enclosure-list nil)
- (setq texinfo-alias-list nil)
- (goto-char (point-min))
- (if (looking-at "\\\\input[ \t]+texinfo")
- (delete-region (point) (line-beginning-position 2)))
- ;; Insert Info region title text.
- (goto-char (point-min))
- (if (search-forward "@setfilename" (line-beginning-position 101) t)
- (progn
- (setq texinfo-command-end (point))
- (beginning-of-line)
- (setq texinfo-command-start (point))
- (let ((arg (texinfo-parse-arg-discard)))
- (insert " "
- texinfo-region-buffer-name
- " buffer for: `")
- (insert (file-name-nondirectory (expand-file-name arg)))
- (insert "', -*-Text-*-\n")))
- ;; Else no `@setfilename' line
- (insert " "
- texinfo-region-buffer-name
- " buffer -*-Text-*-\n"))
- (insert "produced by `texinfo-format-region'\n"
- "from a region in: "
- (if (buffer-file-name input-buffer)
- (concat "`"
- (file-name-sans-versions
- (file-name-nondirectory
- (buffer-file-name input-buffer)))
- "'")
- (concat "buffer `" (buffer-name input-buffer) "'"))
- "\nusing `texinfmt.el' version "
- texinfmt-version
- ".\n\n")
- ;; Now convert for real.
- (goto-char (point-min))
- (texinfo-format-scan)
- (goto-char (point-min))
- (Info-tagify input-buffer)
- (goto-char (point-min))
- (message "Done."))))
- ;;;###autoload
- (defun texi2info (&optional nosplit)
- "Convert the current buffer (written in Texinfo code) into an Info file.
- The Info file output is generated in a buffer visiting the Info file
- names specified in the @setfilename command.
- This function automatically updates all node pointers and menus, and
- creates a master menu. This work is done on a temporary buffer that
- is automatically removed when the Info file is created. The original
- Texinfo source buffer is not changed.
- Non-nil argument (prefix, if interactive) means don't split the file
- if large. You can use `Info-split' to do this manually."
- (interactive "P")
- (let ((temp-buffer (concat "*--" (buffer-name) "--temporary-buffer*" )))
- (message "First updating nodes and menus, then creating Info file.")
- ;; (sit-for 2)
- (copy-to-buffer temp-buffer (point-min) (point-max))
- (switch-to-buffer temp-buffer)
- (texinfo-master-menu t)
- (message "Now creating Info file.")
- (sit-for 2)
- (texinfo-format-buffer nosplit)
- (save-buffer)
- (kill-buffer temp-buffer)))
- ;;; Primary internal formatting function for the whole buffer.
- (defun texinfo-format-buffer-1 ()
- (let (texinfo-format-filename
- texinfo-example-start
- texinfo-command-start
- texinfo-command-end
- texinfo-command-name
- texinfo-last-node
- texinfo-last-node-pos
- texinfo-vindex
- texinfo-findex
- texinfo-cindex
- texinfo-pindex
- texinfo-tindex
- texinfo-kindex
- texinfo-stack
- texinfo-node-names
- (texinfo-footnote-number 0)
- last-input-buffer
- outfile
- (fill-column-for-info fill-column)
- (input-buffer (current-buffer))
- (input-directory default-directory))
- (setq texinfo-enclosure-list nil)
- (setq texinfo-alias-list nil)
- (save-excursion
- (goto-char (point-min))
- (or (search-forward "@setfilename" nil t)
- (error "Texinfo file needs an `@setfilename FILENAME' line"))
- (setq texinfo-command-end (point))
- (setq outfile (texinfo-parse-line-arg)))
- (find-file outfile)
- (texinfo-mode)
- (erase-buffer)
- (buffer-disable-undo)
- (message "Formatting Info file: %s" outfile)
- (setq texinfo-format-filename
- (file-name-nondirectory (expand-file-name outfile)))
- (setq fill-column fill-column-for-info)
- (set-syntax-table texinfo-format-syntax-table)
- (insert-buffer-substring input-buffer)
- (run-hook-with-args 'texinfo-pre-format-hook input-buffer)
- (message "Converting %s to Info format..." (buffer-name input-buffer))
- ;; Insert @include files so `texinfo-raise-lower-sections' can
- ;; work on them without losing track of multiple
- ;; @raise/@lowersections commands.
- (goto-char (point-min))
- (while (re-search-forward "^@include" nil t)
- (setq texinfo-command-end (point))
- (let ((filename (concat input-directory
- (texinfo-parse-line-arg))))
- (re-search-backward "^@include")
- (delete-region (point) (line-beginning-position 2))
- (message "Reading included file: %s" filename)
- (save-excursion
- (save-restriction
- (narrow-to-region
- (point)
- (+ (point) (car (cdr (insert-file-contents filename)))))
- (goto-char (point-min))
- ;; Remove `@setfilename' line from included file, if any,
- ;; so @setfilename command not duplicated.
- (if (re-search-forward "^@setfilename" (line-end-position 100) t)
- (delete-region (line-beginning-position 1)
- (line-beginning-position 2)))))))
- ;; Raise or lower level of each section, if necessary.
- (goto-char (point-min))
- (texinfo-raise-lower-sections)
- ;; Append @refill to appropriate paragraphs
- (goto-char (point-min))
- (texinfo-append-refill)
- (goto-char (point-min))
- (search-forward "@setfilename")
- (beginning-of-line)
- (delete-region (point-min) (point))
- ;; Remove @bye at end of file, if it is there.
- (goto-char (point-max))
- (if (search-backward "@bye" nil t)
- (delete-region (point) (point-max)))
- ;; Make sure buffer ends in a newline.
- (or (= (preceding-char) ?\n)
- (insert "\n"))
- ;; Scan the whole buffer, converting to Info format.
- (texinfo-format-scan)
- (goto-char (point-min))
- ;; Insert info about how this file was made.
- (insert "Info file: "
- texinfo-format-filename ", -*-Text-*-\n"
- "produced by `texinfo-format-buffer'\n"
- ;; Date string removed so that regression testing is easier.
- ;; "on "
- ;; (insert (format-time-string "%e %b %Y")) " "
- "from file"
- (if (buffer-file-name input-buffer)
- (concat " `"
- (file-name-sans-versions
- (file-name-nondirectory
- (buffer-file-name input-buffer)))
- "'")
- (concat "buffer `" (buffer-name input-buffer) "'"))
- "\nusing `texinfmt.el' version "
- texinfmt-version
- ".\n\n")
- ;; Return data for indices.
- (list outfile
- texinfo-vindex texinfo-findex texinfo-cindex
- texinfo-pindex texinfo-tindex texinfo-kindex)))
- ;;; Perform non-@-command file conversions: quotes and hyphens
- (defun texinfo-format-convert (min max)
- ;; Convert left and right quotes to typewriter font quotes.
- (goto-char min)
- (while (search-forward "``" max t)
- (replace-match "\""))
- (goto-char min)
- (while (search-forward "''" max t)
- (replace-match "\""))
-
- (goto-char min)
- (while (re-search-forward "\\( \\|\\w\\)\\(---\\)\\( \\|\\w\\)" max t)
- (delete-region (1+ (match-beginning 2)) (+ 2 (match-beginning 2)))))
- (defvar texinfo-no-refill-regexp
- (concat
- "^@"
- "\\("
-
-
-
-
-
-
-
- "direntry\\|"
- "lisp\\|"
- "smalllisp\\|"
- "example\\|"
- "smallexample\\|"
- "display\\|"
- "smalldisplay\\|"
- "format\\|"
- "smallformat\\|"
- "flushleft\\|"
- "flushright\\|"
- "menu\\|"
- "multitable\\|"
- "titlepage\\|"
- "iftex\\|"
- "ifhtml\\|"
- "tex\\|"
- "html"
- "\\)")
- "Regexp specifying environments in which paragraphs are not filled.")
- (defvar texinfo-accent-commands
- (concat
- "@^\\|"
- "@`\\|"
- "@'\\|"
- "@\"\\|"
- "@,\\|"
- "@=\\|"
- "@~\\|"
- "@OE{\\|"
- "@oe{\\|"
- "@AA{\\|"
- "@aa{\\|"
- "@AE{\\|"
- "@ae{\\|"
- "@ss{\\|"
- "@questiondown{\\|"
- "@exclamdown{\\|"
- "@L{\\|"
- "@l{\\|"
- "@O{\\|"
- "@o{\\|"
- "@dotaccent{\\|"
- "@ubaraccent{\\|"
- "@d{\\|"
- "@H{\\|"
- "@ringaccent{\\|"
- "@tieaccent{\\|"
- "@u{\\|"
- "@v{\\|"
- "@dotless{"
- ))
- (defvar texinfo-part-of-para-regexp
- (concat
- "^@"
- "\\("
- "b{\\|"
- "bullet{\\|"
- "cite{\\|"
- "code{\\|"
- "email{\\|"
- "emph{\\|"
- "equiv{\\|"
- "error{\\|"
- "expansion{\\|"
- "file{\\|"
- "i{\\|"
- "inforef{\\|"
- "kbd{\\|"
- "key{\\|"
- "lisp{\\|"
- "minus{\\|"
- "point{\\|"
- "print{\\|"
- "pxref{\\|"
- "r{\\|"
- "ref{\\|"
- "result{\\|"
- "samp{\\|"
- "sc{\\|"
- "t{\\|"
- "TeX{\\|"
- "today{\\|"
- "url{\\|"
- "var{\\|"
- "w{\\|"
- "xref{\\|"
- "@-\\|"
- texinfo-accent-commands
- "\\)"
- )
- "Regexp specifying @-commands found within paragraphs.")
- (defun texinfo-append-refill ()
- "Append @refill at end of each paragraph that should be filled.
- Do not append @refill to paragraphs within @example and similar environments.
- Do not append @refill to paragraphs containing @w{TEXT} or @*."
-
-
-
- (while (< (point) (point-max))
- (let ((refill-blank-lines "^[ \t\n]*$")
- (case-fold-search nil))
- (beginning-of-line)
-
-
-
-
-
- (while (and (looking-at (concat "^@\\|^\\\\\\|" refill-blank-lines))
- (not (looking-at
- (concat
- "\\("
- texinfo-no-refill-regexp
- "\\|"
- texinfo-part-of-para-regexp
- "\\)")))
- (< (point) (point-max)))
- (forward-line 1))
-
- (if (looking-at texinfo-no-refill-regexp)
- (let ((environment (match-string-no-properties 1)))
- (progn (re-search-forward (concat "^@end " environment) nil t)
- (forward-line 1)))
-
-
-
- (if (or (>= (point) (point-max))
- (re-search-forward
- "@w{\\|@\\*\\|@\n\n"
- (save-excursion (forward-paragraph)
- (line-beginning-position 2))
- t))
-
- (forward-paragraph)
-
- (forward-paragraph)
- (forward-line -1)
- (let ((line-beg (point)))
- (end-of-line)
- (delete-region
- (point)
- (save-excursion (skip-chars-backward " \t") (point)))
- (forward-char 1)
- (unless (re-search-backward "@c[ \t\n]\\|@comment[ \t\n]" line-beg t)
- (forward-char -1))
- (unless (re-search-backward "@refill\\|^[ \t]*@" line-beg t)
- (insert "@refill")))
- (forward-line 1))))))
- (defun texinfo-raise-lower-sections ()
- "Raise or lower the hierarchical level of chapters, sections, etc.
- This function acts according to `@raisesections' and `@lowersections'
- commands in the Texinfo file.
- For example, an `@lowersections' command is useful if you wish to
- include what is written as an outer or standalone Texinfo file in
- another Texinfo file as an inner, included file. The `@lowersections'
- command changes chapters to sections, sections to subsections and so
- on.
- @raisesections changes @subsection to @section,
- @section to @chapter,
- @heading to @chapheading,
- etc.
- @lowersections changes @chapter to @section,
- @subsection to @subsubsection,
- @heading to @subheading,
- etc.
- An `@raisesections' or `@lowersections' command changes only those
- structuring commands that follow the `@raisesections' or
- `@lowersections' command.
- An `@lowersections' command cancels an `@raisesections' command, and
- vice versa.
- Repeated use of the commands continue to raise or lower the hierarchical
- level a step at a time.
- An attempt to raise above `chapters' reproduces chapter commands; an
- attempt to lower below subsubsections reproduces subsubsection
- commands."
-
-
-
- (let (type (level 0))
- (while
- (re-search-forward
- (concat
- "\\(\\(^@\\(raise\\|lower\\)sections\\)\\|\\("
- texinfo-section-types-regexp
- "\\)\\)")
- nil t)
- (beginning-of-line)
- (save-excursion (setq type (read (current-buffer))))
- (cond
-
- ((eq type '@raisesections)
- (setq level (1+ level))
- (delete-region
- (point) (line-beginning-position 2)))
-
- ((eq type '@lowersections)
- (setq level (1- level))
- (delete-region
- (point) (line-beginning-position 2)))
-
- ((cond
-
- ((> level 0)
- (let ((count level)
- (new-level type))
- (while (> count 0)
- (setq new-level
- (cdr (assq new-level texinfo-raisesections-alist)))
- (setq count (1- count)))
- (kill-word 1)
- (insert (symbol-name new-level))))
-
- ((= level 0) (forward-line 1))
-
- ((< level 0)
- (let ((count level)
- (new-level type))
- (while (< count 0)
- (setq new-level
- (cdr (assq new-level texinfo-lowersections-alist)))
- (setq count (1+ count)))
- (kill-word 1)
- (insert (symbol-name new-level))))))))))
- (defun texinfo-format-scan ()
- (texinfo-format-convert (point-min) (point-max))
-
-
- (goto-char (point-min))
- (when (search-forward "@copying" nil t)
- (texinfo-copying))
- (while (search-forward "@insertcopying" nil t)
- (delete-region (match-beginning 0) (match-end 0))
- (texinfo-insertcopying))
-
- (goto-char (point-min))
- (while (search-forward "@" nil t)
-
-
-
-
-
-
-
-
-
-
- (if (looking-at "[@{}^'`\"=~ \t\n*?!-]")
-
- (cond
-
- ((= (following-char) ?*)
-
- (delete-region (1- (point)) (1+ (point)))
-
-
- (if (not (= (following-char) ?\n))
- (insert ?\n)))
-
- ((= (following-char) ?-)
- (delete-region (1- (point)) (1+ (point))))
-
-
- ((= (following-char) ? )
- (delete-region (1- (point)) (1+ (point)))
-
-
- (if (not (= (following-char) ?\n))
- (insert ? )))
- ((= (following-char) ?\t)
- (delete-region (1- (point)) (1+ (point)))
-
-
- (if (not (= (following-char) ?\n))
- (insert ? )))
-
- ((= (following-char) ?\n)
-
- (delete-region (1- (point)) (1+ (point)))
-
-
- (if (not (= (following-char) ?\n))
- (insert ? )))
-
- (t
- (delete-char -1)
-
-
- (if (looking-at "[\"'^`~=]")
- (progn
- (if (= (char-after (1+ (point))) ?@)
- (error "Use braces to give a command as an argument to @%c"
- (following-char)))
- (forward-char 1)
-
-
- (when (looking-at "{")
- (let ((start (point)))
- (forward-list 1)
- (delete-char -1)
- (goto-char start)
- (delete-char 1))))
- (forward-char 1))))
-
- (setq texinfo-command-start (1- (point)))
- (if (= (char-syntax (following-char)) ?w)
- (forward-word 1)
- (forward-char 1))
- (setq texinfo-command-end (point))
-
-
- (goto-char (1+ texinfo-command-start))
- (skip-chars-forward "^@" texinfo-command-end)
- (setq texinfo-command-end (point))
-
- (setq texinfo-command-name
- (let (trial
- (cmdname
- (buffer-substring-no-properties
- (1+ texinfo-command-start) texinfo-command-end)))
- (while (setq trial (assoc cmdname texinfo-alias-list))
- (setq cmdname (cdr trial)))
- (intern cmdname)))
-
- (let ((enclosure-type
- (assoc
- (symbol-name texinfo-command-name)
- texinfo-enclosure-list)))
- (if enclosure-type
- (progn
- (insert
- (car (car (cdr enclosure-type)))
- (texinfo-parse-arg-discard)
- (car (cdr (car (cdr enclosure-type)))))
- (goto-char texinfo-command-start))
- (let ((cmd (get texinfo-command-name 'texinfo-format)))
- (if cmd (funcall cmd) (texinfo-unsupported)))))))
- (cond (texinfo-stack
- (goto-char (nth 2 (car texinfo-stack)))
- (error "Unterminated @%s" (car (car texinfo-stack)))))
-
- (let ((whitespace-silent t))
- (whitespace-cleanup)))
- (defvar texinfo-copying-text ""
- "Text of the copyright notice and copying permissions.")
- (defun texinfo-copying ()
- "Copy the copyright notice and copying permissions from the Texinfo file,
- as indicated by the @copying ... @end copying command;
- insert the text with the @insertcopying command."
- (let ((beg (progn (beginning-of-line) (point)))
- (end (progn (re-search-forward "^@end copying[ \t]*\n") (point))))
- (setq texinfo-copying-text
- (buffer-substring-no-properties
- (save-excursion (goto-char beg) (line-beginning-position 2))
- (save-excursion (goto-char end) (line-beginning-position 0))))
- (delete-region beg end)))
- (defun texinfo-insertcopying ()
- "Insert the copyright notice and copying permissions from the Texinfo file,
- which are indicated by the @copying ... @end copying command."
- (insert (concat "\n" texinfo-copying-text)))
- (put 'begin 'texinfo-format 'texinfo-format-begin)
- (defun texinfo-format-begin ()
- (texinfo-format-begin-end 'texinfo-format))
- (put 'end 'texinfo-format 'texinfo-format-end)
- (defun texinfo-format-end ()
- (texinfo-format-begin-end 'texinfo-end))
- (defun texinfo-format-begin-end (prop)
- (setq texinfo-command-name (intern (texinfo-parse-line-arg)))
- (let ((cmd (get texinfo-command-name prop)))
- (if cmd (funcall cmd)
- (texinfo-unsupported))))
- (defun texinfo-parse-line-arg ()
- "Return argument of @-command as string.
- Argument is separated from command either by a space or by a brace.
- If a space, return rest of line, with beginning and ending white
- space removed. If a brace, return string between braces.
- Leave point after argument."
- (goto-char texinfo-command-end)
- (let ((start (point)))
- (cond ((looking-at " ")
- (skip-chars-forward " ")
- (setq start (point))
- (end-of-line)
- (skip-chars-backward " ")
- (delete-region (point) (progn (end-of-line) (point)))
- (setq texinfo-command-end (1+ (point))))
- ((looking-at "{")
- (setq start (1+ (point)))
- (forward-list 1)
- (setq texinfo-command-end (point))
- (forward-char -1))
- (t
- (error "Invalid texinfo command arg format")))
- (prog1 (buffer-substring-no-properties start (point))
- (if (eolp) (forward-char 1)))))
- (defun texinfo-parse-expanded-arg ()
- (goto-char texinfo-command-end)
- (let ((start (point))
- marker)
- (cond ((looking-at " ")
- (skip-chars-forward " ")
- (setq start (point))
- (end-of-line)
- (setq texinfo-command-end (1+ (point))))
- ((looking-at "{")
- (setq start (1+ (point)))
- (forward-list 1)
- (setq texinfo-command-end (point))
- (forward-char -1))
- (t
- (error "Invalid texinfo command arg format")))
- (setq marker (move-marker (make-marker) texinfo-command-end))
- (texinfo-format-expand-region start (point))
- (setq texinfo-command-end (marker-position marker))
- (move-marker marker nil)
- (prog1 (buffer-substring-no-properties start (point))
- (if (eolp) (forward-char 1)))))
- (defun texinfo-format-expand-region (start end)
- (save-restriction
- (narrow-to-region start end)
- (let (texinfo-command-start
- texinfo-command-end
- texinfo-command-name
- texinfo-stack)
- (texinfo-format-scan))
- (goto-char (point-max))))
- (defun texinfo-parse-arg-discard ()
- "Delete command and argument; return argument of command."
- (prog1 (texinfo-parse-line-arg)
- (texinfo-discard-command)))
- (defun texinfo-discard-command ()
- (delete-region texinfo-command-start texinfo-command-end))
- (defun texinfo-optional-braces-discard ()
- "Discard braces following command, if any."
- (goto-char texinfo-command-end)
- (let ((start (point)))
- (cond ((looking-at "[ \t]*\n"))
- ((looking-at "{")
- (forward-list 1)
- (setq texinfo-command-end (point)))
- (t
- (error
- "Invalid `texinfo-optional-braces-discard' format \(need braces?\)")))
- (delete-region texinfo-command-start texinfo-command-end)))
- (defun texinfo-format-parse-line-args ()
- (let ((start (1- (point)))
- next beg end
- args)
- (skip-chars-forward " ")
- (while (not (eolp))
- (setq beg (point))
- (re-search-forward "[\n,]")
- (setq next (point))
- (if (bolp) (setq next (1- next)))
- (forward-char -1)
- (skip-chars-backward " ")
- (setq end (point))
- (push (if (> end beg) (buffer-substring-no-properties beg end))
- args)
- (goto-char next)
- (skip-chars-forward " "))
- (if (eolp) (forward-char 1))
- (setq texinfo-command-end (point))
- (nreverse args)))
- (defun texinfo-format-parse-args ()
- (let ((start (1- (point)))
- next beg end
- args)
- (search-forward "{")
- (save-excursion
- (texinfo-format-expand-region
- (point)
- (save-excursion (up-list 1) (1- (point)))))
-
-
-
-
- (while (/= (preceding-char) ?\})
- (skip-chars-forward " \t\n")
- (setq beg (point))
- (re-search-forward "[},]")
- (setq next (point))
- (forward-char -1)
- (skip-chars-backward " \t\n")
- (setq end (point))
- (cond ((< beg end)
- (goto-char beg)
- (while (search-forward "\n" end t)
- (replace-match " "))))
- (push (if (> end beg) (buffer-substring-no-properties beg end))
- args)
- (goto-char next))
-
- (setq texinfo-command-end (point))
- (nreverse args)))
- (defun texinfo-format-parse-defun-args ()
- (goto-char texinfo-command-end)
- (let ((start (point)))
- (end-of-line)
- (setq texinfo-command-end (1+ (point)))
- (let ((marker (move-marker (make-marker) texinfo-command-end)))
- (texinfo-format-expand-region start (point))
- (setq texinfo-command-end (marker-position marker))
- (move-marker marker nil))
- (goto-char start)
- (let ((args '())
- beg end)
- (skip-chars-forward " ")
- (while (not (eolp))
- (cond ((looking-at "{")
- (setq beg (1+ (point)))
- (forward-list 1)
- (setq end (1- (point))))
- (t
- (setq beg (point))
- (re-search-forward "[\n ]")
- (forward-char -1)
- (setq end (point))))
- (push (buffer-substring-no-properties beg end) args)
- (skip-chars-forward " "))
- (forward-char 1)
- (nreverse args))))
- (defun texinfo-discard-line ()
- (goto-char texinfo-command-end)
- (skip-chars-forward " \t")
- (or (eolp)
- (error "Extraneous text at end of command line"))
- (goto-char texinfo-command-start)
- (or (bolp)
- (error "Extraneous text at beginning of command line"))
- (delete-region (point) (progn (forward-line 1) (point))))
- (defun texinfo-discard-line-with-args ()
- (goto-char texinfo-command-start)
- (delete-region (point) (progn (forward-line 1) (point))))
- (put 'setfilename 'texinfo-format 'texinfo-format-setfilename)
- (defun texinfo-format-setfilename ()
- (texinfo-parse-arg-discard))
- (put 'node 'texinfo-format 'texinfo-format-node)
- (put 'nwnode 'texinfo-format 'texinfo-format-node)
- (defun texinfo-format-node ()
- (let* ((args (texinfo-format-parse-line-args))
- (name (nth 0 args))
- (next (nth 1 args))
- (prev (nth 2 args))
- (up (nth 3 args)))
- (texinfo-discard-command)
- (setq texinfo-last-node name)
- (let ((tem (if texinfo-fold-nodename-case (downcase name) name)))
- (if (assoc tem texinfo-node-names)
- (error "Duplicate node name: %s" name)
- (push (list tem) texinfo-node-names)))
- (setq texinfo-footnote-number 0)
-
- (insert "\n\^_\nFile: " texinfo-format-filename
- ", Node: " name)
- (if next
- (insert ", Next: " next))
- (if prev
- (insert ", Prev: " prev))
- (if up
- (insert ", Up: " up))
- (insert ?\n)
- (setq texinfo-last-node-pos (point))))
- (put 'anchor 'texinfo-format 'texinfo-anchor)
- (defun texinfo-anchor ()
- (let (anchor-string
- (here (- (point) 7))
- (arg (texinfo-parse-arg-discard)))
- (if (looking-at " ")
- (delete-char 1))
- (forward-paragraph)
- (let ((end (point)))
- (if (save-excursion
- (backward-word 1)
- (search-forward "@refill" end t))
- (setq anchor-string "@anchor-yes-refill")
- (setq anchor-string "@anchor-no-refill")))
- (goto-char here)
- (insert anchor-string "{" arg "}")))
- (put 'menu 'texinfo-format 'texinfo-format-menu)
- (defun texinfo-format-menu ()
- (texinfo-discard-line)
- (insert "* Menu:\n\n"))
- (put 'menu 'texinfo-end 'texinfo-discard-command)
- (put 'detailmenu 'texinfo-format 'texinfo-discard-line)
- (put 'detailmenu 'texinfo-end 'texinfo-discard-command)
- (put 'ref 'texinfo-format 'texinfo-format-xref)
- (put 'xref 'texinfo-format 'texinfo-format-xref)
- (defun texinfo-format-xref ()
- (let ((args (texinfo-format-parse-args)))
- (texinfo-discard-command)
- (insert "*Note ")
- (let ((fname (or (nth 1 args) (nth 2 args))))
- (if (null (or fname (nth 3 args)))
- (insert (car args) "::")
- (insert (or fname (car args)) ": ")
- (if (nth 3 args)
- (insert "(" (nth 3 args) ")"))
- (and (car args) (insert (car args)))))))
- (put 'pxref 'texinfo-format 'texinfo-format-pxref)
- (defun texinfo-format-pxref ()
- (texinfo-format-xref)
- (or (save-excursion
- (forward-char -2)
- (looking-at "::"))
- (insert ".")))
- (put 'inforef 'texinfo-format 'texinfo-format-inforef)
- (defun texinfo-format-inforef ()
- (let ((args (texinfo-format-parse-args)))
- (texinfo-discard-command)
- (if (nth 1 args)
- (insert "*Note " (nth 1 args) ": (" (nth 2 args) ")" (car args))
- (insert "*Note " "(" (nth 2 args) ")" (car args) "::"))))
- (put 'uref 'texinfo-format 'texinfo-format-uref)
- (defun texinfo-format-uref ()
- "Format URL and optional URL-TITLE.
- Insert ` ... ' around URL if no URL-TITLE argument;
- otherwise, insert URL-TITLE followed by URL in parentheses."
- (let ((args (texinfo-format-parse-args)))
- (texinfo-discard-command)
-
- (if (nth 1 args)
- (insert (nth 1 args) " (" (nth 0 args) ")")
- (insert "`" (nth 0 args) "'"))
- (goto-char texinfo-command-start)))
- (put 'majorheading 'texinfo-format 'texinfo-format-chapter)
- (put 'chapheading 'texinfo-format 'texinfo-format-chapter)
- (put 'ichapter 'texinfo-format 'texinfo-format-chapter)
- (put 'chapter 'texinfo-format 'texinfo-format-chapter)
- (put 'iappendix 'texinfo-format 'texinfo-format-chapter)
- (put 'appendix 'texinfo-format 'texinfo-format-chapter)
- (put 'iunnumbered 'texinfo-format 'texinfo-format-chapter)
- (put 'top 'texinfo-format 'texinfo-format-chapter)
- (put 'unnumbered 'texinfo-format 'texinfo-format-chapter)
- (put 'centerchap 'texinfo-format 'texinfo-format-chapter)
- (defun texinfo-format-chapter ()
- (texinfo-format-chapter-1 ?*))
- (put 'heading 'texinfo-format 'texinfo-format-section)
- (put 'isection 'texinfo-format 'texinfo-format-section)
- (put 'section 'texinfo-format 'texinfo-format-section)
- (put 'iappendixsection 'texinfo-format 'texinfo-format-section)
- (put 'appendixsection 'texinfo-format 'texinfo-format-section)
- (put 'iappendixsec 'texinfo-format 'texinfo-format-section)
- (put 'appendixsec 'texinfo-format 'texinfo-format-section)
- (put 'iunnumberedsec 'texinfo-format 'texinfo-format-section)
- (put 'unnumberedsec 'texinfo-format 'texinfo-format-section)
- (defun texinfo-format-section ()
- (texinfo-format-chapter-1 ?=))
- (put 'subheading 'texinfo-format 'texinfo-format-subsection)
- (put 'isubsection 'texinfo-format 'texinfo-format-subsection)
- (put 'subsection 'texinfo-format 'texinfo-format-subsection)
- (put 'iappendixsubsec 'texinfo-format 'texinfo-format-subsection)
- (put 'appendixsubsec 'texinfo-format 'texinfo-format-subsection)
- (put 'iunnumberedsubsec 'texinfo-format 'texinfo-format-subsection)
- (put 'unnumberedsubsec 'texinfo-format 'texinfo-format-subsection)
- (defun texinfo-format-subsection ()
- (texinfo-format-chapter-1 ?-))
- (put 'subsubheading 'texinfo-format 'texinfo-format-subsubsection)
- (put 'isubsubsection 'texinfo-format 'texinfo-format-subsubsection)
- (put 'subsubsection 'texinfo-format 'texinfo-format-subsubsection)
- (put 'iappendixsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
- (put 'appendixsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
- (put 'iunnumberedsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
- (put 'unnumberedsubsubsec 'texinfo-format 'texinfo-format-subsubsection)
- (defun texinfo-format-subsubsection ()
- (texinfo-format-chapter-1 ?.))
- (defun texinfo-format-chapter-1 (belowchar)
- (let ((arg (texinfo-parse-arg-discard)))
- (message "Formatting: %s ... " arg)
- (insert ?\n arg ?\n "@SectionPAD " belowchar ?\n)
- (forward-line -2)))
- (put 'SectionPAD 'texinfo-format 'texinfo-format-sectionpad)
- (defun texinfo-format-sectionpad ()
- (let ((str (texinfo-parse-arg-discard)))
- (forward-char -1)
- (let ((column (current-column)))
- (forward-char 1)
- (while (> column 0)
- (insert str)
- (setq column (1- column))))
- (insert ?\n)))
- (put '\. 'texinfo-format 'texinfo-format-\.)
- (defun texinfo-format-\. ()
- (texinfo-discard-command)
- (insert "."))
- (put '\: 'texinfo-format 'texinfo-format-\:)
- (defun texinfo-format-\: ()
- (texinfo-discard-command))
- (put '\- 'texinfo-format 'texinfo-format-soft-hyphen)
- (defun texinfo-format-soft-hyphen ()
- (texinfo-discard-command))
- (put 'kbdinputstyle 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'vskip 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'evenfooting 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'evenheading 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'oddfooting 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'oddheading 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'everyfooting 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'everyheading 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'documentdescription 'texinfo-format 'texinfo-format-documentdescription)
- (defun texinfo-format-documentdescription ()
- (delete-region texinfo-command-start
- (progn (re-search-forward "^@end documentdescription[ \t]*\n")
- (point))))
- (put 'center 'texinfo-format 'texinfo-format-center)
- (defun texinfo-format-center ()
- (let ((arg (texinfo-parse-expanded-arg)))
- (texinfo-discard-command)
- (insert arg)
- (insert ?\n)
- (save-restriction
- (goto-char (1- (point)))
- (let ((indent-tabs-mode nil))
- (center-line)))))
- (put 'sp 'texinfo-format 'texinfo-format-sp)
- (defun texinfo-format-sp ()
- (let* ((arg (texinfo-parse-arg-discard))
- (num (read arg)))
- (insert-char ?\n num)))
- (put 'br 'texinfo-format 'texinfo-format-paragraph-break)
- (defun texinfo-format-paragraph-break ()
- "Force a paragraph break.
- If used within a line, follow `@br' with braces."
- (texinfo-optional-braces-discard)
-
-
- (if (= (following-char) ?\n)
- (insert ?\n)
- (insert-char ?\n 2)))
- (defvar texinfo-footnote-style "separate"
- "Footnote style, either separate or end.")
- (put 'footnotestyle 'texinfo-format 'texinfo-footnotestyle)
- (defun texinfo-footnotestyle ()
- "Specify whether footnotes are at end of node or in separate nodes.
- Argument is either end or separate."
- (setq texinfo-footnote-style (texinfo-parse-arg-discard)))
- (put 'footnote 'texinfo-format 'texinfo-format-footnote)
- (defun texinfo-format-footnote ()
- "Format a footnote in either end of node or separate node style.
- The texinfo-footnote-style variable controls which style is used."
- (setq texinfo-footnote-number (1+ texinfo-footnote-number))
- (cond ((string= texinfo-footnote-style "end")
- (texinfo-format-end-node))
- ((string= texinfo-footnote-style "separate")
- (texinfo-format-separate-node))))
- (defun texinfo-format-separate-node ()
- "Format footnote in Separate node style, with notes in own node.
- The node is constructed automatically."
- (let* (start
- (arg (texinfo-parse-line-arg))
- (node-name-beginning
- (save-excursion
- (re-search-backward
- "^File: \\w+\\(\\w\\|\\s_\\|\\.\\|,\\)*[ \t]+Node:")
- (match-end 0)))
- (node-name
- (save-excursion
- (buffer-substring-no-properties
- (progn (goto-char node-name-beginning)
- (skip-chars-forward " \t")
- (point))
- (if (search-forward "," (line-end-position) t)
- (1- (point))
- (end-of-line) (point))))))
- (texinfo-discard-command)
- (delete-region (save-excursion (skip-chars-backward " \t\n") (point))
- (point))
- (insert (format " (%d) (*Note %s-Footnotes::)"
- texinfo-footnote-number node-name))
- (fill-paragraph nil)
- (save-excursion
- (if (re-search-forward "^@node" nil 'move)
- (forward-line -1))
-
-
-
- (if (save-excursion
- (search-backward
- (concat node-name "-Footnotes, Up: ")
- node-name-beginning
- t))
- (progn
- (setq start (point))
- (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))
- (fill-region start (point)))
-
- (insert "\n\^_\nFile: " texinfo-format-filename
- " Node: " node-name "-Footnotes, Up: " node-name "\n")
- (setq start (point))
- (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))
- (narrow-to-region (save-excursion (goto-char start) (point)) (point))
- (fill-region (point-min) (point-max))
- (widen)))))
- (defun texinfo-format-end-node ()
- "Format footnote in the End of node style, with notes at end of node."
- (let (start
- (arg (texinfo-parse-line-arg)))
- (texinfo-discard-command)
- (delete-region (save-excursion (skip-chars-backward " \t\n") (point))
- (point))
- (insert (format " (%d) " texinfo-footnote-number))
- (fill-paragraph nil)
- (save-excursion
- (if (search-forward "\n--------- Footnotes ---------\n" nil t)
- (progn
- (if (re-search-forward "^@node" nil 'move)
- (forward-line -1))
- (setq start (point))
- (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))
- (fill-region start (point)))
-
- (if (re-search-forward "^@node" nil 'move)
- (forward-line -1))
- (insert "\n--------- Footnotes ---------\n")
- (setq start (point))
- (insert (format "\n(%d) %s\n" texinfo-footnote-number arg))))))
- (defvar texinfo-stack-depth 0
- "Count of number of unpopped texinfo-push-stack calls.
- Used by @refill indenting command to avoid indenting within lists, etc.")
- (defun texinfo-push-stack (check arg)
- (setq texinfo-stack-depth (1+ texinfo-stack-depth))
- (push (list check arg texinfo-command-start)
- texinfo-stack))
- (defun texinfo-pop-stack (check)
- (setq texinfo-stack-depth (1- texinfo-stack-depth))
- (if (null texinfo-stack)
- (error "Unmatched @end %s" check))
- (if (not (eq (car (car texinfo-stack)) check))
- (error "@end %s matches @%s"
- check (car (car texinfo-stack))))
- (prog1 (cdr (car texinfo-stack))
- (setq texinfo-stack (cdr texinfo-stack))))
- (put 'itemize 'texinfo-format 'texinfo-itemize)
- (defun texinfo-itemize ()
- (texinfo-push-stack
- 'itemize
- (progn (skip-chars-forward " \t")
- (if (eolp)
- "@bullet"
- (texinfo-parse-line-arg))))
- (texinfo-discard-line-with-args)
- (setq fill-column (- fill-column 5)))
- (put 'itemize 'texinfo-end 'texinfo-end-itemize)
- (defun texinfo-end-itemize ()
- (setq fill-column (+ fill-column 5))
- (texinfo-discard-command)
- (let ((stacktop
- (texinfo-pop-stack 'itemize)))
- (texinfo-do-itemize (nth 1 stacktop))))
- (put 'enumerate 'texinfo-format 'texinfo-enumerate)
- (defun texinfo-enumerate ()
- (texinfo-push-stack
- 'enumerate
- (progn (skip-chars-forward " \t")
- (if (eolp)
- 1
- (read (current-buffer)))))
- (if (and (symbolp (car (cdr (car texinfo-stack))))
- (> 1 (length (symbol-name (car (cdr (car texinfo-stack)))))))
- (error
- "@enumerate: Use a number or letter, eg: 1, A, a, 3, B, or d." ))
- (texinfo-discard-line-with-args)
- (setq fill-column (- fill-column 5)))
- (put 'enumerate 'texinfo-end 'texinfo-end-enumerate)
- (defun texinfo-end-enumerate ()
- (setq fill-column (+ fill-column 5))
- (texinfo-discard-command)
- (let ((stacktop
- (texinfo-pop-stack 'enumerate)))
- (texinfo-do-itemize (nth 1 stacktop))))
- (put 'alphaenumerate 'texinfo-format 'texinfo-alphaenumerate)
- (defun texinfo-alphaenumerate ()
- (texinfo-push-stack 'alphaenumerate (1- ?a))
- (setq fill-column (- fill-column 5))
- (texinfo-discard-line))
- (put 'alphaenumerate 'texinfo-end 'texinfo-end-alphaenumerate)
- (defun texinfo-end-alphaenumerate ()
- (setq fill-column (+ fill-column 5))
- (texinfo-discard-command)
- (let ((stacktop
- (texinfo-pop-stack 'alphaenumerate)))
- (texinfo-do-itemize (nth 1 stacktop))))
- (put 'capsenumerate 'texinfo-format 'texinfo-capsenumerate)
- (defun texinfo-capsenumerate ()
- (texinfo-push-stack 'capsenumerate (1- ?A))
- (setq fill-column (- fill-column 5))
- (texinfo-discard-line))
- (put 'capsenumerate 'texinfo-end 'texinfo-end-capsenumerate)
- (defun texinfo-end-capsenumerate ()
- (setq fill-column (+ fill-column 5))
- (texinfo-discard-command)
- (let ((stacktop
- (texinfo-pop-stack 'capsenumerate)))
- (texinfo-do-itemize (nth 1 stacktop))))
- (defun texinfo-do-itemize (from)
- (save-excursion
- (while (progn (forward-line -1)
- (>= (point) from))
- (if (= (following-char) ?\b)
- (save-excursion
- (delete-char 1)
- (end-of-line)
- (delete-char 6))
- (if (not (looking-at "[ \t]*$"))
- (save-excursion (insert " ")))))))
- (put 'item 'texinfo-format 'texinfo-item)
- (put 'itemx 'texinfo-format 'texinfo-item)
- (defun texinfo-item ()
- (funcall (get (car (car texinfo-stack)) 'texinfo-item)))
- (put 'itemize 'texinfo-item 'texinfo-itemize-item)
- (defun texinfo-itemize-item ()
-
- (delete-region (1+ (point)) (line-beginning-position))
- (if (looking-at "[ \t]*[^ \t\n]+")
-
- (insert "\b " (nth 1 (car texinfo-stack)) " \n")
-
- (insert "\b " (nth 1 (car texinfo-stack)) " "))
- (forward-line -1))
- (put 'enumerate 'texinfo-item 'texinfo-enumerate-item)
- (defun texinfo-enumerate-item ()
- (texinfo-discard-line)
- (let (enumerating-symbol)
- (cond ((integerp (car (cdr (car texinfo-stack))))
- (setq enumerating-symbol (car (cdr (car texinfo-stack))))
- (insert ?\b (format "%3d. " enumerating-symbol) ?\n)
- (setcar (cdr (car texinfo-stack)) (1+ enumerating-symbol)))
- ((symbolp (car (cdr (car texinfo-stack))))
- (setq enumerating-symbol
- (symbol-name (car (cdr (car texinfo-stack)))))
- (if (or (equal ?\[ (string-to-char enumerating-symbol))
- (equal ?\{ (string-to-char enumerating-symbol)))
- (error
- "Too many items in enumerated list; alphabet ends at Z."))
- (insert ?\b (format "%3s. " enumerating-symbol) ?\n)
- (setcar (cdr (car texinfo-stack))
- (make-symbol
- (char-to-string
- (1+
- (string-to-char enumerating-symbol))))))
- (t
- (error
- "@enumerate: Use a number or letter, eg: 1, A, a, 3, B or d." )))
- (forward-line -1)))
- (put 'alphaenumerate 'texinfo-item 'texinfo-alphaenumerate-item)
- (defun texinfo-alphaenumerate-item ()
- (texinfo-discard-line)
- (let ((next (1+ (car (cdr (car texinfo-stack))))))
- (if (> next ?z)
- (error "More than 26 items in @alphaenumerate; get a bigger alphabet"))
- (setcar (cdr (car texinfo-stack)) next)
- (insert "\b " next ". \n"))
- (forward-line -1))
- (put 'capsenumerate 'texinfo-item 'texinfo-capsenumerate-item)
- (defun texinfo-capsenumerate-item ()
- (texinfo-discard-line)
- (let ((next (1+ (car (cdr (car texinfo-stack))))))
- (if (> next ?Z)
- (error "More than 26 items in @capsenumerate; get a bigger alphabet"))
- (setcar (cdr (car texinfo-stack)) next)
- (insert "\b " next ". \n"))
- (forward-line -1))
- (put 'table 'texinfo-format 'texinfo-table)
- (defun texinfo-table ()
- (texinfo-push-stack
- 'table
- (progn (skip-chars-forward " \t")
- (if (eolp)
- "@asis"
- (texinfo-parse-line-arg))))
- (texinfo-discard-line-with-args)
- (setq fill-column (- fill-column 5)))
- (put 'table 'texinfo-item 'texinfo-table-item)
- (defun texinfo-table-item ()
- (let ((arg (texinfo-parse-arg-discard))
- (itemfont (car (cdr (car texinfo-stack)))))
- (insert ?\b itemfont ?\{ arg "}\n \n"))
- (forward-line -2))
- (put 'table 'texinfo-end 'texinfo-end-table)
- (defun texinfo-end-table ()
- (setq fill-column (+ fill-column 5))
- (texinfo-discard-command)
- (let ((stacktop
- (texinfo-pop-stack 'table)))
- (texinfo-do-itemize (nth 1 stacktop))))
- (put 'description 'texinfo-end 'texinfo-end-table)
- (put 'description 'texinfo-format 'texinfo-description)
- (defun texinfo-description ()
- (texinfo-push-stack 'table "@asis")
- (setq fill-column (- fill-column 5))
- (texinfo-discard-line))
- (put 'ftable 'texinfo-format 'texinfo-ftable)
- (put 'vtable 'texinfo-format 'texinfo-vtable)
- (defun texinfo-ftable () (texinfo-indextable 'ftable))
- (defun texinfo-vtable () (texinfo-indextable 'vtable))
- (defun texinfo-indextable (table-type)
- (texinfo-push-stack table-type (texinfo-parse-arg-discard))
- (setq fill-column (- fill-column 5)))
- (put 'ftable 'texinfo-item 'texinfo-ftable-item)
- (put 'vtable 'texinfo-item 'texinfo-vtable-item)
- (defun texinfo-ftable-item () (texinfo-indextable-item 'texinfo-findex))
- (defun texinfo-vtable-item () (texinfo-indextable-item 'texinfo-vindex))
- (defun texinfo-indextable-item (index-type)
- (let ((item (texinfo-parse-arg-discard))
- (itemfont (car (cdr (car texinfo-stack))))
- (indexvar index-type))
- (insert ?\b itemfont ?\{ item "}\n \n")
- (set indexvar
- (cons
- (list item texinfo-last-node)
- (symbol-value indexvar)))
- (forward-line -2)))
- (put 'ftable 'texinfo-end 'texinfo-end-ftable)
- (put 'vtable 'texinfo-end 'texinfo-end-vtable)
- (defun texinfo-end-ftable () (texinfo-end-indextable 'ftable))
- (defun texinfo-end-vtable () (texinfo-end-indextable 'vtable))
- (defun texinfo-end-indextable (table-type)
- (setq fill-column (+ fill-column 5))
- (texinfo-discard-command)
- (let ((stacktop
- (texinfo-pop-stack table-type)))
- (texinfo-do-itemize (nth 1 stacktop))))
- (defvar texinfo-extra-inter-column-width 0
- "*Number of extra spaces between entries (columns) in @multitable.")
- (defvar texinfo-multitable-buffer-name "*multitable-temporary-buffer*")
- (defvar texinfo-multitable-rectangle-name "texinfo-multitable-temp-")
- (put 'multitableparskip 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'multitableparindent 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'multitablecolmargin 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'multitablelinespace 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'multitable 'texinfo-format 'texinfo-multitable)
- (defun texinfo-multitable ()
- "Produce multi-column tables.
- A multi-column table has this template:
- @multitable {A1} {A2} {A3}
- @item A1 @tab A2 @tab A3
- @item B1 @tab B2 @tab B3
- @item C1 @tab C2 @tab C3
- @end multitable
- where the width of the text in brackets specifies the width of the
- respective column.
- Or else:
- @multitable @columnfractions .25 .3 .45
- @item A1 @tab A2 @tab A3
- @item B1 @tab B2 @tab B3
- @end multitable
- where the fractions specify the width of each column as a percent
- of the current width of the text (i.e., of the `fill-column').
- Long lines of text are filled within columns.
- Using the Emacs Lisp formatter, texinfmt.el,
- the whitespace between columns can be increased by setting
- `texinfo-extra-inter-column-width' to a value greater than 0. By default,
- there is at least one blank space between columns.
- The Emacs Lisp formatter, texinfmt.el, ignores the following four
- commands that are defined in texinfo.tex for printed output.
- @multitableparskip,
- @multitableparindent,
- @multitablecolmargin,
- @multitablelinespace."
- (texinfo-push-stack
- 'multitable
-
- (texinfo-multitable-widths))
- (texinfo-discard-line-with-args))
- (put 'multitable 'texinfo-end 'texinfo-end-multitable)
- (defun texinfo-end-multitable ()
- "Discard the @end multitable line and pop the stack of multitable."
- (texinfo-discard-command)
- (texinfo-pop-stack 'multitable))
- (defun texinfo-multitable-widths ()
- "Return list of widths of each column in a multi-column table."
- (let (texinfo-multitable-width-list)
-
-
-
-
-
-
- (skip-chars-forward " \t")
- (cond
-
- ((looking-at "@columnfraction ")
- (error "In @multitable, @columnfractions misspelled"))
-
- ((looking-at "@columnfractions")
- (forward-word 1)
- (while (not (eolp))
- (push (truncate
- (1-
- (* fill-column (read (get-buffer (current-buffer))))))
- texinfo-multitable-width-list)))
-
-
- ((looking-at "{")
- (let ((start-of-templates (point)))
- (while (not (eolp))
- (skip-chars-forward " \t")
- (let* ((start-of-template (1+ (point)))
- (end-of-template
-
- (progn (forward-sexp 1) (1- (point)))))
- (push (- end-of-template start-of-template)
- texinfo-multitable-width-list)
-
-
-
- (narrow-to-region start-of-template end-of-template)
- (goto-char (point-min))
- (while (search-forward "
- " nil t)
- (delete-char -1))
- (goto-char (point-max))
- (widen)
- (forward-char 1)))))
-
-
- (t
- (error
- "You probably need to specify column widths for @multitable correctly.")))
-
- (let ((desired-columns
- (+
-
- (length texinfo-multitable-width-list)
-
- texinfo-extra-inter-column-width
-
- (apply '+ texinfo-multitable-width-list))))
- (if (> desired-columns fill-column)
- (error
- "Multi-column table width, %d chars, is greater than page width, %d chars."
- desired-columns fill-column)))
- texinfo-multitable-width-list))
- (defun texinfo-multitable-extract-row ()
- "Return multitable row, as a string.
- End of row is beginning of next @item or beginning of @end.
- Cells within rows are separated by @tab."
- (skip-chars-forward " \t")
- (let* ((start (point))
- (end (progn
- (re-search-forward "@item\\|@end")
- (match-beginning 0)))
- (row (progn (goto-char end)
- (skip-chars-backward " ")
-
- (delete-region (point) end)
- (buffer-substring-no-properties start (point)))))
- (delete-region texinfo-command-start end)
- row))
- (put 'multitable 'texinfo-item 'texinfo-multitable-item)
- (defun texinfo-multitable-item ()
- "Format a row within a multicolumn table.
- Cells in row are separated by @tab.
- Widths of cells are specified by the arguments in the @multitable line.
- All cells are made to be the same height.
- This command is executed when texinfmt sees @item inside @multitable."
- (let ((original-buffer (current-buffer))
- (table-widths (reverse (car (cdr (car texinfo-stack)))))
- (existing-fill-column fill-column)
- start
- end
- (table-column 0)
- (table-entry-height 0)
-
-
- (unformatted-row (texinfo-multitable-extract-row)))
-
- (set-buffer (get-buffer-create texinfo-multitable-buffer-name))
- (delete-region (point-min) (point-max))
- (insert unformatted-row)
- (goto-char (point-min))
- (let ((tab-number 1))
- (while (search-forward "@tab" nil t)
- (setq tab-number (1+ tab-number)))
- (let ((needed-tabs (- (length table-widths) tab-number)))
- (when (> needed-tabs 0)
- (goto-char (point-min))
- (end-of-line)
- (while (> needed-tabs 0)
- (insert "@w{ }\n@tab")
- (setq needed-tabs (1- needed-tabs))
- (message
- "Added @tabs and empty spaces to a @multitable row")))))
- (goto-char (point-min))
-
-
-
-
- (while (not (eobp))
- (setq start (point))
- (setq end (save-excursion
- (if (search-forward "@tab" nil 'move)
-
- (delete-region
- (point)
- (progn (forward-word -1) (1- (point)))))
- (point)))
-
- (setq fill-column (+ 1
- texinfo-extra-inter-column-width
- (nth table-column table-widths)))
- (narrow-to-region start end)
-
- (skip-chars-forward " ")
- (delete-region (point) (line-beginning-position))
- (goto-char (point-max))
- (skip-chars-backward " ")
- (delete-region (point) (line-end-position))
-
-
- (let (texinfo-stack)
- (texinfo-format-scan))
- (let (fill-prefix)
- (fill-region (point-min) (point-max)))
- (setq table-entry-height
- (max table-entry-height (count-lines (point-min) (point-max))))
- (goto-char (point-min))
- (forward-line (1- table-entry-height))
- (let* ((beg (point))
-
- (needed-whitespace
- (1+
- (- fill-column
- (-
- (progn (end-of-line) (point))
- beg)))))
- (insert (make-string
- (if (> needed-whitespace 0) needed-whitespace 1)
- ? )))
-
- (set (intern (concat texinfo-multitable-rectangle-name
- (int-to-string table-column)))
- (extract-rectangle (point-min) (point)))
- (delete-region (point-min) (point))
- (goto-char (point-max))
- (setq table-column (1+ table-column))
- (widen))
- (let ((total-number-of-columns table-column)
- (column-number 0)
- here)
- (while (> table-column 0)
- (let ((this-rectangle (int-to-string table-column)))
- (while (< (length this-rectangle) table-entry-height)
- (setq this-rectangle (append this-rectangle '("")))))
- (setq table-column (1- table-column)))
- (switch-to-buffer original-buffer)
- (open-line table-entry-height)
- (while (< column-number total-number-of-columns)
- (setq here (point))
- (insert-rectangle
- (eval (intern
- (concat texinfo-multitable-rectangle-name
- (int-to-string column-number)))))
- (goto-char here)
- (end-of-line)
- (setq column-number (1+ column-number))))
- (kill-buffer texinfo-multitable-buffer-name)
- (setq fill-column existing-fill-column)))
- (put 'image 'texinfo-format 'texinfo-format-image)
- (defun texinfo-format-image ()
- "Insert an image from a file ending in .txt.
- Use only the FILENAME arg; for Info, ignore the other arguments to @image."
- (let ((args (texinfo-format-parse-args))
- filename)
- (when (null (nth 0 args))
- (error "Invalid image command"))
- (texinfo-discard-command)
-
- (setq filename (format "%s.txt" (nth 0 args)))
- (message "Reading included file: %s" filename)
-
- (goto-char (+ (point) (cadr (insert-file-contents filename))))
- (message "Reading included file: %s...done" filename)))
- (put 'ifinfo 'texinfo-format 'texinfo-discard-line)
- (put 'ifinfo 'texinfo-end 'texinfo-discard-command)
- (put 'iftex 'texinfo-format 'texinfo-format-iftex)
- (defun texinfo-format-iftex ()
- (delete-region texinfo-command-start
- (re-search-forward "@end iftex[ \t]*\n")))
- (put 'ifhtml 'texinfo-format 'texinfo-format-ifhtml)
- (defun texinfo-format-ifhtml ()
- (delete-region texinfo-command-start
- (re-search-forward "@end ifhtml[ \t]*\n")))
- (put 'ifplaintext 'texinfo-format 'texinfo-format-ifplaintext)
- (defun texinfo-format-ifplaintext ()
- (delete-region texinfo-command-start
- (re-search-forward "@end ifplaintext[ \t]*\n")))
- (put 'ifxml 'texinfo-format 'texinfo-format-ifxml)
- (defun texinfo-format-ifxml ()
- (delete-region texinfo-command-start
- (progn (re-search-forward "^@end ifxml[ \t]*\n")
- (point))))
- (put 'tex 'texinfo-format 'texinfo-format-tex)
- (defun texinfo-format-tex ()
- (delete-region texinfo-command-start
- (re-search-forward "@end tex[ \t]*\n")))
- (put 'html 'texinfo-format 'texinfo-format-html)
- (defun texinfo-format-html ()
- (delete-region texinfo-command-start
- (re-search-forward "@end html[ \t]*\n")))
- (put 'xml 'texinfo-format 'texinfo-format-xml)
- (defun texinfo-format-xml ()
- (delete-region texinfo-command-start
- (progn (re-search-forward "^@end xml[ \t]*\n")
- (point))))
- (put 'ifnotinfo 'texinfo-format 'texinfo-format-ifnotinfo)
- (defun texinfo-format-ifnotinfo ()
- (delete-region texinfo-command-start
- (re-search-forward "@end ifnotinfo[ \t]*\n")))
- (put 'ifnotplaintext 'texinfo-format 'texinfo-discard-line)
- (put 'ifnotplaintext 'texinfo-end 'texinfo-discard-command)
- (put 'ifnottex 'texinfo-format 'texinfo-discard-line)
- (put 'ifnottex 'texinfo-end 'texinfo-discard-command)
- (put 'ifnothtml 'texinfo-format 'texinfo-discard-line)
- (put 'ifnothtml 'texinfo-end 'texinfo-discard-command)
- (put 'ifnotxml 'texinfo-format 'texinfo-discard-line)
- (put 'ifnotxml 'texinfo-end 'texinfo-discard-command)
- (put 'titlepage 'texinfo-format 'texinfo-format-titlepage)
- (defun texinfo-format-titlepage ()
- (delete-region texinfo-command-start
- (re-search-forward "@end titlepage[ \t]*\n")))
- (put 'endtitlepage 'texinfo-format 'texinfo-discard-line)
- (put 'titlespec 'texinfo-format 'texinfo-format-titlespec)
- (defun texinfo-format-titlespec ()
- (delete-region texinfo-command-start
- (re-search-forward "@end titlespec[ \t]*\n")))
- (put 'endtitlespec 'texinfo-format 'texinfo-discard-line)
- (put 'today 'texinfo-format 'texinfo-format-today)
- (defun texinfo-format-today ()
- (texinfo-parse-arg-discard)
- (insert (format-time-string "%e %b %Y")))
- (put 'timestamp 'texinfo-format 'texinfo-format-timestamp)
- (defun texinfo-format-timestamp ()
- "Insert the current local time and date."
- (texinfo-parse-arg-discard)
-
- (insert (format-time-string "%e %b %Y %R")))
- (put 'ignore 'texinfo-format 'texinfo-format-ignore)
- (defun texinfo-format-ignore ()
- (delete-region texinfo-command-start
- (re-search-forward "@end ignore[ \t]*\n")))
- (put 'endignore 'texinfo-format 'texinfo-discard-line)
- (put 'definfoenclose 'texinfo-format 'texinfo-define-info-enclosure)
- (defun texinfo-define-info-enclosure ()
- (let* ((args (texinfo-format-parse-line-args))
- (command-name (nth 0 args))
- (beginning-delimiter (or (nth 1 args) ""))
- (end-delimiter (or (nth 2 args) "")))
- (texinfo-discard-command)
- (push (list command-name
- (list
- beginning-delimiter
- end-delimiter))
- texinfo-enclosure-list)))
- (put 'alias 'texinfo-format 'texinfo-alias)
- (defun texinfo-alias ()
- (let ((start (1- (point)))
- args)
- (skip-chars-forward " ")
- (setq texinfo-command-end (line-end-position))
- (if (not (looking-at "\\([^=]+\\)=\\(.*\\)"))
- (error "Invalid alias command")
- (push (cons
- (match-string-no-properties 1)
- (match-string-no-properties 2))
- texinfo-alias-list)
- (texinfo-discard-command))))
- (put 'var 'texinfo-format 'texinfo-format-var)
- (put 'sc 'texinfo-format 'texinfo-format-var)
- (put 'acronym 'texinfo-format 'texinfo-format-var)
- (defun texinfo-format-var ()
- (let ((arg (texinfo-parse-expanded-arg)))
- (texinfo-discard-command)
- (insert (upcase arg))))
- (put 'cite 'texinfo-format 'texinfo-format-code)
- (put 'code 'texinfo-format 'texinfo-format-code)
- (put 'command 'texinfo-format 'texinfo-format-code)
- (put 'env 'texinfo-format 'texinfo-format-code)
- (put 'file 'texinfo-format 'texinfo-format-code)
- (put 'samp 'texinfo-format 'texinfo-format-code)
- (put 'url 'texinfo-format 'texinfo-format-code)
- (defun texinfo-format-code ()
- (insert "`" (texinfo-parse-arg-discard) "'")
- (goto-char texinfo-command-start))
- (put 'option 'texinfo-format 'texinfo-format-option)
- (defun texinfo-format-option ()
- "Insert ` ... ' around arg unless inside a table; in that case, no quotes."
-
- (if (not (search-backward ""
- (line-beginning-position)
- t))
- (insert "`" (texinfo-parse-arg-discard) "'")
- (insert (texinfo-parse-arg-discard)))
- (goto-char texinfo-command-start))
- (put 'emph 'texinfo-format 'texinfo-format-emph)
- (put 'strong 'texinfo-format 'texinfo-format-emph)
- (defun texinfo-format-emph ()
- (insert "*" (texinfo-parse-arg-discard) "*")
- (goto-char texinfo-command-start))
- (put 'dfn 'texinfo-format 'texinfo-format-defn)
- (put 'defn 'texinfo-format 'texinfo-format-defn)
- (defun texinfo-format-defn ()
- (insert "\"" (texinfo-parse-arg-discard) "\"")
- (goto-char texinfo-command-start))
- (put 'email 'texinfo-format 'texinfo-format-email)
- (defun texinfo-format-email ()
- "Format email address and optional following full name.
- Insert full name, if present, followed by email address
- surrounded by in angle brackets."
- (let ((args (texinfo-format-parse-args)))
- (texinfo-discard-command)
-
- (if (nth 1 args)
- (insert (nth 1 args) " "))
- (insert "<" (nth 0 args) ">")))
- (put 'key 'texinfo-format 'texinfo-format-key)
- (defun texinfo-format-key ()
- (insert (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'verb 'texinfo-format 'texinfo-format-verb)
- (defun texinfo-format-verb ()
- "Format text between non-quoted unique delimiter characters verbatim.
- Enclose the verbatim text, including the delimiters, in braces. Print
- text exactly as written (but not the delimiters) in a fixed-width.
- For example, @verb\{|@|\} results in @ and
- @verb\{+@'e?`!`+} results in @'e?`!`."
- (let ((delimiter (buffer-substring-no-properties
- (1+ texinfo-command-end) (+ 2 texinfo-command-end))))
- (unless (looking-at "{")
- (error "Not found: @verb start brace"))
- (delete-region texinfo-command-start (+ 2 texinfo-command-end))
- (search-forward delimiter))
- (delete-char -1)
- (unless (looking-at "}")
- (error "Not found: @verb end brace"))
- (delete-char 1))
- (put 'bullet 'texinfo-format 'texinfo-format-bullet)
- (defun texinfo-format-bullet ()
- "Insert an asterisk.
- If used within a line, follow `@bullet' with braces."
- (texinfo-optional-braces-discard)
- (insert "*"))
- (defvar texinfo-format-kbd-regexp
- (concat
- "^@"
- "\\("
- "display\\|"
- "example\\|"
- "smallexample\\|"
- "lisp\\|"
- "smalllisp"
- "\\)")
- "Regexp matching environments in which @kbd does not put `...' around arg.")
- (defvar texinfo-format-kbd-end-regexp
- (concat
- "^@end "
- "\\("
- "display\\|"
- "example\\|"
- "smallexample\\|"
- "lisp\\|"
- "smalllisp"
- "\\)")
- "Regexp specifying end of environments in which @kbd does not put `...'
- around argument. (See `texinfo-format-kbd-regexp')")
- (put 'kbd 'texinfo-format 'texinfo-format-kbd)
- (defun texinfo-format-kbd ()
- "Place single quote marks around arg, except in @example and similar."
-
-
- (let* ((stop
- (save-excursion
- (re-search-forward
- (concat "^@node\\|\\(" texinfo-section-types-regexp "\\)")
- nil
- 'move-to-end)
- (point)))
- (example-location
- (save-excursion
- (re-search-forward texinfo-format-kbd-regexp stop 'move-to-end)
- (point)))
- (end-example-location
- (save-excursion
- (re-search-forward texinfo-format-kbd-end-regexp stop 'move-to-end)
- (point))))
-
-
- (if (>= end-example-location example-location)
-
- (insert "`" (texinfo-parse-arg-discard) "'")
-
- (insert (texinfo-parse-arg-discard)))
- (goto-char texinfo-command-start)))
- (put 'display 'texinfo-format 'texinfo-format-example)
- (put 'smalldisplay 'texinfo-format 'texinfo-format-example)
- (put 'example 'texinfo-format 'texinfo-format-example)
- (put 'lisp 'texinfo-format 'texinfo-format-example)
- (put 'quotation 'texinfo-format 'texinfo-format-example)
- (put 'smallexample 'texinfo-format 'texinfo-format-example)
- (put 'smalllisp 'texinfo-format 'texinfo-format-example)
- (defun texinfo-format-example ()
- (texinfo-push-stack 'example nil)
- (setq fill-column (- fill-column 5))
- (texinfo-discard-line))
- (put 'example 'texinfo-end 'texinfo-end-example)
- (put 'display 'texinfo-end 'texinfo-end-example)
- (put 'smalldisplay 'texinfo-end 'texinfo-end-example)
- (put 'lisp 'texinfo-end 'texinfo-end-example)
- (put 'quotation 'texinfo-end 'texinfo-end-example)
- (put 'smallexample 'texinfo-end 'texinfo-end-example)
- (put 'smalllisp 'texinfo-end 'texinfo-end-example)
- (defun texinfo-end-example ()
- (setq fill-column (+ fill-column 5))
- (texinfo-discard-command)
- (let ((stacktop
- (texinfo-pop-stack 'example)))
- (texinfo-do-itemize (nth 1 stacktop))))
- (put 'exdent 'texinfo-format 'texinfo-format-exdent)
- (defun texinfo-format-exdent ()
- (texinfo-discard-command)
- (delete-region (point)
- (progn
- (skip-chars-forward " ")
- (point)))
- (insert ?\b)
-
-
- (save-excursion
- (end-of-line)
- (insert "\n ")))
- (put 'direntry 'texinfo-format 'texinfo-format-direntry)
- (defun texinfo-format-direntry ()
- (texinfo-push-stack 'direntry nil)
- (texinfo-discard-line)
- (insert "START-INFO-DIR-ENTRY\n"))
- (put 'direntry 'texinfo-end 'texinfo-end-direntry)
- (defun texinfo-end-direntry ()
- (texinfo-discard-command)
- (insert "END-INFO-DIR-ENTRY\n\n")
- (texinfo-pop-stack 'direntry))
- (put 'dircategory 'texinfo-format 'texinfo-format-dircategory)
- (defun texinfo-format-dircategory ()
- (let ((str (texinfo-parse-arg-discard)))
- (delete-region (point)
- (progn
- (skip-chars-forward " ")
- (point)))
- (insert "INFO-DIR-SECTION " str "\n")))
- (put 'cartouche 'texinfo-format 'texinfo-discard-line)
- (put 'cartouche 'texinfo-end 'texinfo-discard-command)
- (put 'format 'texinfo-format 'texinfo-format-flushleft)
- (put 'smallformat 'texinfo-format 'texinfo-format-flushleft)
- (put 'flushleft 'texinfo-format 'texinfo-format-flushleft)
- (defun texinfo-format-flushleft ()
- (texinfo-discard-line))
- (put 'format 'texinfo-end 'texinfo-end-flushleft)
- (put 'smallformat 'texinfo-end 'texinfo-end-flushleft)
- (put 'flushleft 'texinfo-end 'texinfo-end-flushleft)
- (defun texinfo-end-flushleft ()
- (texinfo-discard-command))
- (put 'flushright 'texinfo-format 'texinfo-format-flushright)
- (defun texinfo-format-flushright ()
- (texinfo-push-stack 'flushright nil)
- (texinfo-discard-line))
- (put 'flushright 'texinfo-end 'texinfo-end-flushright)
- (defun texinfo-end-flushright ()
- (texinfo-discard-command)
- (let ((stacktop
- (texinfo-pop-stack 'flushright)))
- (texinfo-do-flushright (nth 1 stacktop))))
- (defun texinfo-do-flushright (from)
- (save-excursion
- (while (progn (forward-line -1)
- (>= (point) from))
- (beginning-of-line)
- (insert
- (make-string
- (- fill-column
- (save-excursion
- (end-of-line)
- (skip-chars-backward " \t")
- (delete-region (point) (progn (end-of-line) (point)))
- (current-column)))
- ? )))))
- (put 'ctrl 'texinfo-format 'texinfo-format-ctrl)
- (defun texinfo-format-ctrl ()
- (let ((str (texinfo-parse-arg-discard)))
- (insert (logand 31 (aref str 0)))))
- (put 'TeX 'texinfo-format 'texinfo-format-TeX)
- (defun texinfo-format-TeX ()
- (texinfo-parse-arg-discard)
- (insert "TeX"))
- (put 'copyright 'texinfo-format 'texinfo-format-copyright)
- (defun texinfo-format-copyright ()
- (texinfo-parse-arg-discard)
- (insert "(C)"))
- (put 'minus 'texinfo-format 'texinfo-format-minus)
- (defun texinfo-format-minus ()
- "Insert a minus sign.
- If used within a line, follow `@minus' with braces."
- (texinfo-optional-braces-discard)
- (insert "-"))
- (put 'dots 'texinfo-format 'texinfo-format-dots)
- (defun texinfo-format-dots ()
- (texinfo-parse-arg-discard)
- (insert "..."))
- (put 'enddots 'texinfo-format 'texinfo-format-enddots)
- (defun texinfo-format-enddots ()
- (texinfo-parse-arg-discard)
- (insert "...."))
- (put 'pounds 'texinfo-format 'texinfo-format-pounds)
- (defun texinfo-format-pounds ()
- (texinfo-parse-arg-discard)
- (insert "#"))
- (defvar texinfo-paragraph-indent "asis"
- "Number of spaces for @refill to indent a paragraph; else to leave as is.")
- (put 'paragraphindent 'texinfo-format 'texinfo-paragraphindent)
- (defun texinfo-paragraphindent ()
- "Specify the number of spaces for @refill to indent a paragraph.
- Default is to leave the number of spaces as is."
- (let ((arg (texinfo-parse-arg-discard)))
- (if (string= "asis" arg)
- (setq texinfo-paragraph-indent "asis")
- (setq texinfo-paragraph-indent (string-to-number arg)))))
- (put 'refill 'texinfo-format 'texinfo-format-refill)
- (defun texinfo-format-refill ()
- "Refill paragraph. Also, indent first line as set by @paragraphindent.
- Default is to leave paragraph indentation as is."
- (texinfo-discard-command)
- (let ((position (point-marker)))
- (forward-paragraph -1)
- (if (looking-at "[ \t\n]*$") (forward-line 1))
-
-
-
- (cond
-
- ((save-excursion (forward-line -1)
- (looking-at "^@noindent"))
- (forward-line -1)
- (delete-region (point) (progn (forward-line 1) (point))))
-
- ((equal texinfo-paragraph-indent "asis"))
-
- ((> texinfo-stack-depth 0))
-
- (t
- (delete-region (point) (progn (skip-chars-forward " \t") (point)))
- (insert (make-string texinfo-paragraph-indent ? ))))
- (forward-paragraph 1)
- (forward-line -1)
- (end-of-line)
-
-
-
- (let* ((previous-paragraph-separate paragraph-separate)
- (paragraph-separate
- (concat paragraph-separate "\\|[-=.]+\\|\\*\\*+"))
- (previous-paragraph-start paragraph-start)
- (paragraph-start
- (concat paragraph-start "\\|[-=.]+\\|\\*\\*+")))
- (unwind-protect
- (fill-paragraph nil)
- (setq paragraph-separate previous-paragraph-separate)
- (setq paragraph-start previous-paragraph-start)))
- (goto-char position)))
- (put 'noindent 'texinfo-format 'texinfo-noindent)
- (defun texinfo-noindent ()
- (save-excursion
- (forward-paragraph 1)
- (if (search-backward "@refill" (line-beginning-position 0) t)
- ()
-
- (texinfo-discard-line))))
- (put 'vindex 'texinfo-format 'texinfo-format-vindex)
- (defun texinfo-format-vindex ()
- (texinfo-index 'texinfo-vindex))
- (put 'cindex 'texinfo-format 'texinfo-format-cindex)
- (defun texinfo-format-cindex ()
- (texinfo-index 'texinfo-cindex))
- (put 'findex 'texinfo-format 'texinfo-format-findex)
- (defun texinfo-format-findex ()
- (texinfo-index 'texinfo-findex))
- (put 'pindex 'texinfo-format 'texinfo-format-pindex)
- (defun texinfo-format-pindex ()
- (texinfo-index 'texinfo-pindex))
- (put 'tindex 'texinfo-format 'texinfo-format-tindex)
- (defun texinfo-format-tindex ()
- (texinfo-index 'texinfo-tindex))
- (put 'kindex 'texinfo-format 'texinfo-format-kindex)
- (defun texinfo-format-kindex ()
- (texinfo-index 'texinfo-kindex))
- (defun texinfo-index (indexvar)
- (let ((arg (texinfo-parse-expanded-arg)))
- (texinfo-discard-command)
- (set indexvar
- (cons (list arg
- texinfo-last-node
-
- (if texinfo-last-node-pos
- (1+ (count-lines texinfo-last-node-pos (point)))
- 1))
- (symbol-value indexvar)))))
- (defvar texinfo-indexvar-alist
- '(("cp" . texinfo-cindex)
- ("fn" . texinfo-findex)
- ("vr" . texinfo-vindex)
- ("tp" . texinfo-tindex)
- ("pg" . texinfo-pindex)
- ("ky" . texinfo-kindex)))
- (put 'defindex 'texinfo-format 'texinfo-format-defindex)
- (put 'defcodeindex 'texinfo-format 'texinfo-format-defindex)
- (defun texinfo-format-defindex ()
- (let* ((index-name (texinfo-parse-arg-discard))
- (indexing-command (intern (concat index-name "index")))
- (index-formatting-command
- (intern (concat "texinfo-format-" index-name "index")))
- (index-alist-name
- (intern (concat "texinfo-" index-name "index"))))
- (set index-alist-name nil)
- (put indexing-command
- 'texinfo-format
- index-formatting-command)
-
- (or (assoc index-name texinfo-indexvar-alist)
- (push (cons index-name
- index-alist-name)
- texinfo-indexvar-alist))
- (fset index-formatting-command
- (list 'lambda 'nil
- (list 'texinfo-index
- (list 'quote index-alist-name))))))
- (put 'synindex 'texinfo-format 'texinfo-format-synindex)
- (put 'syncodeindex 'texinfo-format 'texinfo-format-synindex)
- (defun texinfo-format-synindex ()
- (let* ((args (texinfo-parse-arg-discard))
- (second (cdr (read-from-string args)))
- (joiner (symbol-name (car (read-from-string args))))
- (joined (symbol-name (car (read-from-string args second)))))
- (if (assoc joiner texinfo-short-index-cmds-alist)
- (put
- (cdr (assoc joiner texinfo-short-index-cmds-alist))
- 'texinfo-format
- (or (cdr (assoc joined texinfo-short-index-format-cmds-alist))
- (intern (concat "texinfo-format-" joined "index"))))
- (put
- (intern (concat joiner "index"))
- 'texinfo-format
- (or (cdr(assoc joined texinfo-short-index-format-cmds-alist))
- (intern (concat "texinfo-format-" joined "index")))))))
- (defconst texinfo-short-index-cmds-alist
- '(("cp" . cindex)
- ("fn" . findex)
- ("vr" . vindex)
- ("tp" . tindex)
- ("pg" . pindex)
- ("ky" . kindex)))
- (defconst texinfo-short-index-format-cmds-alist
- '(("cp" . texinfo-format-cindex)
- ("fn" . texinfo-format-findex)
- ("vr" . texinfo-format-vindex)
- ("tp" . texinfo-format-tindex)
- ("pg" . texinfo-format-pindex)
- ("ky" . texinfo-format-kindex)))
- (put 'printindex 'texinfo-format 'texinfo-format-printindex)
- (defun texinfo-format-printindex ()
- (let* ((arg (texinfo-parse-arg-discard))
- (fmt (cdr (assoc arg texinfo-short-index-format-cmds-alist)))
- (index-list (delq nil (mapcar (lambda (e)
- (and (eq fmt (get (cdr e) 'texinfo-format))
- (cdr (assoc (car e) texinfo-indexvar-alist))))
- texinfo-short-index-cmds-alist)))
- (indexelts (apply #'append nil (mapcar #'symbol-value index-list)))
- opoint)
- (insert "\n* Menu:\n\n")
- (setq opoint (point))
- (texinfo-print-index nil indexelts)
- (shell-command-on-region opoint (point) "sort -fd" 1)))
- (defun texinfo-print-index (file indexelts)
- (while indexelts
- (if (stringp (car (car indexelts)))
- (progn
- (insert "* " (car (car indexelts)) ": " )
- (indent-to 32)
- (insert
- (if file (concat "(" file ")") "")
- (nth 1 (car indexelts)) ".")
- (indent-to 54)
- (insert
- (if (nth 2 (car indexelts))
- (format " (line %3d)" (1+ (nth 2 (car indexelts))))
- "")
- "\n"))
-
- (texinfo-print-index (nth 1 (car indexelts))
- (nth 2 (car indexelts))))
- (setq indexelts (cdr indexelts))))
- (put 'equiv 'texinfo-format 'texinfo-format-equiv)
- (defun texinfo-format-equiv ()
- (texinfo-parse-arg-discard)
- (insert "=="))
- (put 'error 'texinfo-format 'texinfo-format-error)
- (defun texinfo-format-error ()
- (texinfo-parse-arg-discard)
- (insert "error-->"))
- (put 'expansion 'texinfo-format 'texinfo-format-expansion)
- (defun texinfo-format-expansion ()
- (texinfo-parse-arg-discard)
- (insert "==>"))
- (put 'point 'texinfo-format 'texinfo-format-point)
- (defun texinfo-format-point ()
- (texinfo-parse-arg-discard)
- (insert "-!-"))
- (put 'print 'texinfo-format 'texinfo-format-print)
- (defun texinfo-format-print ()
- (texinfo-parse-arg-discard)
- (insert "-|"))
- (put 'result 'texinfo-format 'texinfo-format-result)
- (defun texinfo-format-result ()
- (texinfo-parse-arg-discard)
- (insert "=>"))
- (put 'OE 'texinfo-format 'texinfo-format-French-OE-ligature)
- (defun texinfo-format-French-OE-ligature ()
- (insert "OE" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'oe 'texinfo-format 'texinfo-format-French-oe-ligature)
- (defun texinfo-format-French-oe-ligature ()
- (insert "oe" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'AA 'texinfo-format 'texinfo-format-Scandinavian-A-with-circle)
- (defun texinfo-format-Scandinavian-A-with-circle ()
- (insert "AA" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'aa 'texinfo-format 'texinfo-format-Scandinavian-a-with-circle)
- (defun texinfo-format-Scandinavian-a-with-circle ()
- (insert "aa" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'AE 'texinfo-format 'texinfo-format-Latin-Scandinavian-AE)
- (defun texinfo-format-Latin-Scandinavian-AE ()
- (insert "AE" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'ae 'texinfo-format 'texinfo-format-Latin-Scandinavian-ae)
- (defun texinfo-format-Latin-Scandinavian-ae ()
- (insert "ae" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'ss 'texinfo-format 'texinfo-format-German-sharp-S)
- (defun texinfo-format-German-sharp-S ()
- (insert "ss" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'questiondown 'texinfo-format 'texinfo-format-upside-down-question-mark)
- (defun texinfo-format-upside-down-question-mark ()
- (insert "?" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'exclamdown 'texinfo-format 'texinfo-format-upside-down-exclamation-mark)
- (defun texinfo-format-upside-down-exclamation-mark ()
- (insert "!" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'L 'texinfo-format 'texinfo-format-Polish-suppressed-L)
- (defun texinfo-format-Polish-suppressed-L ()
- (insert (texinfo-parse-arg-discard) "/L")
- (goto-char texinfo-command-start))
- (put 'l 'texinfo-format 'texinfo-format-Polish-suppressed-l-lower-case)
- (defun texinfo-format-Polish-suppressed-l-lower-case ()
- (insert (texinfo-parse-arg-discard) "/l")
- (goto-char texinfo-command-start))
- (put 'O 'texinfo-format 'texinfo-format-Scandinavian-O-with-slash)
- (defun texinfo-format-Scandinavian-O-with-slash ()
- (insert (texinfo-parse-arg-discard) "O/")
- (goto-char texinfo-command-start))
- (put 'o 'texinfo-format 'texinfo-format-Scandinavian-o-with-slash-lower-case)
- (defun texinfo-format-Scandinavian-o-with-slash-lower-case ()
- (insert (texinfo-parse-arg-discard) "o/")
- (goto-char texinfo-command-start))
- (put '\, 'texinfo-format 'texinfo-format-cedilla-accent)
- (defun texinfo-format-cedilla-accent ()
- (insert (texinfo-parse-arg-discard) ",")
- (goto-char texinfo-command-start))
- (put 'dotaccent 'texinfo-format 'texinfo-format-overdot-accent)
- (defun texinfo-format-overdot-accent ()
- (insert "." (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'ubaraccent 'texinfo-format 'texinfo-format-underbar-accent)
- (defun texinfo-format-underbar-accent ()
- (insert "_" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'udotaccent 'texinfo-format 'texinfo-format-underdot-accent)
- (defun texinfo-format-underdot-accent ()
- (insert (texinfo-parse-arg-discard) "-.")
- (goto-char texinfo-command-start))
- (put 'H 'texinfo-format 'texinfo-format-long-Hungarian-umlaut)
- (defun texinfo-format-long-Hungarian-umlaut ()
- (insert "\"\"" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'ringaccent 'texinfo-format 'texinfo-format-ring-accent)
- (defun texinfo-format-ring-accent ()
- (insert "*" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'tieaccent 'texinfo-format 'texinfo-format-tie-after-accent)
- (defun texinfo-format-tie-after-accent ()
- (insert "[" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'u 'texinfo-format 'texinfo-format-breve-accent)
- (defun texinfo-format-breve-accent ()
- (insert "(" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'v 'texinfo-format 'texinfo-format-hacek-accent)
- (defun texinfo-format-hacek-accent ()
- (insert "<" (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'dotless 'texinfo-format 'texinfo-format-dotless)
- (defun texinfo-format-dotless ()
- (insert (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (defun texinfo-format-defun ()
- (texinfo-push-stack 'defun nil)
- (setq fill-column (- fill-column 5))
- (texinfo-format-defun-1 t))
- (defun texinfo-end-defun ()
- (setq fill-column (+ fill-column 5))
- (texinfo-discard-command)
- (let ((start (nth 1 (texinfo-pop-stack 'defun))))
- (texinfo-do-itemize start)
-
- (save-excursion
- (goto-char start)
- (delete-char -1))))
- (defun texinfo-format-defunx ()
- (texinfo-format-defun-1 nil))
- (defun texinfo-format-defun-1 (first-p)
- (let ((parse-args (texinfo-format-parse-defun-args))
- (texinfo-defun-type (get texinfo-command-name 'texinfo-defun-type)))
- (texinfo-discard-command)
-
- (if (not first-p)
- (delete-char -1))
- (funcall
- (get texinfo-command-name 'texinfo-deffn-formatting-property) parse-args)
-
-
- (insert "\n\n")
- (rplaca (cdr (cdr (car texinfo-stack))) (point))
- (funcall
- (get texinfo-command-name 'texinfo-defun-indexing-property) parse-args)))
- (put 'deffn 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
- (put 'deffnx 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
- (put 'defvr 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
- (put 'defvrx 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
- (put 'deftp 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
- (put 'deftpx 'texinfo-deffn-formatting-property 'texinfo-format-deffn)
- (defun texinfo-format-deffn (parsed-args)
-
-
-
-
-
- (let ((category (car parsed-args))
- (name (car (cdr parsed-args)))
- (args (cdr (cdr parsed-args))))
- (insert " -- " category ": " name)
- (while args
- (insert " "
- (if (or (= ?& (aref (car args) 0))
- (eq (eval (car texinfo-defun-type)) 'deftp-type))
- (car args)
- (upcase (car args))))
- (setq args (cdr args)))))
- (put 'defun 'texinfo-deffn-formatting-property
- 'texinfo-format-specialized-defun)
- (put 'defunx 'texinfo-deffn-formatting-property
- 'texinfo-format-specialized-defun)
- (put 'defmac 'texinfo-deffn-formatting-property
- 'texinfo-format-specialized-defun)
- (put 'defmacx 'texinfo-deffn-formatting-property
- 'texinfo-format-specialized-defun)
- (put 'defspec 'texinfo-deffn-formatting-property
- 'texinfo-format-specialized-defun)
- (put 'defspecx 'texinfo-deffn-formatting-property
- 'texinfo-format-specialized-defun)
- (put 'defvar 'texinfo-deffn-formatting-property
- 'texinfo-format-specialized-defun)
- (put 'defvarx 'texinfo-deffn-formatting-property
- 'texinfo-format-specialized-defun)
- (put 'defopt 'texinfo-deffn-formatting-property
- 'texinfo-format-specialized-defun)
- (put 'defoptx 'texinfo-deffn-formatting-property
- 'texinfo-format-specialized-defun)
- (defun texinfo-format-specialized-defun (parsed-args)
-
-
-
-
-
- (let ((category (car (cdr texinfo-defun-type)))
- (name (car parsed-args))
- (args (cdr parsed-args)))
- (insert " -- " category ": " name)
- (while args
- (insert " "
- (if (= ?& (aref (car args) 0))
- (car args)
- (upcase (car args))))
- (setq args (cdr args)))))
- (put 'deftypefn 'texinfo-deffn-formatting-property 'texinfo-format-deftypefn)
- (put 'deftypefnx 'texinfo-deffn-formatting-property 'texinfo-format-deftypefn)
- (put 'deftypevr 'texinfo-deffn-formatting-property 'texinfo-format-deftypefn)
- (put 'deftypevrx 'texinfo-deffn-formatting-property 'texinfo-format-deftypefn)
- (defun texinfo-format-deftypefn (parsed-args)
-
-
-
-
-
-
- (let ((category (car parsed-args))
- (data-type (car (cdr parsed-args)))
- (name (car (cdr (cdr parsed-args))))
- (args (cdr (cdr (cdr parsed-args)))))
- (insert " -- " category ": " data-type " " name)
- (while args
- (insert " " (car args))
- (setq args (cdr args)))))
- (put 'deftypefun 'texinfo-deffn-formatting-property 'texinfo-format-deftypefun)
- (put 'deftypefunx 'texinfo-deffn-formatting-property
- 'texinfo-format-deftypefun)
- (put 'deftypevar 'texinfo-deffn-formatting-property 'texinfo-format-deftypefun)
- (put 'deftypevarx 'texinfo-deffn-formatting-property
- 'texinfo-format-deftypefun)
- (defun texinfo-format-deftypefun (parsed-args)
-
-
-
-
-
-
-
- (let ((category (car (cdr texinfo-defun-type)))
- (data-type (car parsed-args))
- (name (car (cdr parsed-args)))
- (args (cdr (cdr parsed-args))))
- (insert " -- " category ": " data-type " " name)
- (while args
- (insert " " (car args))
- (setq args (cdr args)))))
- (put 'defop 'texinfo-deffn-formatting-property 'texinfo-format-defop)
- (put 'defopx 'texinfo-deffn-formatting-property 'texinfo-format-defop)
- (defun texinfo-format-defop (parsed-args)
-
-
-
-
- (let ((category (car parsed-args))
- (class (car (cdr parsed-args)))
- (name (car (cdr (cdr parsed-args))))
- (args (cdr (cdr (cdr parsed-args)))))
- (insert " -- " category " on " class ": " name)
- (while args
- (insert " " (upcase (car args)))
- (setq args (cdr args)))))
- (put 'defcv 'texinfo-deffn-formatting-property 'texinfo-format-defcv)
- (put 'defcvx 'texinfo-deffn-formatting-property 'texinfo-format-defcv)
- (defun texinfo-format-defcv (parsed-args)
-
-
-
-
- (let ((category (car parsed-args))
- (class (car (cdr parsed-args)))
- (name (car (cdr (cdr parsed-args))))
- (args (cdr (cdr (cdr parsed-args)))))
- (insert " -- " category " of " class ": " name)
- (while args
- (insert " " (upcase (car args)))
- (setq args (cdr args)))))
- (put 'defmethod 'texinfo-deffn-formatting-property 'texinfo-format-defmethod)
- (put 'defmethodx 'texinfo-deffn-formatting-property 'texinfo-format-defmethod)
- (defun texinfo-format-defmethod (parsed-args)
-
-
-
-
-
- (let ((category (car (cdr texinfo-defun-type)))
- (class (car parsed-args))
- (name (car (cdr parsed-args)))
- (args (cdr (cdr parsed-args))))
- (insert " -- " category " on " class ": " name)
- (while args
- (insert " " (upcase (car args)))
- (setq args (cdr args)))))
- (put 'defivar 'texinfo-deffn-formatting-property 'texinfo-format-defivar)
- (put 'defivarx 'texinfo-deffn-formatting-property 'texinfo-format-defivar)
- (defun texinfo-format-defivar (parsed-args)
-
-
-
-
-
- (let ((category (car (cdr texinfo-defun-type)))
- (class (car parsed-args))
- (name (car (cdr parsed-args)))
- (args (cdr (cdr parsed-args))))
- (insert " -- " category " of " class ": " name)
- (while args
- (insert " " (upcase (car args)))
- (setq args (cdr args)))))
- (put 'defun 'texinfo-defun-indexing-property 'texinfo-index-defun)
- (put 'defunx 'texinfo-defun-indexing-property 'texinfo-index-defun)
- (put 'defmac 'texinfo-defun-indexing-property 'texinfo-index-defun)
- (put 'defmacx 'texinfo-defun-indexing-property 'texinfo-index-defun)
- (put 'defspec 'texinfo-defun-indexing-property 'texinfo-index-defun)
- (put 'defspecx 'texinfo-defun-indexing-property 'texinfo-index-defun)
- (put 'defvar 'texinfo-defun-indexing-property 'texinfo-index-defun)
- (put 'defvarx 'texinfo-defun-indexing-property 'texinfo-index-defun)
- (put 'defopt 'texinfo-defun-indexing-property 'texinfo-index-defun)
- (put 'defoptx 'texinfo-defun-indexing-property 'texinfo-index-defun)
- (defun texinfo-index-defun (parsed-args)
-
-
- (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
- (set index-list
- (cons
-
- (list
- (car parsed-args)
- texinfo-last-node
-
- (if texinfo-last-node-pos
- (1+ (count-lines texinfo-last-node-pos (point)))
- 1))
- (symbol-value index-list)))))
- (put 'deffn 'texinfo-defun-indexing-property 'texinfo-index-deffn)
- (put 'deffnx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
- (put 'defvr 'texinfo-defun-indexing-property 'texinfo-index-deffn)
- (put 'defvrx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
- (put 'deftp 'texinfo-defun-indexing-property 'texinfo-index-deffn)
- (put 'deftpx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
- (put 'deftypefun 'texinfo-defun-indexing-property 'texinfo-index-deffn)
- (put 'deftypefunx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
- (put 'deftypevar 'texinfo-defun-indexing-property 'texinfo-index-deffn)
- (put 'deftypevarx 'texinfo-defun-indexing-property 'texinfo-index-deffn)
- (defun texinfo-index-deffn (parsed-args)
-
-
- (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
- (set index-list
- (cons
-
- (list
- (car (cdr parsed-args))
- texinfo-last-node
-
- (if texinfo-last-node-pos
- (1+ (count-lines texinfo-last-node-pos (point)))
- 1))
- (symbol-value index-list)))))
- (put 'deftypefn 'texinfo-defun-indexing-property 'texinfo-index-deftypefn)
- (put 'deftypefnx 'texinfo-defun-indexing-property 'texinfo-index-deftypefn)
- (put 'deftypevr 'texinfo-defun-indexing-property 'texinfo-index-deftypefn)
- (put 'deftypevrx 'texinfo-defun-indexing-property 'texinfo-index-deftypefn)
- (defun texinfo-index-deftypefn (parsed-args)
-
-
- (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
- (set index-list
- (cons
-
- (list
- (car (cdr (cdr parsed-args)))
- texinfo-last-node
-
- (if texinfo-last-node-pos
- (1+ (count-lines texinfo-last-node-pos (point)))
- 1))
- (symbol-value index-list)))))
- (put 'defmethod 'texinfo-defun-indexing-property 'texinfo-index-defmethod)
- (put 'defmethodx 'texinfo-defun-indexing-property 'texinfo-index-defmethod)
- (defun texinfo-index-defmethod (parsed-args)
-
-
- (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
- (set index-list
- (cons
-
- (list
- (format "%s on %s"
- (car (cdr parsed-args))
- (car parsed-args))
- texinfo-last-node
-
- (if texinfo-last-node-pos
- (1+ (count-lines texinfo-last-node-pos (point)))
- 1))
- (symbol-value index-list)))))
- (put 'defop 'texinfo-defun-indexing-property 'texinfo-index-defop)
- (put 'defopx 'texinfo-defun-indexing-property 'texinfo-index-defop)
- (defun texinfo-index-defop (parsed-args)
-
-
- (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
- (set index-list
- (cons
-
- (list
- (format "%s on %s"
- (car (cdr (cdr parsed-args)))
- (car (cdr parsed-args)))
- texinfo-last-node
-
- (if texinfo-last-node-pos
- (1+ (count-lines texinfo-last-node-pos (point)))
- 1))
- (symbol-value index-list)))))
- (put 'defivar 'texinfo-defun-indexing-property 'texinfo-index-defivar)
- (put 'defivarx 'texinfo-defun-indexing-property 'texinfo-index-defivar)
- (defun texinfo-index-defivar (parsed-args)
-
-
- (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
- (set index-list
- (cons
-
- (list
- (format "%s of %s"
- (car (cdr parsed-args))
- (car parsed-args))
- texinfo-last-node
-
- (if texinfo-last-node-pos
- (1+ (count-lines texinfo-last-node-pos (point)))
- 1))
- (symbol-value index-list)))))
- (put 'defcv 'texinfo-defun-indexing-property 'texinfo-index-defcv)
- (put 'defcvx 'texinfo-defun-indexing-property 'texinfo-index-defcv)
- (defun texinfo-index-defcv (parsed-args)
-
-
- (let ((index-list (get texinfo-command-name 'texinfo-defun-index)))
- (set index-list
- (cons
-
- (list
- (format "%s of %s"
- (car (cdr (cdr parsed-args)))
- (car (cdr parsed-args)))
- texinfo-last-node
-
- (if texinfo-last-node-pos
- (1+ (count-lines texinfo-last-node-pos (point)))
- 1))
- (symbol-value index-list)))))
- (put 'deffn 'texinfo-format 'texinfo-format-defun)
- (put 'deffnx 'texinfo-format 'texinfo-format-defunx)
- (put 'deffn 'texinfo-end 'texinfo-end-defun)
- (put 'deffn 'texinfo-defun-type '('deffn-type nil))
- (put 'deffnx 'texinfo-defun-type '('deffn-type nil))
- (put 'deffn 'texinfo-defun-index 'texinfo-findex)
- (put 'deffnx 'texinfo-defun-index 'texinfo-findex)
- (put 'defun 'texinfo-format 'texinfo-format-defun)
- (put 'defunx 'texinfo-format 'texinfo-format-defunx)
- (put 'defun 'texinfo-end 'texinfo-end-defun)
- (put 'defun 'texinfo-defun-type '('defun-type "Function"))
- (put 'defunx 'texinfo-defun-type '('defun-type "Function"))
- (put 'defun 'texinfo-defun-index 'texinfo-findex)
- (put 'defunx 'texinfo-defun-index 'texinfo-findex)
- (put 'defmac 'texinfo-format 'texinfo-format-defun)
- (put 'defmacx 'texinfo-format 'texinfo-format-defunx)
- (put 'defmac 'texinfo-end 'texinfo-end-defun)
- (put 'defmac 'texinfo-defun-type '('defun-type "Macro"))
- (put 'defmacx 'texinfo-defun-type '('defun-type "Macro"))
- (put 'defmac 'texinfo-defun-index 'texinfo-findex)
- (put 'defmacx 'texinfo-defun-index 'texinfo-findex)
- (put 'defspec 'texinfo-format 'texinfo-format-defun)
- (put 'defspecx 'texinfo-format 'texinfo-format-defunx)
- (put 'defspec 'texinfo-end 'texinfo-end-defun)
- (put 'defspec 'texinfo-defun-type '('defun-type "Special form"))
- (put 'defspecx 'texinfo-defun-type '('defun-type "Special form"))
- (put 'defspec 'texinfo-defun-index 'texinfo-findex)
- (put 'defspecx 'texinfo-defun-index 'texinfo-findex)
- (put 'defvr 'texinfo-format 'texinfo-format-defun)
- (put 'defvrx 'texinfo-format 'texinfo-format-defunx)
- (put 'defvr 'texinfo-end 'texinfo-end-defun)
- (put 'defvr 'texinfo-defun-type '('deffn-type nil))
- (put 'defvrx 'texinfo-defun-type '('deffn-type nil))
- (put 'defvr 'texinfo-defun-index 'texinfo-vindex)
- (put 'defvrx 'texinfo-defun-index 'texinfo-vindex)
- (put 'defvar 'texinfo-format 'texinfo-format-defun)
- (put 'defvarx 'texinfo-format 'texinfo-format-defunx)
- (put 'defvar 'texinfo-end 'texinfo-end-defun)
- (put 'defvar 'texinfo-defun-type '('defun-type "Variable"))
- (put 'defvarx 'texinfo-defun-type '('defun-type "Variable"))
- (put 'defvar 'texinfo-defun-index 'texinfo-vindex)
- (put 'defvarx 'texinfo-defun-index 'texinfo-vindex)
- (put 'defconst 'texinfo-format 'texinfo-format-defun)
- (put 'defconstx 'texinfo-format 'texinfo-format-defunx)
- (put 'defconst 'texinfo-end 'texinfo-end-defun)
- (put 'defconst 'texinfo-defun-type '('defun-type "Constant"))
- (put 'defconstx 'texinfo-defun-type '('defun-type "Constant"))
- (put 'defconst 'texinfo-defun-index 'texinfo-vindex)
- (put 'defconstx 'texinfo-defun-index 'texinfo-vindex)
- (put 'defcmd 'texinfo-format 'texinfo-format-defun)
- (put 'defcmdx 'texinfo-format 'texinfo-format-defunx)
- (put 'defcmd 'texinfo-end 'texinfo-end-defun)
- (put 'defcmd 'texinfo-defun-type '('defun-type "Command"))
- (put 'defcmdx 'texinfo-defun-type '('defun-type "Command"))
- (put 'defcmd 'texinfo-defun-index 'texinfo-findex)
- (put 'defcmdx 'texinfo-defun-index 'texinfo-findex)
- (put 'defopt 'texinfo-format 'texinfo-format-defun)
- (put 'defoptx 'texinfo-format 'texinfo-format-defunx)
- (put 'defopt 'texinfo-end 'texinfo-end-defun)
- (put 'defopt 'texinfo-defun-type '('defun-type "User Option"))
- (put 'defoptx 'texinfo-defun-type '('defun-type "User Option"))
- (put 'defopt 'texinfo-defun-index 'texinfo-vindex)
- (put 'defoptx 'texinfo-defun-index 'texinfo-vindex)
- (put 'deftp 'texinfo-format 'texinfo-format-defun)
- (put 'deftpx 'texinfo-format 'texinfo-format-defunx)
- (put 'deftp 'texinfo-end 'texinfo-end-defun)
- (put 'deftp 'texinfo-defun-type '('deftp-type nil))
- (put 'deftpx 'texinfo-defun-type '('deftp-type nil))
- (put 'deftp 'texinfo-defun-index 'texinfo-tindex)
- (put 'deftpx 'texinfo-defun-index 'texinfo-tindex)
- (put 'defop 'texinfo-format 'texinfo-format-defun)
- (put 'defopx 'texinfo-format 'texinfo-format-defunx)
- (put 'defop 'texinfo-end 'texinfo-end-defun)
- (put 'defop 'texinfo-defun-type '('defop-type nil))
- (put 'defopx 'texinfo-defun-type '('defop-type nil))
- (put 'defop 'texinfo-defun-index 'texinfo-findex)
- (put 'defopx 'texinfo-defun-index 'texinfo-findex)
- (put 'defmethod 'texinfo-format 'texinfo-format-defun)
- (put 'defmethodx 'texinfo-format 'texinfo-format-defunx)
- (put 'defmethod 'texinfo-end 'texinfo-end-defun)
- (put 'defmethod 'texinfo-defun-type '('defmethod-type "Method"))
- (put 'defmethodx 'texinfo-defun-type '('defmethod-type "Method"))
- (put 'defmethod 'texinfo-defun-index 'texinfo-findex)
- (put 'defmethodx 'texinfo-defun-index 'texinfo-findex)
- (put 'defcv 'texinfo-format 'texinfo-format-defun)
- (put 'defcvx 'texinfo-format 'texinfo-format-defunx)
- (put 'defcv 'texinfo-end 'texinfo-end-defun)
- (put 'defcv 'texinfo-defun-type '('defop-type nil))
- (put 'defcvx 'texinfo-defun-type '('defop-type nil))
- (put 'defcv 'texinfo-defun-index 'texinfo-vindex)
- (put 'defcvx 'texinfo-defun-index 'texinfo-vindex)
- (put 'defivar 'texinfo-format 'texinfo-format-defun)
- (put 'defivarx 'texinfo-format 'texinfo-format-defunx)
- (put 'defivar 'texinfo-end 'texinfo-end-defun)
- (put 'defivar 'texinfo-defun-type '('defmethod-type "Instance variable"))
- (put 'defivarx 'texinfo-defun-type '('defmethod-type "Instance variable"))
- (put 'defivar 'texinfo-defun-index 'texinfo-vindex)
- (put 'defivarx 'texinfo-defun-index 'texinfo-vindex)
- (put 'deftypefn 'texinfo-format 'texinfo-format-defun)
- (put 'deftypefnx 'texinfo-format 'texinfo-format-defunx)
- (put 'deftypefn 'texinfo-end 'texinfo-end-defun)
- (put 'deftypefn 'texinfo-defun-type '('deftypefn-type nil))
- (put 'deftypefnx 'texinfo-defun-type '('deftypefn-type nil))
- (put 'deftypefn 'texinfo-defun-index 'texinfo-findex)
- (put 'deftypefnx 'texinfo-defun-index 'texinfo-findex)
- (put 'deftypefun 'texinfo-format 'texinfo-format-defun)
- (put 'deftypefunx 'texinfo-format 'texinfo-format-defunx)
- (put 'deftypefun 'texinfo-end 'texinfo-end-defun)
- (put 'deftypefun 'texinfo-defun-type '('deftypefun-type "Function"))
- (put 'deftypefunx 'texinfo-defun-type '('deftypefun-type "Function"))
- (put 'deftypefun 'texinfo-defun-index 'texinfo-findex)
- (put 'deftypefunx 'texinfo-defun-index 'texinfo-findex)
- (put 'deftypevr 'texinfo-format 'texinfo-format-defun)
- (put 'deftypevrx 'texinfo-format 'texinfo-format-defunx)
- (put 'deftypevr 'texinfo-end 'texinfo-end-defun)
- (put 'deftypevr 'texinfo-defun-type '('deftypefn-type nil))
- (put 'deftypevrx 'texinfo-defun-type '('deftypefn-type nil))
- (put 'deftypevr 'texinfo-defun-index 'texinfo-vindex)
- (put 'deftypevrx 'texinfo-defun-index 'texinfo-vindex)
- (put 'deftypevar 'texinfo-format 'texinfo-format-defun)
- (put 'deftypevarx 'texinfo-format 'texinfo-format-defunx)
- (put 'deftypevar 'texinfo-end 'texinfo-end-defun)
- (put 'deftypevar 'texinfo-defun-type '('deftypevar-type "Variable"))
- (put 'deftypevarx 'texinfo-defun-type '('deftypevar-type "Variable"))
- (put 'deftypevar 'texinfo-defun-index 'texinfo-vindex)
- (put 'deftypevarx 'texinfo-defun-index 'texinfo-vindex)
- (put 'clear 'texinfo-format 'texinfo-clear)
- (defun texinfo-clear ()
- "Clear the value of the flag."
- (let* ((arg (texinfo-parse-arg-discard))
- (flag (car (read-from-string arg)))
- (value (substring arg (cdr (read-from-string arg)))))
- (put flag 'texinfo-whether-setp 'flag-cleared)
- (put flag 'texinfo-set-value "")))
- (put 'set 'texinfo-format 'texinfo-set)
- (defun texinfo-set ()
- "Set the value of the flag, optionally to a string.
- The command `@set foo This is a string.'
- sets flag foo to the value: `This is a string.'
- The command `@value{foo}' expands to the value."
- (let* ((arg (texinfo-parse-arg-discard))
- (flag (car (read-from-string arg)))
- (value (substring arg (cdr (read-from-string arg)))))
- (if (string-match "^[ \t]+" value)
- (setq value (substring value (match-end 0))))
- (put flag 'texinfo-whether-setp 'flag-set)
- (put flag 'texinfo-set-value value)))
- (put 'value 'texinfo-format 'texinfo-value)
- (defun texinfo-value ()
- "Insert the string to which the flag is set.
- The command `@set foo This is a string.'
- sets flag foo to the value: `This is a string.'
- The command `@value{foo}' expands to the value."
- (let ((arg (texinfo-parse-arg-discard)))
- (cond ((and
- (eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
- 'flag-set)
- (get (car (read-from-string arg)) 'texinfo-set-value))
- (insert (get (car (read-from-string arg)) 'texinfo-set-value)))
- ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
- 'flag-cleared)
- (insert (format "{No value for \"%s\"}" arg)))
- ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp) nil)
- (insert (format "{No value for \"%s\"}" arg))))))
- (put 'ifset 'texinfo-end 'texinfo-discard-command)
- (put 'ifset 'texinfo-format 'texinfo-if-set)
- (defun texinfo-if-set ()
- "If set, continue formatting; else do not format region up to @end ifset."
- (let ((arg (texinfo-parse-arg-discard)))
- (cond
- ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
- 'flag-set)
-
- ())
- ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
- 'flag-cleared)
-
- (delete-region texinfo-command-start
- (re-search-forward "@end ifset[ \t]*\n")))
- ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
- nil)
-
-
- ()))))
- (put 'ifclear 'texinfo-end 'texinfo-discard-command)
- (put 'ifclear 'texinfo-format 'texinfo-if-clear)
- (defun texinfo-if-clear ()
- "If clear, continue formatting; if set, do not format up to @end ifset."
- (let ((arg (texinfo-parse-arg-discard)))
- (cond
- ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
- 'flag-set)
-
- (delete-region texinfo-command-start
- (re-search-forward "@end ifclear[ \t]*\n")))
- ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
- 'flag-cleared)
-
- ())
- ((eq (get (car (read-from-string arg)) 'texinfo-whether-setp)
- nil)
-
-
- ()))))
- (put 'ifeq 'texinfo-format 'texinfo-format-ifeq)
- (defun texinfo-format-ifeq ()
- "If ARG1 and ARG2 caselessly string compare to same string, perform COMMAND.
- Otherwise produces no output.
- Thus:
- @ifeq{ arg1 , arg1 , @code{foo}} bar
- ==> `foo' bar.
- but
- @ifeq{ arg1 , arg2 , @code{foo}} bar
- ==> bar
- Note that the Texinfo command and its arguments must be arguments to
- the @ifeq command."
-
- (goto-char texinfo-command-end)
- (let* ((case-fold-search t)
- (stop (save-excursion (forward-sexp 1) (point)))
- start end
-
- (arg1
- (progn
- (forward-char 1)
- (skip-chars-forward " ")
- (setq start (point))
- (search-forward "," stop t)
- (skip-chars-backward ", ")
- (buffer-substring-no-properties start (point))))
- (arg2
- (progn
- (search-forward "," stop t)
- (skip-chars-forward " ")
- (setq start (point))
- (search-forward "," stop t)
- (skip-chars-backward ", ")
- (buffer-substring-no-properties start (point))))
- (texinfo-command
- (progn
- (search-forward "," stop t)
- (skip-chars-forward " ")
- (setq start (point))
- (goto-char (1- stop))
- (skip-chars-backward " ")
- (buffer-substring-no-properties start (point)))))
- (delete-region texinfo-command-start stop)
- (if (equal arg1 arg2)
- (insert texinfo-command))
- (goto-char texinfo-command-start)))
- (put 'include 'texinfo-format 'texinfo-format-noop)
- (put 'b 'texinfo-format 'texinfo-format-noop)
- (put 'i 'texinfo-format 'texinfo-format-noop)
- (put 'r 'texinfo-format 'texinfo-format-noop)
- (put 't 'texinfo-format 'texinfo-format-noop)
- (put 'w 'texinfo-format 'texinfo-format-noop)
- (put 'asis 'texinfo-format 'texinfo-format-noop)
- (put 'dmn 'texinfo-format 'texinfo-format-noop)
- (put 'math 'texinfo-format 'texinfo-format-noop)
- (put 'titlefont 'texinfo-format 'texinfo-format-noop)
- (defun texinfo-format-noop ()
- (insert (texinfo-parse-arg-discard))
- (goto-char texinfo-command-start))
- (put 'hyphenation 'texinfo-format 'texinfo-discard-command-and-arg)
- (defun texinfo-discard-command-and-arg ()
- "Discard both @-command and its argument in braces."
- (goto-char texinfo-command-end)
- (forward-list 1)
- (setq texinfo-command-end (point))
- (delete-region texinfo-command-start texinfo-command-end))
- (put 'bye 'texinfo-format 'texinfo-discard-line)
- (put 'smallbook 'texinfo-format 'texinfo-discard-line)
- (put 'finalout 'texinfo-format 'texinfo-discard-line)
- (put 'overfullrule 'texinfo-format 'texinfo-discard-line)
- (put 'smallbreak 'texinfo-format 'texinfo-discard-line)
- (put 'medbreak 'texinfo-format 'texinfo-discard-line)
- (put 'bigbreak 'texinfo-format 'texinfo-discard-line)
- (put 'afourpaper 'texinfo-format 'texinfo-discard-line)
- (put 'afivepaper 'texinfo-format 'texinfo-discard-line)
- (put 'afourlatex 'texinfo-format 'texinfo-discard-line)
- (put 'afourwide 'texinfo-format 'texinfo-discard-line)
- (put 'c 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'comment 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'contents 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'group 'texinfo-end 'texinfo-discard-line-with-args)
- (put 'group 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'headings 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'setchapterstyle 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'hsize 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'itemindent 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'lispnarrowing 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'need 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'nopara 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'novalidate 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'page 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'pagesizes 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'parindent 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'setchapternewpage 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'setq 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'setcontentsaftertitlepage
- 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'setshortcontentsaftertitlepage
- 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'settitle 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'setx 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'shortcontents 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'shorttitlepage 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'summarycontents 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'input 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'documentlanguage 'texinfo-format 'texinfo-discard-line-with-args)
- (put 'documentencoding 'texinfo-format 'texinfo-discard-line-with-args)
- (defun texinfo-unsupported ()
- (error "%s is not handled by texinfo"
- (buffer-substring-no-properties texinfo-command-start texinfo-command-end)))
- (defun batch-texinfo-format ()
- "Run `texinfo-format-buffer' on the files remaining on the command line.
- Must be used only with -batch, and kills Emacs on completion.
- Each file will be processed even if an error occurred previously.
- For example, invoke
- \"emacs -batch -l texinfmt -f batch-texinfo-format $docs/ ~/*.texinfo\"."
- (if (not noninteractive)
- (error "batch-texinfo-format may only be used -batch"))
- (let ((version-control t)
- (auto-save-default nil)
- (find-file-run-dired nil)
- (kept-old-versions 259259)
- (kept-new-versions 259259))
- (let ((error 0)
- file
- (files ()))
- (while command-line-args-left
- (setq file (expand-file-name (car command-line-args-left)))
- (cond ((not (file-exists-p file))
- (message ">> %s does not exist!" file)
- (setq error 1
- command-line-args-left (cdr command-line-args-left)))
- ((file-directory-p file)
- (setq command-line-args-left
- (nconc (directory-files file)
- (cdr command-line-args-left))))
- (t
- (push file files)
- (setq command-line-args-left (cdr command-line-args-left)))))
- (while files
- (setq file (car files)
- files (cdr files))
- (condition-case err
- (progn
- (if buffer-file-name (kill-buffer (current-buffer)))
- (find-file file)
- (buffer-disable-undo (current-buffer))
- (set-buffer-modified-p nil)
- (texinfo-mode)
- (message "texinfo formatting %s..." file)
- (texinfo-format-buffer nil)
- (if (buffer-modified-p)
- (progn (message "Saving modified %s" (buffer-file-name))
- (save-buffer))))
- (error
- (message ">> Error: %s" (prin1-to-string err))
- (message ">> point at")
- (let ((s (buffer-substring-no-properties (point)
- (min (+ (point) 100)
- (point-max))))
- (tem 0))
- (while (setq tem (string-match "\n+" s tem))
- (setq s (concat (substring s 0 (match-beginning 0))
- "\n>> "
- (substring s (match-end 0)))
- tem (1+ tem)))
- (message ">> %s" s))
- (setq error 1))))
- (kill-emacs error))))
- (provide 'texinfmt)
|