gnus-start.el 115 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207
  1. ;;; gnus-start.el --- startup functions for Gnus
  2. ;; Copyright (C) 1996-2012 Free Software Foundation, Inc.
  3. ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
  4. ;; Keywords: news
  5. ;; This file is part of GNU Emacs.
  6. ;; GNU Emacs is free software: you can redistribute it and/or modify
  7. ;; it under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation, either version 3 of the License, or
  9. ;; (at your option) any later version.
  10. ;; GNU Emacs is distributed in the hope that it will be useful,
  11. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ;; GNU General Public License for more details.
  14. ;; You should have received a copy of the GNU General Public License
  15. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  16. ;;; Commentary:
  17. ;;; Code:
  18. (require 'gnus)
  19. (require 'gnus-win)
  20. (require 'gnus-int)
  21. (require 'gnus-spec)
  22. (require 'gnus-range)
  23. (require 'gnus-util)
  24. (autoload 'message-make-date "message")
  25. (autoload 'gnus-agent-read-servers-validate "gnus-agent")
  26. (autoload 'gnus-agent-save-local "gnus-agent")
  27. (autoload 'gnus-agent-possibly-alter-active "gnus-agent")
  28. (eval-when-compile
  29. (require 'cl))
  30. (defvar gnus-agent-covered-methods)
  31. (defvar gnus-agent-file-loading-local)
  32. (defvar gnus-agent-file-loading-cache)
  33. (defcustom gnus-startup-file (nnheader-concat gnus-home-directory ".newsrc")
  34. "Your `.newsrc' file.
  35. `.newsrc-SERVER' will be used instead if that exists."
  36. :group 'gnus-start
  37. :type 'file)
  38. (defcustom gnus-backup-startup-file 'never
  39. "Control use of version numbers for backups of `gnus-startup-file'.
  40. This variable takes the same values as the `version-control'
  41. variable."
  42. :version "22.1"
  43. :group 'gnus-start
  44. :type '(choice (const :tag "Never" never)
  45. (const :tag "If existing" nil)
  46. (other :tag "Always" t)))
  47. (defcustom gnus-save-startup-file-via-temp-buffer t
  48. "Whether to write the startup file contents to a buffer then save
  49. the buffer or write directly to the file. The buffer is faster
  50. because all of the contents are written at once. The direct write
  51. uses considerably less memory."
  52. :version "22.1"
  53. :group 'gnus-start
  54. :type '(choice (const :tag "Write via buffer" t)
  55. (const :tag "Write directly to file" nil)))
  56. (defcustom gnus-init-file (nnheader-concat gnus-home-directory ".gnus")
  57. "Your Gnus Emacs-Lisp startup file name.
  58. If a file with the `.el' or `.elc' suffixes exists, it will be read instead."
  59. :group 'gnus-start
  60. :type 'file)
  61. (defcustom gnus-site-init-file
  62. (condition-case nil
  63. (concat (file-name-directory
  64. (directory-file-name installation-directory))
  65. "site-lisp/gnus-init")
  66. (error nil))
  67. "The site-wide Gnus Emacs-Lisp startup file name, or nil if none.
  68. If a file with the `.el' or `.elc' suffixes exists, it will be read instead."
  69. :group 'gnus-start
  70. :type '(choice file (const nil)))
  71. (defcustom gnus-use-dribble-file t
  72. "*Non-nil means that Gnus will use a dribble file to store user updates.
  73. If Emacs should crash without saving the .newsrc files, complete
  74. information can be restored from the dribble file."
  75. :group 'gnus-dribble-file
  76. :type 'boolean)
  77. (defcustom gnus-dribble-directory nil
  78. "*The directory where dribble files will be saved.
  79. If this variable is nil, the directory where the .newsrc files are
  80. saved will be used."
  81. :group 'gnus-dribble-file
  82. :type '(choice directory (const nil)))
  83. (defcustom gnus-check-new-newsgroups 'ask-server
  84. "*Non-nil means that Gnus will run `gnus-find-new-newsgroups' at startup.
  85. This normally finds new newsgroups by comparing the active groups the
  86. servers have already reported with those Gnus already knows, either alive
  87. or killed.
  88. When any of the following are true, `gnus-find-new-newsgroups' will instead
  89. ask the servers (primary, secondary, and archive servers) to list new
  90. groups since the last time it checked:
  91. 1. This variable is `ask-server'.
  92. 2. This variable is a list of select methods (see below).
  93. 3. `gnus-read-active-file' is nil or `some'.
  94. 4. A prefix argument is given to `gnus-find-new-newsgroups' interactively.
  95. Thus, if this variable is `ask-server' or a list of select methods or
  96. `gnus-read-active-file' is nil or `some', then the killed list is no
  97. longer necessary, so you could safely set `gnus-save-killed-list' to nil.
  98. This variable can be a list of select methods which Gnus will query with
  99. the `ask-server' method in addition to the primary, secondary, and archive
  100. servers.
  101. Eg.
  102. (setq gnus-check-new-newsgroups
  103. '((nntp \"some.server\") (nntp \"other.server\")))
  104. If this variable is nil, then you have to tell Gnus explicitly to
  105. check for new newsgroups with \\<gnus-group-mode-map>\\[gnus-find-new-newsgroups]."
  106. :group 'gnus-start
  107. :type '(choice (const :tag "no" nil)
  108. (const :tag "by brute force" t)
  109. (const :tag "ask servers" ask-server)
  110. (repeat :menu-tag "ask additional servers"
  111. :tag "ask additional servers"
  112. :value ((nntp ""))
  113. (sexp :format "%v"))))
  114. (defcustom gnus-check-bogus-newsgroups nil
  115. "*Non-nil means that Gnus will check and remove bogus newsgroup at startup.
  116. If this variable is nil, then you have to tell Gnus explicitly to
  117. check for bogus newsgroups with \\<gnus-group-mode-map>\\[gnus-group-check-bogus-groups]."
  118. :group 'gnus-start-server
  119. :type 'boolean)
  120. (defcustom gnus-read-active-file 'some
  121. "*Non-nil means that Gnus will read the entire active file at startup.
  122. If this variable is nil, Gnus will only know about the groups in your
  123. `.newsrc' file.
  124. If this variable is `some', Gnus will try to only read the relevant
  125. parts of the active file from the server. Not all servers support
  126. this, and it might be quite slow with other servers, but this should
  127. generally be faster than both the t and nil value.
  128. If you set this variable to nil or `some', you probably still want to
  129. be told about new newsgroups that arrive. To do that, set
  130. `gnus-check-new-newsgroups' to `ask-server'. This may not work
  131. properly with all servers."
  132. :group 'gnus-start-server
  133. :type '(choice (const nil)
  134. (const some)
  135. (const t)))
  136. (defconst gnus-level-subscribed 5
  137. "Groups with levels less than or equal to this variable are subscribed.")
  138. (defconst gnus-level-unsubscribed 7
  139. "Groups with levels less than or equal to this variable are unsubscribed.
  140. Groups with levels less than `gnus-level-subscribed', which
  141. should be less than this variable, are subscribed. Groups with
  142. levels from `gnus-level-subscribed' (exclusive) upto this
  143. variable (inclusive) are unsubscribed. See also
  144. `gnus-level-zombie', `gnus-level-killed' and the Info node `(gnus)Group
  145. Levels' for details.")
  146. (defconst gnus-level-zombie 8
  147. "Groups with this level are zombie groups.")
  148. (defconst gnus-level-killed 9
  149. "Groups with this level are killed.")
  150. (defcustom gnus-level-default-subscribed 3
  151. "*New subscribed groups will be subscribed at this level."
  152. :group 'gnus-group-levels
  153. :type 'integer)
  154. (defcustom gnus-level-default-unsubscribed 6
  155. "*New unsubscribed groups will be unsubscribed at this level."
  156. :group 'gnus-group-levels
  157. :type 'integer)
  158. (defcustom gnus-activate-level (1+ gnus-level-subscribed)
  159. "*Groups higher than this level won't be activated on startup.
  160. Setting this variable to something low might save lots of time when
  161. you have many groups that you aren't interested in."
  162. :group 'gnus-group-levels
  163. :type 'integer)
  164. (defcustom gnus-activate-foreign-newsgroups 4
  165. "*If nil, Gnus will not check foreign newsgroups at startup.
  166. If it is non-nil, it should be a number between one and nine. Foreign
  167. newsgroups that have a level lower or equal to this number will be
  168. activated on startup. For instance, if you want to active all
  169. subscribed newsgroups, but not the rest, you'd set this variable to
  170. `gnus-level-subscribed'.
  171. If you subscribe to lots of newsgroups from different servers, startup
  172. might take a while. By setting this variable to nil, you'll save time,
  173. but you won't be told how many unread articles there are in the
  174. groups."
  175. :group 'gnus-group-levels
  176. :type '(choice integer
  177. (const :tag "none" nil)))
  178. (defcustom gnus-read-newsrc-file t
  179. "*Non-nil means that Gnus will read the `.newsrc' file.
  180. Gnus always reads its own startup file, which is called
  181. \".newsrc.eld\". The file called \".newsrc\" is in a format that can
  182. be readily understood by other newsreaders. If you don't plan on
  183. using other newsreaders, set this variable to nil to save some time on
  184. entry."
  185. :version "21.1"
  186. :group 'gnus-newsrc
  187. :type 'boolean)
  188. (defcustom gnus-save-newsrc-file t
  189. "*Non-nil means that Gnus will save the `.newsrc' file.
  190. Gnus always saves its own startup file, which is called
  191. \".newsrc.eld\". The file called \".newsrc\" is in a format that can
  192. be readily understood by other newsreaders. If you don't plan on
  193. using other newsreaders, set this variable to nil to save some time on
  194. exit."
  195. :group 'gnus-newsrc
  196. :type 'boolean)
  197. (defcustom gnus-save-killed-list t
  198. "*If non-nil, save the list of killed groups to the startup file.
  199. If you set this variable to nil, you'll save both time (when starting
  200. and quitting) and space (both memory and disk), but it will also mean
  201. that Gnus has no record of which groups are new and which are old, so
  202. the automatic new newsgroups subscription methods become meaningless.
  203. You should always set `gnus-check-new-newsgroups' to `ask-server' or
  204. nil if you set this variable to nil.
  205. This variable can also be a regexp. In that case, all groups that do
  206. not match this regexp will be removed before saving the list."
  207. :group 'gnus-newsrc
  208. :type '(radio (sexp :format "Non-nil\n"
  209. :match (lambda (widget value)
  210. (and value (not (stringp value))))
  211. :value t)
  212. (const nil)
  213. regexp))
  214. (defcustom gnus-ignored-newsgroups
  215. (mapconcat 'identity
  216. '("^to\\." ; not "real" groups
  217. "^[0-9. \t]+\\( \\|$\\)" ; all digits in name
  218. "^[\"][\"#'()]" ; bogus characters
  219. )
  220. "\\|")
  221. "*A regexp to match uninteresting newsgroups in the active file.
  222. Any lines in the active file matching this regular expression are
  223. removed from the newsgroup list before anything else is done to it,
  224. thus making them effectively non-existent."
  225. :group 'gnus-group-new
  226. :type 'regexp)
  227. (defcustom gnus-subscribe-newsgroup-method 'gnus-subscribe-zombies
  228. "*Function(s) called with a group name when new group is detected.
  229. A few pre-made functions are supplied: `gnus-subscribe-randomly'
  230. inserts new groups at the beginning of the list of groups;
  231. `gnus-subscribe-alphabetically' inserts new groups in strict
  232. alphabetic order; `gnus-subscribe-hierarchically' inserts new groups
  233. in hierarchical newsgroup order; `gnus-subscribe-interactively' asks
  234. for your decision; `gnus-subscribe-killed' kills all new groups;
  235. `gnus-subscribe-zombies' will make all new groups into zombies;
  236. `gnus-subscribe-topics' will enter groups into the topics that
  237. claim them."
  238. :group 'gnus-group-new
  239. :type '(radio (function-item gnus-subscribe-randomly)
  240. (function-item gnus-subscribe-alphabetically)
  241. (function-item gnus-subscribe-hierarchically)
  242. (function-item gnus-subscribe-interactively)
  243. (function-item gnus-subscribe-killed)
  244. (function-item gnus-subscribe-zombies)
  245. (function-item gnus-subscribe-topics)
  246. function
  247. (repeat function)))
  248. (defcustom gnus-subscribe-newsgroup-hooks nil
  249. "*Hooks run after you subscribe to a new group.
  250. The hooks will be called with new group's name as argument."
  251. :version "22.1"
  252. :group 'gnus-group-new
  253. :type 'hook)
  254. (defcustom gnus-subscribe-options-newsgroup-method
  255. 'gnus-subscribe-alphabetically
  256. "*Function(s) called to subscribe newsgroups mentioned on \"options -n\" lines.
  257. If, for instance, you want to subscribe to all newsgroups in the
  258. \"no\" and \"alt\" hierarchies, you'd put the following in your
  259. .newsrc file:
  260. options -n no.all alt.all
  261. Gnus will then subscribe all new newsgroups in these hierarchies
  262. with the subscription method in this variable."
  263. :group 'gnus-group-new
  264. :type '(radio (function-item gnus-subscribe-randomly)
  265. (function-item gnus-subscribe-alphabetically)
  266. (function-item gnus-subscribe-hierarchically)
  267. (function-item gnus-subscribe-interactively)
  268. (function-item gnus-subscribe-killed)
  269. (function-item gnus-subscribe-zombies)
  270. (function-item gnus-subscribe-topics)
  271. function
  272. (repeat function)))
  273. (defcustom gnus-subscribe-hierarchical-interactive nil
  274. "*If non-nil, Gnus will offer to subscribe hierarchically.
  275. When a new hierarchy appears, Gnus will ask the user:
  276. 'alt.binaries': Do you want to subscribe to this hierarchy? ([d]ys):
  277. If the user pressed `d', Gnus will descend the hierarchy, `y' will
  278. subscribe to all newsgroups in the hierarchy and `s' will skip this
  279. hierarchy in its entirety."
  280. :group 'gnus-group-new
  281. :type 'boolean)
  282. (defcustom gnus-auto-subscribed-categories '(mail post-mail)
  283. "*New groups from methods of these categories will be subscribed automatically.
  284. Note that this variable only deals with new groups. It has no
  285. effect whatsoever on old groups. The default is to automatically
  286. subscribe all groups from mail-like backends."
  287. :version "24.1"
  288. :group 'gnus-group-new
  289. :type '(repeat symbol))
  290. (defcustom gnus-auto-subscribed-groups
  291. "^nnml\\|^nnfolder\\|^nnmbox\\|^nnmh\\|^nnbabyl\\|^nnmaildir\\|^nnimap"
  292. "*All new groups that match this regexp will be subscribed automatically.
  293. Note that this variable only deals with new groups. It has no effect
  294. whatsoever on old groups.
  295. New groups that match this regexp will not be handled by
  296. `gnus-subscribe-newsgroup-method'. Instead, they will
  297. be subscribed using `gnus-subscribe-options-newsgroup-method'."
  298. :group 'gnus-group-new
  299. :type 'regexp)
  300. (defcustom gnus-options-subscribe nil
  301. "*All new groups matching this regexp will be subscribed unconditionally.
  302. Note that this variable deals only with new newsgroups. This variable
  303. does not affect old newsgroups.
  304. New groups that match this regexp will not be handled by
  305. `gnus-subscribe-newsgroup-method'. Instead, they will
  306. be subscribed using `gnus-subscribe-options-newsgroup-method'."
  307. :group 'gnus-group-new
  308. :type '(choice regexp
  309. (const :tag "none" nil)))
  310. (defcustom gnus-options-not-subscribe nil
  311. "*All new groups matching this regexp will be ignored.
  312. Note that this variable deals only with new newsgroups. This variable
  313. does not affect old (already subscribed) newsgroups."
  314. :group 'gnus-group-new
  315. :type '(choice regexp
  316. (const :tag "none" nil)))
  317. (defcustom gnus-modtime-botch nil
  318. "*Non-nil means .newsrc should be deleted prior to save.
  319. Its use is due to the bogus appearance that .newsrc was modified on
  320. disc."
  321. :group 'gnus-newsrc
  322. :type 'boolean)
  323. (defcustom gnus-check-bogus-groups-hook nil
  324. "A hook run after removing bogus groups."
  325. :group 'gnus-start-server
  326. :type 'hook)
  327. (defcustom gnus-startup-hook nil
  328. "A hook called at startup.
  329. This hook is called after Gnus is connected to the NNTP server."
  330. :group 'gnus-start
  331. :type 'hook)
  332. (defcustom gnus-before-startup-hook nil
  333. "A hook called before startup.
  334. This hook is called as the first thing when Gnus is started."
  335. :group 'gnus-start
  336. :type 'hook)
  337. (defcustom gnus-started-hook nil
  338. "A hook called as the last thing after startup."
  339. :group 'gnus-start
  340. :type 'hook)
  341. (defcustom gnus-setup-news-hook nil
  342. "A hook after reading the .newsrc file, but before generating the buffer."
  343. :group 'gnus-start
  344. :type 'hook)
  345. (defcustom gnus-get-top-new-news-hook nil
  346. "A hook run just before Gnus checks for new news globally."
  347. :version "22.1"
  348. :group 'gnus-group-new
  349. :type 'hook)
  350. (defcustom gnus-get-new-news-hook nil
  351. "A hook run just before Gnus checks for new news."
  352. :group 'gnus-group-new
  353. :type 'hook)
  354. (defcustom gnus-after-getting-new-news-hook
  355. '(gnus-display-time-event-handler)
  356. "*A hook run after Gnus checks for new news when Gnus is already running."
  357. :version "24.1"
  358. :group 'gnus-group-new
  359. :type 'hook)
  360. (defcustom gnus-read-newsrc-el-hook nil
  361. "A hook called after reading the newsrc.eld? file."
  362. :group 'gnus-newsrc
  363. :type 'hook)
  364. (defcustom gnus-save-newsrc-hook nil
  365. "A hook called before saving any of the newsrc files."
  366. :group 'gnus-newsrc
  367. :type 'hook)
  368. (defcustom gnus-save-quick-newsrc-hook nil
  369. "A hook called just before saving the quick newsrc file.
  370. Can be used to turn version control on or off."
  371. :group 'gnus-newsrc
  372. :type 'hook)
  373. (defcustom gnus-save-standard-newsrc-hook nil
  374. "A hook called just before saving the standard newsrc file.
  375. Can be used to turn version control on or off."
  376. :group 'gnus-newsrc
  377. :type 'hook)
  378. (defcustom gnus-group-mode-hook nil
  379. "Hook for Gnus group mode."
  380. :group 'gnus-group-various
  381. :options '(gnus-topic-mode)
  382. :type 'hook)
  383. (defcustom gnus-always-read-dribble-file nil
  384. "Unconditionally read the dribble file."
  385. :group 'gnus-newsrc
  386. :type 'boolean)
  387. ;;; Internal variables
  388. ;; Fixme: deal with old emacs-mule when mm-universal-coding-system is
  389. ;; utf-8-emacs.
  390. (defvar gnus-ding-file-coding-system mm-universal-coding-system
  391. "Coding system for ding file.")
  392. (defvar gnus-newsrc-file-version nil)
  393. (defvar gnus-override-subscribe-method nil)
  394. (defvar gnus-dribble-buffer nil)
  395. (defvar gnus-newsrc-options nil
  396. "Options line in the .newsrc file.")
  397. (defvar gnus-newsrc-options-n nil
  398. "List of regexps representing groups to be subscribed/ignored unconditionally.")
  399. (defvar gnus-newsrc-last-checked-date nil
  400. "Date Gnus last asked server for new newsgroups.")
  401. (defvar gnus-current-startup-file nil
  402. "Startup file for the current host.")
  403. ;; Byte-compiler warning.
  404. (defvar gnus-group-line-format)
  405. ;; Suggested by Brian Edmonds <edmonds@cs.ubc.ca>.
  406. (defvar gnus-init-inhibit nil)
  407. (defun gnus-read-init-file (&optional inhibit-next)
  408. ;; Don't load .gnus if the -q option was used.
  409. (when init-file-user
  410. (if gnus-init-inhibit
  411. (setq gnus-init-inhibit nil)
  412. (setq gnus-init-inhibit inhibit-next)
  413. (dolist (file (list gnus-site-init-file gnus-init-file))
  414. (when (and file
  415. (locate-library file))
  416. (if (or debug-on-error debug-on-quit)
  417. (load file nil t)
  418. (condition-case var
  419. (load file nil t)
  420. (error
  421. (error "Error in %s: %s" file (cadr var))))))))))
  422. ;; For subscribing new newsgroup
  423. (defun gnus-subscribe-hierarchical-interactive (groups)
  424. (let ((groups (sort groups 'string<))
  425. prefixes prefix start ans group starts real-group)
  426. (while groups
  427. (setq prefixes (list "^"))
  428. (while (and groups prefixes)
  429. (while (not (string-match (car prefixes)
  430. (gnus-group-real-name (car groups))))
  431. (setq prefixes (cdr prefixes)))
  432. (setq prefix (car prefixes))
  433. (setq start (1- (length prefix)))
  434. (if (and (string-match "[^\\.]\\." (gnus-group-real-name (car groups))
  435. start)
  436. (cdr groups)
  437. (setq prefix
  438. (concat "^" (substring
  439. (gnus-group-real-name (car groups))
  440. 0 (match-end 0))))
  441. (string-match prefix (gnus-group-real-name (cadr groups))))
  442. (progn
  443. (push prefix prefixes)
  444. (message "Descend hierarchy %s? ([y]nsq): "
  445. (substring prefix 1 (1- (length prefix))))
  446. (while (not (memq (setq ans (read-char-exclusive))
  447. '(?y ?\n ?\r ?n ?s ?q)))
  448. (ding)
  449. (message "Descend hierarchy %s? ([y]nsq): "
  450. (substring prefix 1 (1- (length prefix)))))
  451. (cond ((= ans ?n)
  452. (while (and groups
  453. (setq group (car groups)
  454. real-group (gnus-group-real-name group))
  455. (string-match prefix real-group))
  456. (push group gnus-killed-list)
  457. (gnus-sethash group group gnus-killed-hashtb)
  458. (setq groups (cdr groups)))
  459. (setq starts (cdr starts)))
  460. ((= ans ?s)
  461. (while (and groups
  462. (setq group (car groups)
  463. real-group (gnus-group-real-name group))
  464. (string-match prefix real-group))
  465. (gnus-sethash group group gnus-killed-hashtb)
  466. (gnus-subscribe-alphabetically (car groups))
  467. (setq groups (cdr groups)))
  468. (setq starts (cdr starts)))
  469. ((= ans ?q)
  470. (while groups
  471. (setq group (car groups))
  472. (push group gnus-killed-list)
  473. (gnus-sethash group group gnus-killed-hashtb)
  474. (setq groups (cdr groups))))
  475. (t nil)))
  476. (message "Subscribe %s? ([n]yq)" (car groups))
  477. (while (not (memq (setq ans (read-char-exclusive))
  478. '(?y ?\n ?\r ?q ?n)))
  479. (ding)
  480. (message "Subscribe %s? ([n]yq)" (car groups)))
  481. (setq group (car groups))
  482. (cond ((= ans ?y)
  483. (gnus-subscribe-alphabetically (car groups))
  484. (gnus-sethash group group gnus-killed-hashtb))
  485. ((= ans ?q)
  486. (while groups
  487. (setq group (car groups))
  488. (push group gnus-killed-list)
  489. (gnus-sethash group group gnus-killed-hashtb)
  490. (setq groups (cdr groups))))
  491. (t
  492. (push group gnus-killed-list)
  493. (gnus-sethash group group gnus-killed-hashtb)))
  494. (setq groups (cdr groups)))))))
  495. (defun gnus-subscribe-randomly (newsgroup)
  496. "Subscribe new NEWSGROUP by making it the first newsgroup."
  497. (gnus-subscribe-newsgroup newsgroup))
  498. (defun gnus-subscribe-alphabetically (newgroup)
  499. "Subscribe new NEWGROUP and insert it in alphabetical order."
  500. (let ((groups (cdr gnus-newsrc-alist))
  501. before)
  502. (while (and (not before) groups)
  503. (if (string< newgroup (caar groups))
  504. (setq before (caar groups))
  505. (setq groups (cdr groups))))
  506. (gnus-subscribe-newsgroup newgroup before)))
  507. (defun gnus-subscribe-hierarchically (newgroup)
  508. "Subscribe new NEWGROUP and insert it in hierarchical newsgroup order."
  509. ;; Basic ideas by mike-w@cs.aukuni.ac.nz (Mike Williams)
  510. (with-current-buffer (nnheader-find-file-noselect gnus-current-startup-file)
  511. (prog1
  512. (let ((groupkey newgroup) before)
  513. (while (and (not before) groupkey)
  514. (goto-char (point-min))
  515. (let ((groupkey-re
  516. (concat "^\\(" (regexp-quote groupkey) ".*\\)[!:]")))
  517. (while (and (re-search-forward groupkey-re nil t)
  518. (progn
  519. (setq before (match-string 1))
  520. (string< before newgroup)))))
  521. ;; Remove tail of newsgroup name (eg. a.b.c -> a.b)
  522. (setq groupkey
  523. (when (string-match "^\\(.*\\)\\.[^.]+$" groupkey)
  524. (substring groupkey (match-beginning 1) (match-end 1)))))
  525. (gnus-subscribe-newsgroup newgroup before))
  526. (kill-buffer (current-buffer)))))
  527. (defun gnus-subscribe-interactively (group)
  528. "Subscribe the new GROUP interactively.
  529. It is inserted in hierarchical newsgroup order if subscribed. If not,
  530. it is killed."
  531. (if (gnus-y-or-n-p (format "Subscribe new newsgroup %s? " group))
  532. (gnus-subscribe-hierarchically group)
  533. (push group gnus-killed-list)))
  534. (defun gnus-subscribe-zombies (group)
  535. "Make the new GROUP into a zombie group."
  536. (push group gnus-zombie-list))
  537. (defun gnus-subscribe-killed (group)
  538. "Make the new GROUP a killed group."
  539. (push group gnus-killed-list))
  540. (defun gnus-subscribe-newsgroup (newsgroup &optional next)
  541. "Subscribe new NEWSGROUP.
  542. If NEXT is non-nil, it is inserted before NEXT. Otherwise it is made
  543. the first newsgroup."
  544. (save-excursion
  545. (goto-char (point-min))
  546. ;; We subscribe the group by changing its level to `subscribed'.
  547. (gnus-group-change-level
  548. newsgroup gnus-level-default-subscribed
  549. gnus-level-killed (gnus-group-entry (or next "dummy.group")))
  550. (gnus-request-update-group-status newsgroup 'subscribe)
  551. (gnus-message 5 "Subscribe newsgroup: %s" newsgroup)
  552. (run-hook-with-args 'gnus-subscribe-newsgroup-hooks newsgroup)
  553. t))
  554. (defun gnus-read-active-file-p ()
  555. "Say whether the active file has been read from `gnus-select-method'."
  556. (memq gnus-select-method gnus-have-read-active-file))
  557. ;;; General various misc type functions.
  558. ;; Silence byte-compiler.
  559. (defvar gnus-current-headers)
  560. (defvar gnus-thread-indent-array)
  561. (defvar gnus-newsgroup-name)
  562. (defvar gnus-newsgroup-headers)
  563. (defvar gnus-group-list-mode)
  564. (defvar gnus-group-mark-positions)
  565. (defvar gnus-newsgroup-data)
  566. (defvar gnus-newsgroup-unreads)
  567. (defvar nnoo-state-alist)
  568. (defvar gnus-current-select-method)
  569. (defvar mail-sources)
  570. (defvar nnmail-scan-directory-mail-source-once)
  571. (defvar nnmail-split-history)
  572. (defvar nnmail-spool-file)
  573. (defun gnus-close-all-servers ()
  574. "Close all servers."
  575. (interactive)
  576. (dolist (server gnus-opened-servers)
  577. (gnus-close-server (car server))))
  578. (defun gnus-clear-system ()
  579. "Clear all variables and buffers."
  580. ;; Clear Gnus variables.
  581. (let ((variables (remove 'gnus-format-specs gnus-variable-list)))
  582. (while variables
  583. (set (car variables) nil)
  584. (setq variables (cdr variables))))
  585. ;; Clear other internal variables.
  586. (setq gnus-list-of-killed-groups nil
  587. gnus-have-read-active-file nil
  588. gnus-agent-covered-methods nil
  589. gnus-agent-file-loading-local nil
  590. gnus-agent-file-loading-cache nil
  591. gnus-server-method-cache nil
  592. gnus-newsrc-alist nil
  593. gnus-newsrc-hashtb nil
  594. gnus-killed-list nil
  595. gnus-zombie-list nil
  596. gnus-killed-hashtb nil
  597. gnus-active-hashtb nil
  598. gnus-moderated-hashtb nil
  599. gnus-description-hashtb nil
  600. gnus-current-headers nil
  601. gnus-thread-indent-array nil
  602. gnus-newsgroup-headers nil
  603. gnus-newsgroup-name nil
  604. gnus-server-alist nil
  605. gnus-group-list-mode nil
  606. gnus-opened-servers nil
  607. gnus-group-mark-positions nil
  608. gnus-newsgroup-data nil
  609. gnus-newsgroup-unreads nil
  610. nnoo-state-alist nil
  611. gnus-current-select-method nil
  612. nnmail-split-history nil
  613. gnus-extended-servers nil
  614. gnus-ephemeral-servers nil)
  615. (gnus-shutdown 'gnus)
  616. ;; Kill the startup file.
  617. (and gnus-current-startup-file
  618. (get-file-buffer gnus-current-startup-file)
  619. (kill-buffer (get-file-buffer gnus-current-startup-file)))
  620. ;; Clear the dribble buffer.
  621. (gnus-dribble-clear)
  622. ;; Kill global KILL file buffer.
  623. (when (get-file-buffer (gnus-newsgroup-kill-file nil))
  624. (kill-buffer (get-file-buffer (gnus-newsgroup-kill-file nil))))
  625. (gnus-kill-buffer nntp-server-buffer)
  626. ;; Kill Gnus buffers.
  627. (dolist (buffer (gnus-buffers))
  628. (gnus-kill-buffer buffer))
  629. ;; Remove Gnus frames.
  630. (gnus-kill-gnus-frames))
  631. (defun gnus-no-server-1 (&optional arg slave)
  632. "Read network news.
  633. If ARG is a positive number, Gnus will use that as the startup
  634. level. If ARG is nil, Gnus will be started at level 2
  635. \(`gnus-level-default-subscribed' minus one). If ARG is non-nil
  636. and not a positive number, Gnus will prompt the user for the name
  637. of an NNTP server to use. As opposed to \\[gnus], this command
  638. will not connect to the local server."
  639. (interactive "P")
  640. (let ((val (or arg (1- gnus-level-default-subscribed))))
  641. (gnus val t slave)
  642. (make-local-variable 'gnus-group-use-permanent-levels)
  643. (setq gnus-group-use-permanent-levels val)))
  644. (defun gnus-1 (&optional arg dont-connect slave)
  645. "Read network news.
  646. If ARG is non-nil and a positive number, Gnus will use that as the
  647. startup level. If ARG is non-nil and not a positive number, Gnus will
  648. prompt the user for the name of an NNTP server to use."
  649. (interactive "P")
  650. (if (gnus-alive-p)
  651. (progn
  652. (switch-to-buffer gnus-group-buffer)
  653. (gnus-group-get-new-news
  654. (and (numberp arg)
  655. (> arg 0)
  656. (max (car gnus-group-list-mode) arg))))
  657. (gnus-clear-system)
  658. (gnus-splash)
  659. (gnus-run-hooks 'gnus-before-startup-hook)
  660. (nnheader-init-server-buffer)
  661. (setq gnus-slave slave)
  662. (gnus-read-init-file)
  663. ;; Add "native" to gnus-predefined-server-alist just to have a
  664. ;; name for the native select method.
  665. (when gnus-select-method
  666. (add-to-list 'gnus-predefined-server-alist
  667. (cons "native" gnus-select-method)))
  668. (if gnus-agent
  669. (gnus-agentize))
  670. (let ((level (and (numberp arg) (> arg 0) arg))
  671. did-connect)
  672. (unwind-protect
  673. (progn
  674. (unless dont-connect
  675. (setq did-connect
  676. (gnus-start-news-server (and arg (not level))))))
  677. (if (and (not dont-connect)
  678. (not did-connect))
  679. ;; Couldn't connect to the server, so bail out.
  680. (gnus-group-quit)
  681. (gnus-run-hooks 'gnus-startup-hook)
  682. ;; Find the current startup file name.
  683. (setq gnus-current-startup-file
  684. (gnus-make-newsrc-file gnus-startup-file))
  685. ;; Read the dribble file.
  686. (when (or gnus-slave gnus-use-dribble-file)
  687. (gnus-dribble-read-file))
  688. ;; Do the actual startup.
  689. (gnus-setup-news nil level dont-connect)
  690. (gnus-run-hooks 'gnus-setup-news-hook)
  691. (when gnus-agent
  692. (gnus-request-create-group "queue" '(nndraft "")))
  693. (gnus-start-draft-setup)
  694. ;; Generate the group buffer.
  695. (gnus-group-list-groups level)
  696. (gnus-group-first-unread-group)
  697. (gnus-configure-windows 'group)
  698. (gnus-group-set-mode-line)
  699. (gnus-run-hooks 'gnus-started-hook))))))
  700. (defun gnus-start-draft-setup ()
  701. "Make sure the draft group exists."
  702. (interactive)
  703. (gnus-request-create-group "drafts" '(nndraft ""))
  704. (unless (gnus-group-entry "nndraft:drafts")
  705. (let ((gnus-level-default-subscribed 1))
  706. (gnus-subscribe-group "nndraft:drafts" nil '(nndraft "")))
  707. (setcar (gnus-group-entry "nndraft:drafts") 0))
  708. (unless (equal (gnus-group-get-parameter "nndraft:drafts" 'gnus-dummy t)
  709. '((gnus-draft-mode)))
  710. (gnus-group-set-parameter
  711. "nndraft:drafts" 'gnus-dummy '((gnus-draft-mode)))))
  712. ;;;
  713. ;;; Dribble file
  714. ;;;
  715. (defvar gnus-dribble-ignore nil)
  716. (defvar gnus-dribble-eval-file nil)
  717. (defun gnus-dribble-file-name ()
  718. "Return the dribble file for the current .newsrc."
  719. (concat
  720. (if gnus-dribble-directory
  721. (concat (file-name-as-directory gnus-dribble-directory)
  722. (file-name-nondirectory gnus-current-startup-file))
  723. gnus-current-startup-file)
  724. "-dribble"))
  725. (defun gnus-dribble-enter (string &optional regexp)
  726. "Enter STRING into the dribble buffer.
  727. If REGEXP is given, lines that match it will be deleted."
  728. (when (and (not gnus-dribble-ignore)
  729. gnus-dribble-buffer
  730. (buffer-name gnus-dribble-buffer))
  731. (let ((obuf (current-buffer)))
  732. (set-buffer gnus-dribble-buffer)
  733. (when regexp
  734. (goto-char (point-min))
  735. (let (end)
  736. (while (re-search-forward regexp nil t)
  737. (unless (bolp) (forward-line 1))
  738. (setq end (point))
  739. (goto-char (match-beginning 0))
  740. (delete-region (point-at-bol) end))))
  741. (goto-char (point-max))
  742. (insert string "\n")
  743. ;; This has been commented by Josh Huber <huber@alum.wpi.edu>
  744. ;; It causes problems with both XEmacs and Emacs 21, and doesn't
  745. ;; seem to be of much value. (FIXME: remove this after we make sure
  746. ;; it's not needed).
  747. ;; (set-window-point (get-buffer-window (current-buffer)) (point-max))
  748. (bury-buffer gnus-dribble-buffer)
  749. (with-current-buffer gnus-group-buffer
  750. (gnus-group-set-mode-line))
  751. (set-buffer obuf))))
  752. (defun gnus-dribble-touch ()
  753. "Touch the dribble buffer."
  754. (gnus-dribble-enter ""))
  755. (defun gnus-dribble-read-file ()
  756. "Read the dribble file from disk."
  757. (let ((dribble-file (gnus-dribble-file-name)))
  758. (unless (file-exists-p (file-name-directory dribble-file))
  759. (make-directory (file-name-directory dribble-file) t))
  760. (with-current-buffer (setq gnus-dribble-buffer
  761. (gnus-get-buffer-create
  762. (file-name-nondirectory dribble-file)))
  763. (set (make-local-variable 'file-precious-flag) t)
  764. (setq buffer-save-without-query t)
  765. (erase-buffer)
  766. (setq buffer-file-name dribble-file)
  767. (auto-save-mode t)
  768. (buffer-disable-undo)
  769. (bury-buffer (current-buffer))
  770. (set-buffer-modified-p nil)
  771. (let ((auto (make-auto-save-file-name))
  772. (gnus-dribble-ignore t)
  773. (purpose nil)
  774. modes)
  775. (when (or (file-exists-p auto) (file-exists-p dribble-file))
  776. ;; Load whichever file is newest -- the auto save file
  777. ;; or the "real" file.
  778. (if (file-newer-than-file-p auto dribble-file)
  779. (nnheader-insert-file-contents auto)
  780. (nnheader-insert-file-contents dribble-file))
  781. (unless (zerop (buffer-size))
  782. (set-buffer-modified-p t))
  783. ;; Set the file modes to reflect the .newsrc file modes.
  784. (save-buffer)
  785. (when (and (file-exists-p gnus-current-startup-file)
  786. (file-exists-p dribble-file)
  787. (setq modes (file-modes gnus-current-startup-file)))
  788. (gnus-set-file-modes dribble-file modes))
  789. (goto-char (point-min))
  790. (when (search-forward "Gnus was exited on purpose" nil t)
  791. (setq purpose t))
  792. ;; Possibly eval the file later.
  793. (when (or gnus-always-read-dribble-file
  794. (gnus-y-or-n-p
  795. (if purpose
  796. "Gnus exited on purpose without saving; read auto-save file anyway? "
  797. "Gnus auto-save file exists. Do you want to read it? ")))
  798. (setq gnus-dribble-eval-file t)))))))
  799. (defun gnus-dribble-eval-file ()
  800. (when gnus-dribble-eval-file
  801. (setq gnus-dribble-eval-file nil)
  802. (save-excursion
  803. (let ((gnus-dribble-ignore t))
  804. (set-buffer gnus-dribble-buffer)
  805. (eval-buffer (current-buffer))))))
  806. (defun gnus-dribble-delete-file ()
  807. (when (file-exists-p (gnus-dribble-file-name))
  808. (delete-file (gnus-dribble-file-name)))
  809. (when gnus-dribble-buffer
  810. (with-current-buffer gnus-dribble-buffer
  811. (let ((auto (make-auto-save-file-name)))
  812. (when (file-exists-p auto)
  813. (delete-file auto))
  814. (erase-buffer)
  815. (set-buffer-modified-p nil)))))
  816. (defun gnus-dribble-save ()
  817. (when (and gnus-dribble-buffer
  818. (buffer-name gnus-dribble-buffer))
  819. (with-current-buffer gnus-dribble-buffer
  820. (save-buffer))))
  821. (defun gnus-dribble-clear ()
  822. (when (gnus-buffer-exists-p gnus-dribble-buffer)
  823. (with-current-buffer gnus-dribble-buffer
  824. (erase-buffer)
  825. (set-buffer-modified-p nil)
  826. (setq buffer-saved-size (buffer-size)))))
  827. ;;;
  828. ;;; Active & Newsrc File Handling
  829. ;;;
  830. (defun gnus-setup-news (&optional rawfile level dont-connect)
  831. "Setup news information.
  832. If RAWFILE is non-nil, the .newsrc file will also be read.
  833. If LEVEL is non-nil, the news will be set up at level LEVEL."
  834. (require 'nnmail)
  835. (let ((init (not (and gnus-newsrc-alist gnus-active-hashtb (not rawfile))))
  836. ;; Binding this variable will inhibit multiple fetchings
  837. ;; of the same mail source.
  838. (nnmail-fetched-sources (list t)))
  839. (when init
  840. ;; Clear some variables to re-initialize news information.
  841. (setq gnus-newsrc-alist nil
  842. gnus-active-hashtb nil)
  843. ;; Read the newsrc file and create `gnus-newsrc-hashtb'.
  844. (gnus-read-newsrc-file rawfile))
  845. ;; Make sure the archive server is available to all and sundry.
  846. (let ((method (or (and (stringp gnus-message-archive-method)
  847. (gnus-server-to-method
  848. gnus-message-archive-method))
  849. gnus-message-archive-method)))
  850. ;; Check whether the archive method is writable.
  851. (unless (or (not method)
  852. (stringp method)
  853. (memq 'respool (assoc (format "%s" (car method))
  854. gnus-valid-select-methods)))
  855. (setq method "archive")) ;; The default.
  856. (when (stringp method)
  857. (setq method `(nnfolder
  858. ,method
  859. (nnfolder-directory
  860. ,(nnheader-concat message-directory method))
  861. (nnfolder-active-file
  862. ,(nnheader-concat message-directory
  863. (concat method "/active")))
  864. (nnfolder-get-new-mail nil)
  865. (nnfolder-inhibit-expiry t))))
  866. (if (assoc "archive" gnus-server-alist)
  867. (when gnus-update-message-archive-method
  868. (if method
  869. (setcdr (assoc "archive" gnus-server-alist) method)
  870. (setq gnus-server-alist (delq (assoc "archive" gnus-server-alist)
  871. gnus-server-alist))))
  872. (when method
  873. (push (cons "archive" method) gnus-server-alist))))
  874. ;; If we don't read the complete active file, we fill in the
  875. ;; hashtb here.
  876. (when (or (null gnus-read-active-file)
  877. (eq gnus-read-active-file 'some))
  878. (gnus-update-active-hashtb-from-killed))
  879. (unless gnus-active-hashtb
  880. (setq gnus-active-hashtb (gnus-make-hashtable 4096)))
  881. ;; Initialize the cache.
  882. (when gnus-use-cache
  883. (gnus-cache-open))
  884. ;; Possibly eval the dribble file.
  885. (and init
  886. (or gnus-use-dribble-file gnus-slave)
  887. (gnus-dribble-eval-file))
  888. ;; Slave Gnusii should then clear the dribble buffer.
  889. (when (and init gnus-slave)
  890. (gnus-dribble-clear))
  891. (gnus-update-format-specifications)
  892. ;; See whether we need to read the description file.
  893. (when (and (boundp 'gnus-group-line-format)
  894. (stringp gnus-group-line-format)
  895. (let ((case-fold-search nil))
  896. (string-match "%[-,0-9]*D" gnus-group-line-format))
  897. (not gnus-description-hashtb)
  898. (not dont-connect)
  899. gnus-read-active-file)
  900. (gnus-read-all-descriptions-files))
  901. ;; Find new newsgroups and treat them.
  902. (when (and init gnus-check-new-newsgroups (not level)
  903. (gnus-check-server gnus-select-method)
  904. (not gnus-slave)
  905. gnus-plugged)
  906. (gnus-find-new-newsgroups))
  907. ;; Check and remove bogus newsgroups.
  908. (when (and init gnus-check-bogus-newsgroups
  909. gnus-read-active-file (not level)
  910. (gnus-server-opened gnus-select-method))
  911. (gnus-check-bogus-newsgroups))
  912. ;; Read any slave files.
  913. (gnus-master-read-slave-newsrc)
  914. ;; Find the number of unread articles in each non-dead group.
  915. (let ((gnus-read-active-file (and (not level) gnus-read-active-file)))
  916. (gnus-get-unread-articles level dont-connect))))
  917. (defun gnus-call-subscribe-functions (method group)
  918. "Call METHOD to subscribe GROUP.
  919. If no function returns `non-nil', call `gnus-subscribe-zombies'."
  920. (unless (cond
  921. ((functionp method)
  922. (funcall method group))
  923. ((listp method)
  924. (catch 'found
  925. (dolist (func method)
  926. (if (funcall func group)
  927. (throw 'found t)))
  928. nil))
  929. (t nil))
  930. (gnus-subscribe-zombies group)))
  931. (defun gnus-find-new-newsgroups (&optional arg)
  932. "Search for new newsgroups and add them.
  933. Each new newsgroup will be treated with `gnus-subscribe-newsgroup-method'.
  934. The `-n' option line from .newsrc is respected.
  935. With 1 C-u, use the `ask-server' method to query the server for new
  936. groups.
  937. With 2 C-u's, use most complete method possible to query the server
  938. for new groups, and subscribe the new groups as zombies."
  939. (interactive "p")
  940. (let* ((gnus-subscribe-newsgroup-method
  941. gnus-subscribe-newsgroup-method)
  942. (check (cond
  943. ((or (and (= (or arg 1) 4)
  944. (not (listp gnus-check-new-newsgroups)))
  945. (null gnus-read-active-file)
  946. (eq gnus-read-active-file 'some))
  947. 'ask-server)
  948. ((= (or arg 1) 16)
  949. (setq gnus-subscribe-newsgroup-method
  950. 'gnus-subscribe-zombies)
  951. t)
  952. (t gnus-check-new-newsgroups))))
  953. (if (or (consp check)
  954. (eq check 'ask-server))
  955. ;; Ask the server for new groups.
  956. (gnus-ask-server-for-new-groups)
  957. ;; Go through the active hashtb and look for new groups.
  958. (let ((groups 0)
  959. group new-newsgroups)
  960. (gnus-message 5 "Looking for new newsgroups...")
  961. (unless gnus-have-read-active-file
  962. (gnus-read-active-file))
  963. (setq gnus-newsrc-last-checked-date (message-make-date))
  964. (unless gnus-killed-hashtb
  965. (gnus-make-hashtable-from-killed))
  966. ;; Go though every newsgroup in `gnus-active-hashtb' and compare
  967. ;; with `gnus-newsrc-hashtb' and `gnus-killed-hashtb'.
  968. (mapatoms
  969. (lambda (sym)
  970. (if (or (null (setq group (symbol-name sym)))
  971. (not (boundp sym))
  972. (null (symbol-value sym))
  973. (gnus-gethash group gnus-killed-hashtb)
  974. (gnus-gethash group gnus-newsrc-hashtb))
  975. ()
  976. (let ((do-sub (gnus-matches-options-n group)))
  977. (cond
  978. ((eq do-sub 'subscribe)
  979. (setq groups (1+ groups))
  980. (gnus-sethash group group gnus-killed-hashtb)
  981. (gnus-call-subscribe-functions
  982. gnus-subscribe-options-newsgroup-method group))
  983. ((eq do-sub 'ignore)
  984. nil)
  985. (t
  986. (setq groups (1+ groups))
  987. (gnus-sethash group group gnus-killed-hashtb)
  988. (if gnus-subscribe-hierarchical-interactive
  989. (push group new-newsgroups)
  990. (gnus-call-subscribe-functions
  991. gnus-subscribe-newsgroup-method group)))))))
  992. gnus-active-hashtb)
  993. (when new-newsgroups
  994. (gnus-subscribe-hierarchical-interactive new-newsgroups))
  995. (if (> groups 0)
  996. (gnus-message 5 "%d new newsgroup%s arrived."
  997. groups (if (> groups 1) "s have" " has"))
  998. (gnus-message 5 "No new newsgroups."))
  999. groups))))
  1000. (defun gnus-matches-options-n (group)
  1001. ;; Returns `subscribe' if the group is to be unconditionally
  1002. ;; subscribed, `ignore' if it is to be ignored, and nil if there is
  1003. ;; no match for the group.
  1004. ;; First we check the two user variables.
  1005. (cond
  1006. ((and gnus-options-subscribe
  1007. (string-match gnus-options-subscribe group))
  1008. 'subscribe)
  1009. ((let ((do-subscribe nil))
  1010. (dolist (category gnus-auto-subscribed-categories)
  1011. (when (gnus-member-of-valid category group)
  1012. (setq do-subscribe t)))
  1013. do-subscribe)
  1014. 'subscribe)
  1015. ((and gnus-auto-subscribed-groups
  1016. (string-match gnus-auto-subscribed-groups group))
  1017. 'subscribe)
  1018. ((and gnus-options-not-subscribe
  1019. (string-match gnus-options-not-subscribe group))
  1020. 'ignore)
  1021. ;; Then we go through the list that was retrieved from the .newsrc
  1022. ;; file. This list has elements on the form
  1023. ;; `(REGEXP . {ignore,subscribe})'. The first match found (the list
  1024. ;; is in the reverse order of the options line) is returned.
  1025. (t
  1026. (let ((regs gnus-newsrc-options-n))
  1027. (while (and regs
  1028. (not (string-match (caar regs) group)))
  1029. (setq regs (cdr regs)))
  1030. (and regs (cdar regs))))))
  1031. (defun gnus-ask-server-for-new-groups ()
  1032. (let* ((new-date (message-make-date))
  1033. (date (or gnus-newsrc-last-checked-date new-date))
  1034. (methods (cons gnus-select-method
  1035. (nconc
  1036. (when (gnus-archive-server-wanted-p)
  1037. (list "archive"))
  1038. (append
  1039. (and (consp gnus-check-new-newsgroups)
  1040. gnus-check-new-newsgroups)
  1041. gnus-secondary-select-methods))))
  1042. (groups 0)
  1043. group new-newsgroups got-new method hashtb
  1044. gnus-override-subscribe-method)
  1045. (unless gnus-killed-hashtb
  1046. (gnus-make-hashtable-from-killed))
  1047. ;; Go through both primary and secondary select methods and
  1048. ;; request new newsgroups.
  1049. (while (setq method (gnus-server-get-method nil (pop methods)))
  1050. (setq new-newsgroups nil
  1051. gnus-override-subscribe-method method)
  1052. (when (and (gnus-check-server method)
  1053. (gnus-request-newgroups date method))
  1054. (save-excursion
  1055. (setq got-new t
  1056. hashtb (gnus-make-hashtable 100))
  1057. (set-buffer nntp-server-buffer)
  1058. ;; Enter all the new groups into a hashtable.
  1059. (gnus-active-to-gnus-format method hashtb 'ignore))
  1060. ;; Now all new groups from `method' are in `hashtb'.
  1061. (mapatoms
  1062. (lambda (group-sym)
  1063. (if (or (null (setq group (symbol-name group-sym)))
  1064. (not (boundp group-sym))
  1065. (null (symbol-value group-sym))
  1066. (gnus-gethash group gnus-newsrc-hashtb)
  1067. (member group gnus-zombie-list)
  1068. (member group gnus-killed-list))
  1069. ;; The group is already known.
  1070. ()
  1071. ;; Make this group active.
  1072. (when (symbol-value group-sym)
  1073. (gnus-set-active group (symbol-value group-sym)))
  1074. ;; Check whether we want it or not.
  1075. (let ((do-sub (gnus-matches-options-n group)))
  1076. (cond
  1077. ((eq do-sub 'subscribe)
  1078. (incf groups)
  1079. (gnus-sethash group group gnus-killed-hashtb)
  1080. (gnus-call-subscribe-functions
  1081. gnus-subscribe-options-newsgroup-method group))
  1082. ((eq do-sub 'ignore)
  1083. nil)
  1084. (t
  1085. (incf groups)
  1086. (gnus-sethash group group gnus-killed-hashtb)
  1087. (if gnus-subscribe-hierarchical-interactive
  1088. (push group new-newsgroups)
  1089. (gnus-call-subscribe-functions
  1090. gnus-subscribe-newsgroup-method group)))))))
  1091. hashtb))
  1092. (when new-newsgroups
  1093. (gnus-subscribe-hierarchical-interactive new-newsgroups)))
  1094. (if (> groups 0)
  1095. (gnus-message 5 "%d new newsgroup%s arrived"
  1096. groups (if (> groups 1) "s have" " has"))
  1097. (gnus-message 5 "No new newsgroups"))
  1098. (when got-new
  1099. (setq gnus-newsrc-last-checked-date new-date))
  1100. new-newsgroups))
  1101. (defun gnus-subscribe-group (group &optional previous method)
  1102. "Subscribe GROUP and put it after PREVIOUS."
  1103. (gnus-group-change-level
  1104. (if method
  1105. (list t group gnus-level-default-subscribed nil nil method)
  1106. group)
  1107. gnus-level-default-subscribed gnus-level-killed previous t)
  1108. t)
  1109. ;; `gnus-group-change-level' is the fundamental function for changing
  1110. ;; subscription levels of newsgroups. This might mean just changing
  1111. ;; from level 1 to 2, which is pretty trivial, from 2 to 6 or back
  1112. ;; again, which subscribes/unsubscribes a group, which is equally
  1113. ;; trivial. Changing from 1-7 to 8-9 means that you kill a group, and
  1114. ;; from 8-9 to 1-7 means that you remove the group from the list of
  1115. ;; killed (or zombie) groups and add them to the (kinda) subscribed
  1116. ;; groups. And last but not least, moving from 8 to 9 and 9 to 8,
  1117. ;; which is trivial.
  1118. ;; ENTRY can either be a string (newsgroup name) or a list (if
  1119. ;; FROMKILLED is t, it's a list on the format (NUM INFO-LIST),
  1120. ;; otherwise it's a list in the format of the `gnus-newsrc-hashtb'
  1121. ;; entries.
  1122. ;; LEVEL is the new level of the group, OLDLEVEL is the old level and
  1123. ;; PREVIOUS is the group (in hashtb entry format) to insert this group
  1124. ;; after.
  1125. (defun gnus-group-change-level (entry level &optional oldlevel
  1126. previous fromkilled)
  1127. (let (group info active num)
  1128. ;; Glean what info we can from the arguments
  1129. (if (consp entry)
  1130. (if fromkilled (setq group (nth 1 entry))
  1131. (setq group (car (nth 2 entry))))
  1132. (setq group entry))
  1133. (when (and (stringp entry)
  1134. oldlevel
  1135. (< oldlevel gnus-level-zombie))
  1136. (setq entry (gnus-group-entry entry)))
  1137. (if (and (not oldlevel)
  1138. (consp entry))
  1139. (setq oldlevel (gnus-info-level (nth 2 entry)))
  1140. (setq oldlevel (or oldlevel gnus-level-killed)))
  1141. (when (stringp previous)
  1142. (setq previous (gnus-group-entry previous)))
  1143. (if (and (>= oldlevel gnus-level-zombie)
  1144. (gnus-group-entry group))
  1145. ;; We are trying to subscribe a group that is already
  1146. ;; subscribed.
  1147. () ; Do nothing.
  1148. (unless (gnus-ephemeral-group-p group)
  1149. (gnus-dribble-enter
  1150. (format "(gnus-group-change-level %S %S %S %S %S)"
  1151. group level oldlevel (car (nth 2 previous)) fromkilled)))
  1152. ;; Then we remove the newgroup from any old structures, if needed.
  1153. ;; If the group was killed, we remove it from the killed or zombie
  1154. ;; list. If not, and it is in fact going to be killed, we remove
  1155. ;; it from the newsrc hash table and assoc.
  1156. (cond
  1157. ((>= oldlevel gnus-level-zombie)
  1158. ;; oldlevel could be wrong.
  1159. (setq gnus-zombie-list (delete group gnus-zombie-list))
  1160. (setq gnus-killed-list (delete group gnus-killed-list)))
  1161. (t
  1162. (when (and (>= level gnus-level-zombie)
  1163. entry)
  1164. (gnus-sethash (car (nth 2 entry)) nil gnus-newsrc-hashtb)
  1165. (when (nth 3 entry)
  1166. (setcdr (gnus-group-entry (car (nth 3 entry)))
  1167. (cdr entry)))
  1168. (setcdr (cdr entry) (cdddr entry)))))
  1169. ;; Finally we enter (if needed) the list where it is supposed to
  1170. ;; go, and change the subscription level. If it is to be killed,
  1171. ;; we enter it into the killed or zombie list.
  1172. (cond
  1173. ((>= level gnus-level-zombie)
  1174. ;; Remove from the hash table.
  1175. (gnus-sethash group nil gnus-newsrc-hashtb)
  1176. (if (= level gnus-level-zombie)
  1177. (push group gnus-zombie-list)
  1178. (if (= oldlevel gnus-level-killed)
  1179. ;; Remove from active hashtb.
  1180. (unintern group gnus-active-hashtb)
  1181. ;; Don't add it into killed-list if it was killed.
  1182. (push group gnus-killed-list))))
  1183. (t
  1184. ;; If the list is to be entered into the newsrc assoc, and
  1185. ;; it was killed, we have to create an entry in the newsrc
  1186. ;; hashtb format and fix the pointers in the newsrc assoc.
  1187. (if (< oldlevel gnus-level-zombie)
  1188. ;; It was alive, and it is going to stay alive, so we
  1189. ;; just change the level and don't change any pointers or
  1190. ;; hash table entries.
  1191. (setcar (cdaddr entry) level)
  1192. (if (listp entry)
  1193. (setq info (cdr entry)
  1194. num (car entry))
  1195. (setq active (gnus-active group))
  1196. (setq num
  1197. (if active (- (1+ (cdr active)) (car active)) t))
  1198. ;; Shorten the select method if possible, if we need to
  1199. ;; store it at all (native groups).
  1200. (let ((method (gnus-method-simplify
  1201. (or gnus-override-subscribe-method
  1202. (gnus-group-method group)))))
  1203. (if method
  1204. (setq info (list group level nil nil method))
  1205. (setq info (list group level nil)))))
  1206. (unless previous
  1207. (setq previous
  1208. (let ((p gnus-newsrc-alist))
  1209. (while (cddr p)
  1210. (setq p (cdr p)))
  1211. p)))
  1212. (setq entry (cons info (cddr previous)))
  1213. (if (cdr previous)
  1214. (progn
  1215. (setcdr (cdr previous) entry)
  1216. (gnus-sethash group (cons num (cdr previous))
  1217. gnus-newsrc-hashtb))
  1218. (setcdr previous entry)
  1219. (gnus-sethash group (cons num previous)
  1220. gnus-newsrc-hashtb))
  1221. (when (cdr entry)
  1222. (setcdr (gnus-group-entry (caadr entry)) entry))
  1223. (gnus-dribble-enter
  1224. (format "(gnus-group-set-info '%S)" info)
  1225. (concat "^(gnus-group-set-info '(\"" (regexp-quote group) "\"")))))
  1226. (when gnus-group-change-level-function
  1227. (funcall gnus-group-change-level-function
  1228. group level oldlevel previous)))))
  1229. (defun gnus-kill-newsgroup (newsgroup)
  1230. "Obsolete function. Kills a newsgroup."
  1231. (gnus-group-change-level
  1232. (gnus-group-entry newsgroup) gnus-level-killed))
  1233. (defun gnus-check-bogus-newsgroups (&optional confirm)
  1234. "Remove bogus newsgroups.
  1235. If CONFIRM is non-nil, the user has to confirm the deletion of every
  1236. newsgroup."
  1237. (let ((newsrc (cdr gnus-newsrc-alist))
  1238. bogus group entry info)
  1239. (gnus-message 5 "Checking bogus newsgroups...")
  1240. (unless (gnus-read-active-file-p)
  1241. (gnus-read-active-file t))
  1242. (when (gnus-read-active-file-p)
  1243. ;; Find all bogus newsgroup that are subscribed.
  1244. (while newsrc
  1245. (setq info (pop newsrc)
  1246. group (gnus-info-group info))
  1247. (unless (or (gnus-active group) ; Active
  1248. (and (gnus-info-method info)
  1249. (not (gnus-secondary-method-p
  1250. (gnus-info-method info))))) ; Foreign
  1251. ;; Found a bogus newsgroup.
  1252. (push group bogus)))
  1253. (if confirm
  1254. (map-y-or-n-p
  1255. (format "Remove bogus group %%s (of %d groups)? " (length bogus))
  1256. (lambda (group)
  1257. ;; Remove all bogus subscribed groups by first killing them, and
  1258. ;; then removing them from the list of killed groups.
  1259. (when (setq entry (gnus-group-entry group))
  1260. (gnus-group-change-level entry gnus-level-killed)
  1261. (setq gnus-killed-list (delete group gnus-killed-list))))
  1262. bogus '("group" "groups" "remove"))
  1263. (while (setq group (pop bogus))
  1264. ;; Remove all bogus subscribed groups by first killing them, and
  1265. ;; then removing them from the list of killed groups.
  1266. (when (setq entry (gnus-group-entry group))
  1267. (gnus-group-change-level entry gnus-level-killed)
  1268. (setq gnus-killed-list (delete group gnus-killed-list)))))
  1269. ;; Then we remove all bogus groups from the list of killed and
  1270. ;; zombie groups. They are removed without confirmation.
  1271. (let ((dead-lists '(gnus-killed-list gnus-zombie-list))
  1272. killed)
  1273. (while dead-lists
  1274. (setq killed (symbol-value (car dead-lists)))
  1275. (while killed
  1276. (unless (gnus-active (setq group (pop killed)))
  1277. ;; The group is bogus.
  1278. ;; !!!Slow as hell.
  1279. (set (car dead-lists)
  1280. (delete group (symbol-value (car dead-lists))))))
  1281. (setq dead-lists (cdr dead-lists))))
  1282. (gnus-run-hooks 'gnus-check-bogus-groups-hook)
  1283. (gnus-message 5 "Checking bogus newsgroups...done"))))
  1284. (defun gnus-check-duplicate-killed-groups ()
  1285. "Remove duplicates from the list of killed groups."
  1286. (interactive)
  1287. (let ((killed gnus-killed-list))
  1288. (while killed
  1289. (gnus-message 9 "%d" (length killed))
  1290. (setcdr killed (delete (car killed) (cdr killed)))
  1291. (setq killed (cdr killed)))))
  1292. ;; We want to inline a function from gnus-cache, so we cheat here:
  1293. (defvar gnus-cache-active-hashtb)
  1294. (eval-when-compile
  1295. (defun gnus-cache-possibly-alter-active (group active)
  1296. "Alter the ACTIVE info for GROUP to reflect the articles in the cache."
  1297. (when gnus-cache-active-hashtb
  1298. (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb)))
  1299. (when cache-active
  1300. (when (< (car cache-active) (car active))
  1301. (setcar active (car cache-active)))
  1302. (when (> (cdr cache-active) (cdr active))
  1303. (setcdr active (cdr cache-active))))))))
  1304. (defun gnus-activate-group (group &optional scan dont-check method
  1305. dont-sub-check)
  1306. "Check whether a group has been activated or not.
  1307. If SCAN, request a scan of that group as well. If METHOD, use
  1308. that select method instead of determining the method based on the
  1309. group name. If DONT-CHECK, don't check check whether the group
  1310. actually exists. If DONT-SUB-CHECK or DONT-CHECK, don't let the
  1311. backend check whether the group actually exists."
  1312. (let ((method (or method (inline (gnus-find-method-for-group group))))
  1313. active)
  1314. (and (inline (gnus-check-server method))
  1315. ;; We escape all bugs and quit here to make it possible to
  1316. ;; continue if a group is so out-there that it reports bugs
  1317. ;; and stuff.
  1318. (progn
  1319. (and scan
  1320. (gnus-check-backend-function 'request-scan (car method))
  1321. (gnus-request-scan group method))
  1322. t)
  1323. (if (or debug-on-error debug-on-quit)
  1324. (inline (gnus-request-group group (or dont-sub-check dont-check)
  1325. method
  1326. (gnus-get-info group)))
  1327. (condition-case nil
  1328. (inline (gnus-request-group group (or dont-sub-check dont-check)
  1329. method
  1330. (gnus-get-info group)))
  1331. (quit
  1332. (if debug-on-quit
  1333. (debug "Quit")
  1334. (message "Quit activating %s" group))
  1335. nil)))
  1336. (unless dont-check
  1337. (setq active (gnus-parse-active))
  1338. ;; If there are no articles in the group, the GROUP
  1339. ;; command may have responded with the `(0 . 0)'. We
  1340. ;; ignore this if we already have an active entry
  1341. ;; for the group.
  1342. (if (and (zerop (or (car active) 0))
  1343. (zerop (or (cdr active) 0))
  1344. (gnus-active group))
  1345. (gnus-active group)
  1346. ;; If a cache is present, we may have to alter the active info.
  1347. (when gnus-use-cache
  1348. (inline (gnus-cache-possibly-alter-active
  1349. group active)))
  1350. ;; If the agent is enabled, we may have to alter the active info.
  1351. (when gnus-agent
  1352. (gnus-agent-possibly-alter-active group active))
  1353. (gnus-set-active group active)
  1354. ;; Return the new active info.
  1355. active)))))
  1356. (defvar gnus-propagate-marks) ; gnus-sum
  1357. (defun gnus-get-unread-articles-in-group (info active &optional update)
  1358. (when (and info active)
  1359. ;; Allow the backend to update the info in the group.
  1360. (when (and update
  1361. (gnus-request-update-info
  1362. info (inline (gnus-find-method-for-group
  1363. (gnus-info-group info)))))
  1364. (gnus-activate-group (gnus-info-group info) nil t))
  1365. ;; Allow backends to update marks,
  1366. (when gnus-propagate-marks
  1367. (let ((method (inline (gnus-find-method-for-group
  1368. (gnus-info-group info)))))
  1369. (when (gnus-check-backend-function 'request-marks (car method))
  1370. (gnus-request-marks info method))))
  1371. (let* ((range (gnus-info-read info))
  1372. (num 0))
  1373. ;; These checks are present in gnus-activate-group but skipped
  1374. ;; due to setting dont-check in the preceding call.
  1375. ;; If a cache is present, we may have to alter the active info.
  1376. (when (and gnus-use-cache info)
  1377. (inline (gnus-cache-possibly-alter-active
  1378. (gnus-info-group info) active)))
  1379. ;; If the agent is enabled, we may have to alter the active info.
  1380. (when (and gnus-agent info)
  1381. (gnus-agent-possibly-alter-active (gnus-info-group info) active info))
  1382. ;; Modify the list of read articles according to what articles
  1383. ;; are available; then tally the unread articles and add the
  1384. ;; number to the group hash table entry.
  1385. (cond
  1386. ((zerop (cdr active))
  1387. (setq num 0))
  1388. ((not range)
  1389. (setq num (- (1+ (cdr active)) (car active))))
  1390. ((not (listp (cdr range)))
  1391. ;; Fix a single (num . num) range according to the
  1392. ;; active hash table.
  1393. ;; Fix by Carsten Bormann <cabo@Informatik.Uni-Bremen.DE>.
  1394. (and (< (cdr range) (car active)) (setcdr range (1- (car active))))
  1395. (and (> (cdr range) (cdr active)) (setcdr range (cdr active)))
  1396. ;; Compute number of unread articles.
  1397. (setq num (max 0 (- (cdr active) (- (1+ (cdr range)) (car range))))))
  1398. (t
  1399. ;; The read list is a list of ranges. Fix them according to
  1400. ;; the active hash table.
  1401. ;; First peel off any elements that are below the lower
  1402. ;; active limit.
  1403. (while (and (cdr range)
  1404. (>= (car active)
  1405. (or (and (atom (cadr range)) (cadr range))
  1406. (caadr range))))
  1407. (if (numberp (car range))
  1408. (setcar range
  1409. (cons (car range)
  1410. (or (and (numberp (cadr range))
  1411. (cadr range))
  1412. (cdadr range))))
  1413. (setcdr (car range)
  1414. (or (and (numberp (nth 1 range)) (nth 1 range))
  1415. (cdadr range))))
  1416. (setcdr range (cddr range)))
  1417. ;; Adjust the first element to be the same as the lower limit.
  1418. (when (and (not (atom (car range)))
  1419. (< (cdar range) (car active)))
  1420. (setcdr (car range) (1- (car active))))
  1421. ;; Then we want to peel off any elements that are higher
  1422. ;; than the upper active limit.
  1423. (let ((srange range))
  1424. ;; Go past all valid elements.
  1425. (while (and (cdr srange)
  1426. (<= (or (and (atom (cadr srange))
  1427. (cadr srange))
  1428. (caadr srange))
  1429. (cdr active)))
  1430. (setq srange (cdr srange)))
  1431. (when (cdr srange)
  1432. ;; Nuke all remaining invalid elements.
  1433. (setcdr srange nil))
  1434. ;; Adjust the final element.
  1435. (when (and (not (atom (car srange)))
  1436. (> (cdar srange) (cdr active)))
  1437. (setcdr (car srange) (cdr active))))
  1438. ;; Compute the number of unread articles.
  1439. (while range
  1440. (setq num (+ num (- (1+ (or (and (atom (car range)) (car range))
  1441. (cdar range)))
  1442. (or (and (atom (car range)) (car range))
  1443. (caar range)))))
  1444. (setq range (cdr range)))
  1445. (setq num (max 0 (- (cdr active) num)))))
  1446. ;; Set the number of unread articles.
  1447. (when (and info
  1448. (gnus-group-entry (gnus-info-group info)))
  1449. (setcar (gnus-group-entry (gnus-info-group info)) num))
  1450. num)))
  1451. ;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb'
  1452. ;; and compute how many unread articles there are in each group.
  1453. (defun gnus-get-unread-articles (&optional level dont-connect)
  1454. (setq gnus-server-method-cache nil)
  1455. (require 'gnus-agent)
  1456. (let* ((newsrc (cdr gnus-newsrc-alist))
  1457. (alevel (or level gnus-activate-level (1+ gnus-level-subscribed)))
  1458. (foreign-level
  1459. (or
  1460. level
  1461. (min
  1462. (cond ((and gnus-activate-foreign-newsgroups
  1463. (not (numberp gnus-activate-foreign-newsgroups)))
  1464. (1+ gnus-level-subscribed))
  1465. ((numberp gnus-activate-foreign-newsgroups)
  1466. gnus-activate-foreign-newsgroups)
  1467. (t 0))
  1468. alevel)))
  1469. (methods-cache nil)
  1470. (type-cache nil)
  1471. (gnus-agent-article-local-times 0)
  1472. (archive-method (gnus-server-to-method "archive"))
  1473. infos info group active method cmethod
  1474. method-type method-group-list entry)
  1475. (gnus-message 6 "Checking new news...")
  1476. (while newsrc
  1477. (setq active (gnus-active (setq group (gnus-info-group
  1478. (setq info (pop newsrc))))))
  1479. ;; First go through all the groups, see what select methods they
  1480. ;; belong to, and then collect them into lists per unique select
  1481. ;; method.
  1482. (if (not (setq method (gnus-info-method info)))
  1483. (setq method gnus-select-method)
  1484. ;; There may be several similar methods. Possibly extend the
  1485. ;; method.
  1486. (if (setq cmethod (assoc method methods-cache))
  1487. (setq method (cdr cmethod))
  1488. (setq cmethod (if (stringp method)
  1489. (gnus-server-to-method method)
  1490. (inline (gnus-find-method-for-group
  1491. (gnus-info-group info) info))))
  1492. (push (cons method cmethod) methods-cache)
  1493. (setq method cmethod)))
  1494. (setq method-group-list (assoc method type-cache))
  1495. (unless method-group-list
  1496. (setq method-type
  1497. (cond
  1498. ((or (gnus-secondary-method-p method)
  1499. (and (gnus-archive-server-wanted-p)
  1500. (gnus-methods-equal-p archive-method method)))
  1501. 'secondary)
  1502. ((inline (gnus-server-equal gnus-select-method method))
  1503. 'primary)
  1504. (t
  1505. 'foreign)))
  1506. (push (setq method-group-list (list method method-type nil nil))
  1507. type-cache))
  1508. ;; Only add groups that need updating.
  1509. (if (<= (gnus-info-level info)
  1510. (if (eq (cadr method-group-list) 'foreign)
  1511. foreign-level
  1512. alevel))
  1513. (setcar (nthcdr 2 method-group-list)
  1514. (cons info (nth 2 method-group-list)))
  1515. ;; The group is inactive, so we nix out the number of unread articles.
  1516. ;; It leads `(gnus-group-unread group)' to return t. See also
  1517. ;; `gnus-group-prepare-flat'.
  1518. (unless active
  1519. (when (setq entry (gnus-group-entry group))
  1520. (setcar entry t)))))
  1521. ;; Sort the methods based so that the primary and secondary
  1522. ;; methods come first. This is done for legacy reasons to try to
  1523. ;; ensure that side-effect behavior doesn't change from previous
  1524. ;; Gnus versions.
  1525. (setq type-cache
  1526. (sort (nreverse type-cache)
  1527. (lambda (c1 c2)
  1528. (< (gnus-method-rank (cadr c1) (car c1))
  1529. (gnus-method-rank (cadr c2) (car c2))))))
  1530. ;; Go through the list of servers and possibly extend methods that
  1531. ;; aren't equal (and that need extension; i.e., they are async).
  1532. (let ((methods nil))
  1533. (dolist (elem type-cache)
  1534. (destructuring-bind (method method-type infos dummy) elem
  1535. (let ((gnus-opened-servers methods))
  1536. (when (and (gnus-similar-server-opened method)
  1537. (gnus-check-backend-function
  1538. 'retrieve-group-data-early (car method)))
  1539. (setq method (gnus-server-extend-method
  1540. (gnus-info-group (car infos))
  1541. method))
  1542. (setcar elem method))
  1543. (push (list method 'ok) methods)))))
  1544. ;; If we have primary/secondary select methods, but no groups from
  1545. ;; them, we still want to issue a retrieval request from them.
  1546. (unless dont-connect
  1547. (dolist (method (cons gnus-select-method
  1548. gnus-secondary-select-methods))
  1549. (when (and (not (assoc method type-cache))
  1550. (gnus-check-backend-function 'request-list (car method)))
  1551. (with-current-buffer nntp-server-buffer
  1552. (gnus-read-active-file-1 method nil)))))
  1553. ;; Clear out all the early methods.
  1554. (dolist (elem type-cache)
  1555. (destructuring-bind (method method-type infos dummy) elem
  1556. (when (and method
  1557. infos
  1558. (gnus-check-backend-function
  1559. 'retrieve-group-data-early (car method))
  1560. (not (gnus-method-denied-p method)))
  1561. (when (ignore-errors (gnus-get-function method 'open-server))
  1562. (unless (gnus-server-opened method)
  1563. (gnus-open-server method))
  1564. (when (gnus-server-opened method)
  1565. ;; Just mark this server as "cleared".
  1566. (gnus-retrieve-group-data-early method nil))))))
  1567. ;; Start early async retrieval of data.
  1568. (let ((done-methods nil)
  1569. sanity-spec)
  1570. (dolist (elem type-cache)
  1571. (destructuring-bind (method method-type infos dummy) elem
  1572. (setq sanity-spec (list (car method) (cadr method)))
  1573. (when (and method infos
  1574. (not (gnus-method-denied-p method)))
  1575. ;; If the open-server method doesn't exist, then the method
  1576. ;; itself doesn't exist, so we ignore it.
  1577. (if (not (ignore-errors (gnus-get-function method 'open-server)))
  1578. (setq type-cache (delq elem type-cache))
  1579. (unless (gnus-server-opened method)
  1580. (gnus-open-server method))
  1581. (when (and
  1582. ;; This is a sanity check, so that we never
  1583. ;; attempt to start two async requests to the
  1584. ;; same server, because that will fail. This
  1585. ;; should never happen, since the methods should
  1586. ;; be unique at this point, but apparently it
  1587. ;; does happen in the wild with some setups.
  1588. (not (member sanity-spec done-methods))
  1589. (gnus-server-opened method)
  1590. (gnus-check-backend-function
  1591. 'retrieve-group-data-early (car method)))
  1592. (push sanity-spec done-methods)
  1593. (when (gnus-check-backend-function 'request-scan (car method))
  1594. (gnus-request-scan nil method))
  1595. ;; Store the token we get back from -early so that we
  1596. ;; can pass it to -finish later.
  1597. (setcar (nthcdr 3 elem)
  1598. (gnus-retrieve-group-data-early method infos))))))))
  1599. ;; Do the rest of the retrieval.
  1600. (dolist (elem type-cache)
  1601. (destructuring-bind (method method-type infos early-data) elem
  1602. (when (and method infos
  1603. (not (gnus-method-denied-p method)))
  1604. (let ((updatep (gnus-check-backend-function
  1605. 'request-update-info (car method))))
  1606. ;; See if any of the groups from this method require updating.
  1607. (gnus-read-active-for-groups method infos early-data)
  1608. (dolist (info infos)
  1609. (inline (gnus-get-unread-articles-in-group
  1610. info (gnus-active (gnus-info-group info))
  1611. updatep)))))))
  1612. (gnus-message 6 "Checking new news...done")))
  1613. (defun gnus-method-rank (type method)
  1614. (cond
  1615. ;; Get info for virtual groups last.
  1616. ((eq (car method) 'nnvirtual)
  1617. 200)
  1618. ((eq type 'primary)
  1619. 1)
  1620. ;; Compute the rank of the secondary methods based on where they
  1621. ;; are in the secondary select list.
  1622. ((eq type 'secondary)
  1623. (let ((i 2))
  1624. (block nil
  1625. (dolist (smethod gnus-secondary-select-methods)
  1626. (when (equal method smethod)
  1627. (return i))
  1628. (incf i))
  1629. i)))
  1630. ;; Just say that all foreign groups have the same rank.
  1631. (t
  1632. 100)))
  1633. (defun gnus-read-active-for-groups (method infos early-data)
  1634. (with-current-buffer nntp-server-buffer
  1635. (cond
  1636. ;; Finish up getting the data from the methods that have -early
  1637. ;; methods.
  1638. ((and
  1639. early-data
  1640. (gnus-check-backend-function 'finish-retrieve-group-infos (car method))
  1641. (or (not (gnus-agent-method-p method))
  1642. (gnus-online method)))
  1643. (gnus-finish-retrieve-group-infos method infos early-data)
  1644. (gnus-agent-save-active method))
  1645. ;; Most backends have -retrieve-groups.
  1646. ((gnus-check-backend-function 'retrieve-groups (car method))
  1647. (when (gnus-check-backend-function 'request-scan (car method))
  1648. (gnus-request-scan nil method))
  1649. (let (groups)
  1650. (gnus-read-active-file-2
  1651. (dolist (info infos (nreverse groups))
  1652. (push (gnus-group-real-name (gnus-info-group info)) groups))
  1653. method)))
  1654. ;; Virtually all backends have -request-list.
  1655. ((gnus-check-backend-function 'request-list (car method))
  1656. (gnus-read-active-file-1 method nil))
  1657. ;; Except nnvirtual and friends, where we request each group, one
  1658. ;; by one.
  1659. (t
  1660. (dolist (info infos)
  1661. (gnus-activate-group (gnus-info-group info) nil nil method t))))))
  1662. ;; Create a hash table out of the newsrc alist. The `car's of the
  1663. ;; alist elements are used as keys.
  1664. (defun gnus-make-hashtable-from-newsrc-alist ()
  1665. (let ((alist gnus-newsrc-alist)
  1666. (ohashtb gnus-newsrc-hashtb)
  1667. prev info method rest methods)
  1668. (setq gnus-newsrc-hashtb (gnus-make-hashtable (length alist)))
  1669. (setq alist
  1670. (setq prev (setq gnus-newsrc-alist
  1671. (if (equal (caar gnus-newsrc-alist)
  1672. "dummy.group")
  1673. gnus-newsrc-alist
  1674. (cons (list "dummy.group" 0 nil) alist)))))
  1675. (while alist
  1676. (setq info (car alist))
  1677. ;; Make the same select-methods identical Lisp objects.
  1678. (when (setq method (gnus-info-method info))
  1679. (if (setq rest (member method methods))
  1680. (gnus-info-set-method info (car rest))
  1681. (push method methods)))
  1682. ;; Check for duplicates.
  1683. (if (gnus-gethash (car info) gnus-newsrc-hashtb)
  1684. ;; Remove this entry from the alist.
  1685. (setcdr prev (cddr prev))
  1686. (gnus-sethash
  1687. (car info)
  1688. ;; Preserve number of unread articles in groups.
  1689. (cons (and ohashtb (car (gnus-gethash (car info) ohashtb)))
  1690. prev)
  1691. gnus-newsrc-hashtb)
  1692. (setq prev alist))
  1693. (setq alist (cdr alist)))
  1694. ;; Make the same select-methods in `gnus-server-alist' identical
  1695. ;; as well.
  1696. (while methods
  1697. (setq method (pop methods))
  1698. (when (setq rest (rassoc method gnus-server-alist))
  1699. (setcdr rest method)))))
  1700. (defun gnus-make-hashtable-from-killed ()
  1701. "Create a hash table from the killed and zombie lists."
  1702. (let ((lists '(gnus-killed-list gnus-zombie-list))
  1703. list)
  1704. (setq gnus-killed-hashtb
  1705. (gnus-make-hashtable
  1706. (+ (length gnus-killed-list) (length gnus-zombie-list))))
  1707. (while lists
  1708. (setq list (symbol-value (pop lists)))
  1709. (while list
  1710. (gnus-sethash (car list) (pop list) gnus-killed-hashtb)))))
  1711. (defun gnus-parse-active ()
  1712. "Parse active info in the nntp server buffer."
  1713. (with-current-buffer nntp-server-buffer
  1714. (goto-char (point-min))
  1715. ;; Parse the result we got from `gnus-request-group'.
  1716. (when (looking-at "[0-9]+ [0-9]+ \\([0-9]+\\) [0-9]+")
  1717. (goto-char (match-beginning 1))
  1718. (cons (read (current-buffer))
  1719. (read (current-buffer))))))
  1720. (defun gnus-make-articles-unread (group articles)
  1721. "Mark ARTICLES in GROUP as unread."
  1722. (let* ((info (nth 2 (or (gnus-group-entry group)
  1723. (gnus-group-entry
  1724. (gnus-group-real-name group)))))
  1725. (ranges (gnus-info-read info))
  1726. news article)
  1727. (while articles
  1728. (when (gnus-member-of-range
  1729. (setq article (pop articles)) ranges)
  1730. (push article news)))
  1731. (when news
  1732. ;; Enter this list into the group info.
  1733. (gnus-info-set-read
  1734. info (gnus-remove-from-range (gnus-info-read info) (nreverse news)))
  1735. ;; Set the number of unread articles in gnus-newsrc-hashtb.
  1736. (gnus-get-unread-articles-in-group info (gnus-active group))
  1737. ;; Insert the change into the group buffer and the dribble file.
  1738. (gnus-group-update-group group t))))
  1739. (defun gnus-make-ascending-articles-unread (group articles)
  1740. "Mark ascending ARTICLES in GROUP as unread."
  1741. (let* ((entry (or (gnus-group-entry group)
  1742. (gnus-group-entry (gnus-group-real-name group))))
  1743. (info (nth 2 entry))
  1744. (ranges (gnus-info-read info))
  1745. (r ranges)
  1746. modified)
  1747. (while articles
  1748. (let ((article (pop articles))) ; get the next article to remove from ranges
  1749. (while (let ((range (car ranges))) ; note the current range
  1750. (if (atom range) ; single value range
  1751. (cond ((not range)
  1752. ;; the articles extend past the end of the ranges
  1753. ;; OK - I'm done
  1754. (setq articles nil))
  1755. ((< range article)
  1756. ;; this range precedes the article. Leave the range unmodified.
  1757. (pop ranges)
  1758. ranges)
  1759. ((= range article)
  1760. ;; this range exactly matches the article; REMOVE THE RANGE.
  1761. ;; NOTE: When the range being removed is the last range, the list is corrupted by inserting null at its end.
  1762. (setcar ranges (cadr ranges))
  1763. (setcdr ranges (cddr ranges))
  1764. (setq modified (if (car ranges) t 'remove-null))
  1765. nil))
  1766. (let ((min (car range))
  1767. (max (cdr range)))
  1768. ;; I have a min/max range to consider
  1769. (cond ((> min max) ; invalid range introduced by splitter
  1770. (setcar ranges (cadr ranges))
  1771. (setcdr ranges (cddr ranges))
  1772. (setq modified (if (car ranges) t 'remove-null))
  1773. ranges)
  1774. ((= min max)
  1775. ;; replace min/max range with a single-value range
  1776. (setcar ranges min)
  1777. ranges)
  1778. ((< max article)
  1779. ;; this range precedes the article. Leave the range unmodified.
  1780. (pop ranges)
  1781. ranges)
  1782. ((< article min)
  1783. ;; this article precedes the range. Return null to move to the
  1784. ;; next article
  1785. nil)
  1786. (t
  1787. ;; this article splits the range into two parts
  1788. (setcdr ranges (cons (cons (1+ article) max) (cdr ranges)))
  1789. (setcdr range (1- article))
  1790. (setq modified t)
  1791. ranges))))))))
  1792. (when modified
  1793. (when (eq modified 'remove-null)
  1794. (setq r (delq nil r)))
  1795. ;; Enter this list into the group info.
  1796. (gnus-info-set-read info r)
  1797. ;; Set the number of unread articles in gnus-newsrc-hashtb.
  1798. (gnus-get-unread-articles-in-group info (gnus-active group))
  1799. ;; Insert the change into the group buffer and the dribble file.
  1800. (gnus-group-update-group group t))))
  1801. ;; Enter all dead groups into the hashtb.
  1802. (defun gnus-update-active-hashtb-from-killed ()
  1803. (let ((hashtb (setq gnus-active-hashtb (gnus-make-hashtable 4096)))
  1804. (lists (list gnus-killed-list gnus-zombie-list))
  1805. killed)
  1806. (while lists
  1807. (setq killed (car lists))
  1808. (while killed
  1809. (gnus-sethash (mm-string-as-unibyte (car killed)) nil hashtb)
  1810. (setq killed (cdr killed)))
  1811. (setq lists (cdr lists)))))
  1812. (defun gnus-get-killed-groups ()
  1813. "Go through the active hashtb and mark all unknown groups as killed."
  1814. ;; First make sure active file has been read.
  1815. (unless (gnus-read-active-file-p)
  1816. (let ((gnus-read-active-file t))
  1817. (gnus-read-active-file)))
  1818. (unless gnus-killed-hashtb
  1819. (gnus-make-hashtable-from-killed))
  1820. ;; Go through all newsgroups that are known to Gnus - enlarge kill list.
  1821. (mapatoms
  1822. (lambda (sym)
  1823. (let ((groups 0)
  1824. (group (symbol-name sym)))
  1825. (if (or (null group)
  1826. (gnus-gethash group gnus-killed-hashtb)
  1827. (gnus-gethash group gnus-newsrc-hashtb))
  1828. ()
  1829. (let ((do-sub (gnus-matches-options-n group)))
  1830. (if (or (eq do-sub 'subscribe) (eq do-sub 'ignore))
  1831. ()
  1832. (setq groups (1+ groups))
  1833. (push group gnus-killed-list)
  1834. (gnus-sethash group group gnus-killed-hashtb))))))
  1835. gnus-active-hashtb)
  1836. (gnus-dribble-touch))
  1837. ;; Get the active file(s) from the backend(s).
  1838. (defun gnus-read-active-file (&optional force not-native)
  1839. (gnus-group-set-mode-line)
  1840. (let ((methods
  1841. (mapcar
  1842. (lambda (m) (if (stringp m) (gnus-server-get-method nil m) m))
  1843. (append
  1844. (if (and (not not-native)
  1845. (gnus-check-server gnus-select-method))
  1846. ;; The native server is available.
  1847. (cons gnus-select-method gnus-secondary-select-methods)
  1848. ;; The native server is down, so we just do the
  1849. ;; secondary ones.
  1850. gnus-secondary-select-methods)
  1851. ;; Also read from the archive server.
  1852. (when (gnus-archive-server-wanted-p)
  1853. (list "archive")))))
  1854. method)
  1855. (setq gnus-have-read-active-file nil)
  1856. (with-current-buffer nntp-server-buffer
  1857. (while (setq method (pop methods))
  1858. ;; Only do each method once, in case the methods appear more
  1859. ;; than once in this list.
  1860. (when (and (not (member method methods))
  1861. ;; Check whether the backend exists.
  1862. (ignore-errors (gnus-get-function method 'open-server)))
  1863. (if (or debug-on-error debug-on-quit)
  1864. (gnus-read-active-file-1 method force)
  1865. (condition-case ()
  1866. (gnus-read-active-file-1 method force)
  1867. ;; We catch C-g so that we can continue past servers
  1868. ;; that do not respond.
  1869. (quit
  1870. (if debug-on-quit
  1871. (debug "Quit")
  1872. (message "Quit reading the active file"))
  1873. nil))))))))
  1874. (defun gnus-read-active-file-1 (method force)
  1875. (let (where mesg)
  1876. (setq where (nth 1 method)
  1877. mesg (format "Reading active file%s via %s..."
  1878. (if (and where (not (zerop (length where))))
  1879. (concat " from " where) "")
  1880. (car method)))
  1881. (gnus-message 5 "%s" mesg)
  1882. (when (gnus-check-server method)
  1883. ;; Request that the backend scan its incoming messages.
  1884. (when (and (or (and gnus-agent
  1885. (gnus-online method))
  1886. (not gnus-agent))
  1887. (gnus-check-backend-function 'request-scan (car method)))
  1888. (gnus-request-scan nil method))
  1889. (cond
  1890. ((and (eq gnus-read-active-file 'some)
  1891. (gnus-check-backend-function 'retrieve-groups (car method))
  1892. (not force))
  1893. (let ((newsrc (cdr gnus-newsrc-alist))
  1894. (gmethod (gnus-server-get-method nil method))
  1895. groups info)
  1896. (while (setq info (pop newsrc))
  1897. (when (inline
  1898. (gnus-server-equal
  1899. (inline
  1900. (gnus-find-method-for-group
  1901. (gnus-info-group info) info))
  1902. gmethod))
  1903. (push (gnus-group-real-name (gnus-info-group info))
  1904. groups)))
  1905. (gnus-read-active-file-2 groups method)))
  1906. ((null method)
  1907. t)
  1908. (t
  1909. (if (not (gnus-request-list method))
  1910. (unless (equal method gnus-message-archive-method)
  1911. (gnus-error 1 "Cannot read active file from %s server"
  1912. (car method)))
  1913. (gnus-message 5 "%s" mesg)
  1914. (gnus-active-to-gnus-format method gnus-active-hashtb nil t)
  1915. ;; We mark this active file as read.
  1916. (add-to-list 'gnus-have-read-active-file method)
  1917. (gnus-message 5 "%sdone" mesg)))))))
  1918. (defun gnus-read-active-file-2 (groups method)
  1919. "Read an active file for GROUPS in METHOD using `gnus-retrieve-groups'."
  1920. (when groups
  1921. (with-current-buffer nntp-server-buffer
  1922. (gnus-check-server method)
  1923. (let ((list-type (gnus-retrieve-groups groups method)))
  1924. (cond ((not list-type)
  1925. (gnus-error
  1926. 1.2 "Cannot read partial active file from %s server."
  1927. (car method)))
  1928. ((eq list-type 'active)
  1929. (gnus-active-to-gnus-format method gnus-active-hashtb nil t))
  1930. (t
  1931. (gnus-groups-to-gnus-format method gnus-active-hashtb t)))))))
  1932. ;; Read an active file and place the results in `gnus-active-hashtb'.
  1933. (defun gnus-active-to-gnus-format (&optional method hashtb ignore-errors
  1934. real-active)
  1935. (unless method
  1936. (setq method gnus-select-method))
  1937. (let ((cur (current-buffer))
  1938. (hashtb (or hashtb
  1939. (if (and gnus-active-hashtb
  1940. (not (equal method gnus-select-method)))
  1941. gnus-active-hashtb
  1942. (setq gnus-active-hashtb
  1943. (if (equal method gnus-select-method)
  1944. (gnus-make-hashtable
  1945. (count-lines (point-min) (point-max)))
  1946. (gnus-make-hashtable 4096))))))
  1947. group max min)
  1948. ;; Delete unnecessary lines.
  1949. (goto-char (point-min))
  1950. (cond
  1951. ((string= gnus-ignored-newsgroups "")
  1952. (delete-matching-lines "^to\\."))
  1953. (t
  1954. (delete-matching-lines (concat "^to\\.\\|" gnus-ignored-newsgroups))))
  1955. (goto-char (point-min))
  1956. (unless (re-search-forward "[\\\"]" nil t)
  1957. ;; Make the group names readable as a lisp expression even if they
  1958. ;; contain special characters.
  1959. (goto-char (point-max))
  1960. (while (re-search-backward "[][';?()#]" nil t)
  1961. (insert ?\\)))
  1962. ;; Let the Gnus agent save the active file.
  1963. (when (and gnus-agent real-active (gnus-online method))
  1964. (gnus-agent-save-active method))
  1965. ;; If these are groups from a foreign select method, we insert the
  1966. ;; group prefix in front of the group names.
  1967. (when (not (gnus-server-equal
  1968. (gnus-server-get-method nil method)
  1969. (gnus-server-get-method nil gnus-select-method)))
  1970. (let ((prefix (gnus-group-prefixed-name "" method)))
  1971. (goto-char (point-min))
  1972. (while (and (not (eobp))
  1973. (progn
  1974. (when (= (following-char) ?\")
  1975. (forward-char 1))
  1976. (insert prefix)
  1977. (zerop (forward-line 1)))))))
  1978. ;; Store the active file in a hash table.
  1979. ;; Use a unibyte buffer in order to make `read' read non-ASCII
  1980. ;; group names (which have been encoded) as unibyte strings.
  1981. (mm-with-unibyte-buffer
  1982. (insert-buffer-substring cur)
  1983. (setq cur (current-buffer))
  1984. (goto-char (point-min))
  1985. (while (not (eobp))
  1986. (condition-case ()
  1987. (progn
  1988. (narrow-to-region (point) (point-at-eol))
  1989. ;; group gets set to a symbol interned in the hash table
  1990. ;; (what a hack!!) - jwz
  1991. (setq group (let ((obarray hashtb)) (read cur)))
  1992. ;; ### The extended group name scheme makes
  1993. ;; the previous optimization strategy sort of pointless...
  1994. (when (stringp group)
  1995. (setq group (intern group hashtb)))
  1996. (if (and (numberp (setq max (read cur)))
  1997. (numberp (setq min (read cur)))
  1998. (progn
  1999. (skip-chars-forward " \t")
  2000. (not
  2001. (or (eq (char-after) ?=)
  2002. (eq (char-after) ?x)
  2003. (eq (char-after) ?j)))))
  2004. (progn
  2005. (set group (cons min max))
  2006. ;; if group is moderated, stick in moderation table
  2007. (when (eq (char-after) ?m)
  2008. (unless gnus-moderated-hashtb
  2009. (setq gnus-moderated-hashtb (gnus-make-hashtable)))
  2010. (gnus-sethash (symbol-name group) t
  2011. gnus-moderated-hashtb)))
  2012. (set group nil)))
  2013. (error
  2014. (and group
  2015. (symbolp group)
  2016. (set group nil))
  2017. (unless ignore-errors
  2018. (gnus-message 3 "Warning - invalid active: %s"
  2019. (buffer-substring
  2020. (point-at-bol) (point-at-eol))))))
  2021. (widen)
  2022. (forward-line 1)))))
  2023. (defun gnus-groups-to-gnus-format (method &optional hashtb real-active)
  2024. ;; Parse a "groups" active file.
  2025. (let ((cur (current-buffer))
  2026. (hashtb (or hashtb
  2027. (if (and method gnus-active-hashtb)
  2028. gnus-active-hashtb
  2029. (setq gnus-active-hashtb
  2030. (gnus-make-hashtable
  2031. (count-lines (point-min) (point-max)))))))
  2032. (prefix (and method
  2033. (not (gnus-server-equal
  2034. (gnus-server-get-method nil method)
  2035. (gnus-server-get-method nil gnus-select-method)))
  2036. (gnus-group-prefixed-name "" method))))
  2037. ;; Let the Gnus agent save the active file.
  2038. (if (and gnus-agent
  2039. real-active
  2040. (gnus-online method)
  2041. (gnus-agent-method-p method))
  2042. (progn
  2043. (gnus-agent-save-active method)
  2044. (gnus-active-to-gnus-format method hashtb nil real-active))
  2045. (goto-char (point-min))
  2046. ;; We split this into to separate loops, one with the prefix
  2047. ;; and one without to speed the reading up somewhat.
  2048. (if prefix
  2049. (let (min max opoint group)
  2050. (while (not (eobp))
  2051. (condition-case ()
  2052. (progn
  2053. (read cur) (read cur)
  2054. (setq min (read cur)
  2055. max (read cur)
  2056. opoint (point))
  2057. (skip-chars-forward " \t")
  2058. (insert prefix)
  2059. (goto-char opoint)
  2060. (set (let ((obarray hashtb)) (read cur))
  2061. (cons min max)))
  2062. (error (and group (symbolp group) (set group nil))))
  2063. (forward-line 1)))
  2064. (let (min max group)
  2065. (while (not (eobp))
  2066. (condition-case ()
  2067. (when (eq (char-after) ?2)
  2068. (read cur) (read cur)
  2069. (setq min (read cur)
  2070. max (read cur))
  2071. (set (setq group (let ((obarray hashtb)) (read cur)))
  2072. (cons min max)))
  2073. (error (and group (symbolp group) (set group nil))))
  2074. (forward-line 1)))))))
  2075. (defun gnus-read-newsrc-file (&optional force)
  2076. "Read startup file.
  2077. If FORCE is non-nil, the .newsrc file is read."
  2078. ;; Reset variables that might be defined in the .newsrc.eld file.
  2079. (let ((variables (remove 'gnus-format-specs gnus-variable-list)))
  2080. (while variables
  2081. (set (car variables) nil)
  2082. (setq variables (cdr variables))))
  2083. (let* ((newsrc-file gnus-current-startup-file)
  2084. (quick-file (concat newsrc-file ".el")))
  2085. (save-excursion
  2086. ;; We always load the .newsrc.eld file. If always contains
  2087. ;; much information that can not be gotten from the .newsrc
  2088. ;; file (ticked articles, killed groups, foreign methods, etc.)
  2089. (gnus-read-newsrc-el-file quick-file)
  2090. (when (and gnus-read-newsrc-file
  2091. (file-exists-p gnus-current-startup-file)
  2092. (or force
  2093. (and (file-newer-than-file-p newsrc-file quick-file)
  2094. (file-newer-than-file-p newsrc-file
  2095. (concat quick-file "d")))
  2096. (not gnus-newsrc-alist)))
  2097. ;; We read the .newsrc file. Note that if there if a
  2098. ;; .newsrc.eld file exists, it has already been read, and
  2099. ;; the `gnus-newsrc-hashtb' has been created. While reading
  2100. ;; the .newsrc file, Gnus will only use the information it
  2101. ;; can find there for changing the data already read -
  2102. ;; i. e., reading the .newsrc file will not trash the data
  2103. ;; already read (except for read articles).
  2104. (save-excursion
  2105. (gnus-message 5 "Reading %s..." newsrc-file)
  2106. (set-buffer (nnheader-find-file-noselect newsrc-file))
  2107. (buffer-disable-undo)
  2108. (gnus-newsrc-to-gnus-format)
  2109. (kill-buffer (current-buffer))
  2110. (gnus-message 5 "Reading %s...done" newsrc-file)))
  2111. ;; Convert old to new.
  2112. (gnus-convert-old-newsrc))))
  2113. (defun gnus-convert-old-newsrc ()
  2114. "Convert old newsrc formats into the current format, if needed."
  2115. (let ((fcv (and gnus-newsrc-file-version
  2116. (gnus-continuum-version gnus-newsrc-file-version)))
  2117. (gcv (gnus-continuum-version)))
  2118. (when fcv
  2119. ;; A newsrc file was loaded.
  2120. (let (prompt-displayed
  2121. (converters
  2122. (sort
  2123. (mapcar (lambda (date-func)
  2124. (cons (gnus-continuum-version (car date-func))
  2125. date-func))
  2126. ;; This is a list of converters that must be run
  2127. ;; to bring the newsrc file up to the current
  2128. ;; version. If you create an incompatibility
  2129. ;; with older versions, you should create an
  2130. ;; entry here. The entry should consist of the
  2131. ;; current gnus version (hardcoded so that it
  2132. ;; doesn't change with each release) and the
  2133. ;; function that must be applied to convert the
  2134. ;; previous version into the current version.
  2135. '(("September Gnus v0.1" nil
  2136. gnus-convert-old-ticks)
  2137. ("Oort Gnus v0.08" "legacy-gnus-agent"
  2138. gnus-agent-convert-to-compressed-agentview)
  2139. ("Gnus v5.10.7" "legacy-gnus-agent"
  2140. gnus-agent-unlist-expire-days)
  2141. ("Gnus v5.10.7" "legacy-gnus-agent"
  2142. gnus-agent-unhook-expire-days)))
  2143. #'car-less-than-car)))
  2144. ;; Skip converters older than the file version
  2145. (while (and converters (>= fcv (caar converters)))
  2146. (pop converters))
  2147. ;; Perform converters to bring older version up to date.
  2148. (when (and converters (< fcv (caar converters)))
  2149. (while (and converters (< fcv (caar converters))
  2150. (<= (caar converters) gcv))
  2151. (let* ((converter-spec (pop converters))
  2152. (convert-to (nth 1 converter-spec))
  2153. (load-from (nth 2 converter-spec))
  2154. (func (nth 3 converter-spec)))
  2155. (when (and load-from
  2156. (not (fboundp func)))
  2157. (load load-from t))
  2158. (or prompt-displayed
  2159. (not (gnus-convert-converter-needs-prompt func))
  2160. (while (let (c
  2161. (cursor-in-echo-area t)
  2162. (echo-keystrokes 0))
  2163. (message "Convert gnus from version '%s' to '%s'? (n/y/?)"
  2164. gnus-newsrc-file-version gnus-version)
  2165. (setq c (read-char-exclusive))
  2166. (cond ((or (eq c ?n) (eq c ?N))
  2167. (error "Can not start gnus without converting"))
  2168. ((or (eq c ?y) (eq c ?Y))
  2169. (setq prompt-displayed t)
  2170. nil)
  2171. ((eq c ?\?)
  2172. (message "This conversion is irreversible. \
  2173. To be safe, you should backup your files before proceeding.")
  2174. (sit-for 5)
  2175. t)
  2176. (t
  2177. (gnus-message 3 "Ignoring unexpected input")
  2178. (sit-for 3)
  2179. t)))))
  2180. (funcall func convert-to)))
  2181. (gnus-dribble-enter
  2182. (format ";Converted gnus from version '%s' to '%s'."
  2183. gnus-newsrc-file-version gnus-version)))))))
  2184. (defun gnus-convert-mark-converter-prompt (converter no-prompt)
  2185. "Indicate whether CONVERTER requires gnus-convert-old-newsrc to
  2186. display the conversion prompt. NO-PROMPT may be nil (prompt),
  2187. t (no prompt), or any form that can be called as a function.
  2188. The form should return either t or nil."
  2189. (put converter 'gnus-convert-no-prompt no-prompt))
  2190. (defun gnus-convert-converter-needs-prompt (converter)
  2191. (let ((no-prompt (get converter 'gnus-convert-no-prompt)))
  2192. (not (if (memq no-prompt '(t nil))
  2193. no-prompt
  2194. (funcall no-prompt)))))
  2195. (defun gnus-convert-old-ticks (converting-to)
  2196. (let ((newsrc (cdr gnus-newsrc-alist))
  2197. marks info dormant ticked)
  2198. (while (setq info (pop newsrc))
  2199. (when (setq marks (gnus-info-marks info))
  2200. (setq dormant (cdr (assq 'dormant marks))
  2201. ticked (cdr (assq 'tick marks)))
  2202. (when (or dormant ticked)
  2203. (gnus-info-set-read
  2204. info
  2205. (gnus-add-to-range
  2206. (gnus-info-read info)
  2207. (nconc (gnus-uncompress-range dormant)
  2208. (gnus-uncompress-range ticked)))))))))
  2209. (defun gnus-load (file)
  2210. "Load FILE, but in such a way that read errors can be reported."
  2211. (with-temp-buffer
  2212. (insert-file-contents file)
  2213. (while (not (eobp))
  2214. (condition-case type
  2215. (let ((form (read (current-buffer))))
  2216. (eval form))
  2217. (error
  2218. (unless (eq (car type) 'end-of-file)
  2219. (let ((errmsg (format "Error in %s line %d" file
  2220. (count-lines (point-min) (point)))))
  2221. (ding)
  2222. (unless (gnus-yes-or-no-p (concat errmsg "; continue? "))
  2223. (error "%s" errmsg)))))))))
  2224. (defun gnus-read-newsrc-el-file (file)
  2225. (let ((ding-file (concat file "d")))
  2226. (when (file-exists-p ding-file)
  2227. ;; We always, always read the .eld file.
  2228. (gnus-message 5 "Reading %s..." ding-file)
  2229. (let (gnus-newsrc-assoc)
  2230. (gnus-load ding-file)
  2231. ;; Older versions of `gnus-format-specs' are no longer valid
  2232. ;; in Oort Gnus 0.01.
  2233. (let ((version
  2234. (and gnus-newsrc-file-version
  2235. (gnus-continuum-version gnus-newsrc-file-version))))
  2236. (when (or (not version)
  2237. (< version 5.090009))
  2238. (setq gnus-format-specs gnus-default-format-specs)))
  2239. (when gnus-newsrc-assoc
  2240. (setq gnus-newsrc-alist gnus-newsrc-assoc))))
  2241. (dolist (elem gnus-newsrc-alist)
  2242. ;; Protect against broken .newsrc.el files.
  2243. (when (car elem)
  2244. (setcar elem (mm-string-as-unibyte (car elem)))))
  2245. (gnus-make-hashtable-from-newsrc-alist)
  2246. (when (file-newer-than-file-p file ding-file)
  2247. ;; Old format quick file
  2248. (gnus-message 5 "Reading %s..." file)
  2249. ;; The .el file is newer than the .eld file, so we read that one
  2250. ;; as well.
  2251. (gnus-read-old-newsrc-el-file file)))
  2252. (gnus-run-hooks 'gnus-read-newsrc-el-hook))
  2253. ;; Parse the old-style quick startup file
  2254. (defun gnus-read-old-newsrc-el-file (file)
  2255. (let (newsrc killed marked group m info)
  2256. (prog1
  2257. (let ((gnus-killed-assoc nil)
  2258. gnus-marked-assoc gnus-newsrc-alist gnus-newsrc-assoc)
  2259. (prog1
  2260. (ignore-errors
  2261. (load file t t t))
  2262. (setq newsrc gnus-newsrc-assoc
  2263. killed gnus-killed-assoc
  2264. marked gnus-marked-assoc)))
  2265. (setq gnus-newsrc-alist nil)
  2266. (while (setq group (pop newsrc))
  2267. (if (setq info (gnus-get-info (car group)))
  2268. (progn
  2269. (gnus-info-set-read info (cddr group))
  2270. (gnus-info-set-level
  2271. info (if (nth 1 group) gnus-level-default-subscribed
  2272. gnus-level-default-unsubscribed))
  2273. (push info gnus-newsrc-alist))
  2274. (push (setq info
  2275. (list (car group)
  2276. (if (nth 1 group) gnus-level-default-subscribed
  2277. gnus-level-default-unsubscribed)
  2278. (cddr group)))
  2279. gnus-newsrc-alist))
  2280. ;; Copy marks into info.
  2281. (when (setq m (assoc (car group) marked))
  2282. (unless (nthcdr 3 info)
  2283. (nconc info (list nil)))
  2284. (gnus-info-set-marks
  2285. info (list (cons 'tick (gnus-compress-sequence
  2286. (sort (cdr m) '<) t))))))
  2287. (setq newsrc killed)
  2288. (while newsrc
  2289. (setcar newsrc (caar newsrc))
  2290. (setq newsrc (cdr newsrc)))
  2291. (setq gnus-killed-list killed))
  2292. ;; The .el file version of this variable does not begin with
  2293. ;; "options", while the .eld version does, so we just add it if it
  2294. ;; isn't there.
  2295. (when
  2296. gnus-newsrc-options
  2297. (when (not (string-match "^ *options" gnus-newsrc-options))
  2298. (setq gnus-newsrc-options (concat "options " gnus-newsrc-options)))
  2299. (when (not (string-match "\n$" gnus-newsrc-options))
  2300. (setq gnus-newsrc-options (concat gnus-newsrc-options "\n")))
  2301. ;; Finally, if we read some options lines, we parse them.
  2302. (unless (string= gnus-newsrc-options "")
  2303. (gnus-newsrc-parse-options gnus-newsrc-options)))
  2304. (setq gnus-newsrc-alist (nreverse gnus-newsrc-alist))
  2305. (gnus-make-hashtable-from-newsrc-alist)))
  2306. (defun gnus-make-newsrc-file (file)
  2307. "Make server dependent file name by catenating FILE and server host name."
  2308. (let* ((file (expand-file-name file nil))
  2309. (real-file (concat file "-" (nth 1 gnus-select-method))))
  2310. (if (or (file-exists-p real-file)
  2311. (file-exists-p (concat real-file ".el"))
  2312. (file-exists-p (concat real-file ".eld")))
  2313. real-file
  2314. file)))
  2315. (defun gnus-newsrc-to-gnus-format ()
  2316. (setq gnus-newsrc-options "")
  2317. (setq gnus-newsrc-options-n nil)
  2318. (unless gnus-active-hashtb
  2319. (setq gnus-active-hashtb (gnus-make-hashtable 4096)))
  2320. (let ((buf (current-buffer))
  2321. (already-read (> (length gnus-newsrc-alist) 1))
  2322. group subscribed options-symbol newsrc Options-symbol
  2323. symbol reads num1)
  2324. (goto-char (point-min))
  2325. ;; We intern the symbol `options' in the active hashtb so that we
  2326. ;; can `eq' against it later.
  2327. (set (setq options-symbol (intern "options" gnus-active-hashtb)) nil)
  2328. (set (setq Options-symbol (intern "Options" gnus-active-hashtb)) nil)
  2329. (while (not (eobp))
  2330. ;; We first read the first word on the line by narrowing and
  2331. ;; then reading into `gnus-active-hashtb'. Most groups will
  2332. ;; already exist in that hashtb, so this will save some string
  2333. ;; space.
  2334. (narrow-to-region
  2335. (point)
  2336. (progn (skip-chars-forward "^ \t!:\n") (point)))
  2337. (goto-char (point-min))
  2338. (setq symbol
  2339. (and (/= (point-min) (point-max))
  2340. (let ((obarray gnus-active-hashtb)) (read buf))))
  2341. (widen)
  2342. ;; Now, the symbol we have read is either `options' or a group
  2343. ;; name. If it is an options line, we just add it to a string.
  2344. (cond
  2345. ((or (eq symbol options-symbol)
  2346. (eq symbol Options-symbol))
  2347. (setq gnus-newsrc-options
  2348. ;; This concatting is quite inefficient, but since our
  2349. ;; thorough studies show that approx 99.37% of all
  2350. ;; .newsrc files only contain a single options line, we
  2351. ;; don't give a damn, frankly, my dear.
  2352. (concat gnus-newsrc-options
  2353. (buffer-substring
  2354. (point-at-bol)
  2355. ;; Options may continue on the next line.
  2356. (or (and (re-search-forward "^[^ \t]" nil 'move)
  2357. (point-at-bol))
  2358. (point)))))
  2359. (forward-line -1))
  2360. (symbol
  2361. ;; Group names can be just numbers.
  2362. (when (numberp symbol)
  2363. (setq symbol (intern (int-to-string symbol) gnus-active-hashtb)))
  2364. (unless (boundp symbol)
  2365. (set symbol nil))
  2366. ;; It was a group name.
  2367. (setq subscribed (eq (char-after) ?:)
  2368. group (symbol-name symbol)
  2369. reads nil)
  2370. (if (eolp)
  2371. ;; If the line ends here, this is clearly a buggy line, so
  2372. ;; we put point a the beginning of line and let the cond
  2373. ;; below do the error handling.
  2374. (beginning-of-line)
  2375. ;; We skip to the beginning of the ranges.
  2376. (skip-chars-forward "!: \t"))
  2377. ;; We are now at the beginning of the list of read articles.
  2378. ;; We read them range by range.
  2379. (while
  2380. (cond
  2381. ((looking-at "[0-9]+")
  2382. ;; We narrow and read a number instead of buffer-substring/
  2383. ;; string-to-number because it's faster. narrow/widen is
  2384. ;; faster than save-restriction/narrow, and save-restriction
  2385. ;; produces a garbage object.
  2386. (setq num1 (progn
  2387. (narrow-to-region (match-beginning 0) (match-end 0))
  2388. (read buf)))
  2389. (widen)
  2390. ;; If the next character is a dash, then this is a range.
  2391. (if (eq (char-after) ?-)
  2392. (progn
  2393. ;; We read the upper bound of the range.
  2394. (forward-char 1)
  2395. (if (not (looking-at "[0-9]+"))
  2396. ;; This is a buggy line, by we pretend that
  2397. ;; it's kinda OK. Perhaps the user should be
  2398. ;; dinged?
  2399. (push num1 reads)
  2400. (push
  2401. (cons num1
  2402. (progn
  2403. (narrow-to-region (match-beginning 0)
  2404. (match-end 0))
  2405. (read buf)))
  2406. reads)
  2407. (widen)))
  2408. ;; It was just a simple number, so we add it to the
  2409. ;; list of ranges.
  2410. (push num1 reads))
  2411. ;; If the next char in ?\n, then we have reached the end
  2412. ;; of the line and return nil.
  2413. (not (eq (char-after) ?\n)))
  2414. ((eq (char-after) ?\n)
  2415. ;; End of line, so we end.
  2416. nil)
  2417. (t
  2418. ;; Not numbers and not eol, so this might be a buggy
  2419. ;; line...
  2420. (unless (eobp)
  2421. ;; If it was eob instead of ?\n, we allow it.
  2422. ;; The line was buggy.
  2423. (setq group nil)
  2424. (gnus-error 3.1 "Mangled line: %s"
  2425. (buffer-substring (point-at-bol)
  2426. (point-at-eol))))
  2427. nil))
  2428. ;; Skip past ", ". Spaces are invalid in these ranges, but
  2429. ;; we allow them, because it's a common mistake to put a
  2430. ;; space after the comma.
  2431. (skip-chars-forward ", "))
  2432. ;; We have already read .newsrc.eld, so we gently update the
  2433. ;; data in the hash table with the information we have just
  2434. ;; read.
  2435. (when group
  2436. (let ((info (gnus-get-info group))
  2437. level)
  2438. (if info
  2439. ;; There is an entry for this file in the alist.
  2440. (progn
  2441. (gnus-info-set-read info (nreverse reads))
  2442. ;; We update the level very gently. In fact, we
  2443. ;; only change it if there's been a status change
  2444. ;; from subscribed to unsubscribed, or vice versa.
  2445. (setq level (gnus-info-level info))
  2446. (cond ((and (<= level gnus-level-subscribed)
  2447. (not subscribed))
  2448. (setq level (if reads
  2449. gnus-level-default-unsubscribed
  2450. (1+ gnus-level-default-unsubscribed))))
  2451. ((and (> level gnus-level-subscribed) subscribed)
  2452. (setq level gnus-level-default-subscribed)))
  2453. (gnus-info-set-level info level))
  2454. ;; This is a new group.
  2455. (setq info (list group
  2456. (if subscribed
  2457. gnus-level-default-subscribed
  2458. (if reads
  2459. (1+ gnus-level-subscribed)
  2460. gnus-level-default-unsubscribed))
  2461. (nreverse reads))))
  2462. (push info newsrc)))))
  2463. (forward-line 1))
  2464. (setq newsrc (nreverse newsrc))
  2465. (if (not already-read)
  2466. ()
  2467. ;; We now have two newsrc lists - `newsrc', which is what we
  2468. ;; have read from .newsrc, and `gnus-newsrc-alist', which is
  2469. ;; what we've read from .newsrc.eld. We have to merge these
  2470. ;; lists. We do this by "attaching" any (foreign) groups in the
  2471. ;; gnus-newsrc-alist to the (native) group that precedes them.
  2472. (let ((rc (cdr gnus-newsrc-alist))
  2473. (prev gnus-newsrc-alist)
  2474. entry mentry)
  2475. (while rc
  2476. (or (null (nth 4 (car rc))) ; It's a native group.
  2477. (assoc (caar rc) newsrc) ; It's already in the alist.
  2478. (if (setq entry (assoc (caar prev) newsrc))
  2479. (setcdr (setq mentry (memq entry newsrc))
  2480. (cons (car rc) (cdr mentry)))
  2481. (push (car rc) newsrc)))
  2482. (setq prev rc
  2483. rc (cdr rc)))))
  2484. (setq gnus-newsrc-alist newsrc)
  2485. ;; We make the newsrc hashtb.
  2486. (gnus-make-hashtable-from-newsrc-alist)
  2487. ;; Finally, if we read some options lines, we parse them.
  2488. (unless (string= gnus-newsrc-options "")
  2489. (gnus-newsrc-parse-options gnus-newsrc-options))))
  2490. ;; Parse options lines to find "options -n !all rec.all" and stuff.
  2491. ;; The return value will be a list on the form
  2492. ;; ((regexp1 . ignore)
  2493. ;; (regexp2 . subscribe)...)
  2494. ;; When handling new newsgroups, groups that match a `ignore' regexp
  2495. ;; will be ignored, and groups that match a `subscribe' regexp will be
  2496. ;; subscribed. A line like
  2497. ;; options -n !all rec.all
  2498. ;; will lead to a list that looks like
  2499. ;; (("^rec\\..+" . subscribe)
  2500. ;; ("^.+" . ignore))
  2501. ;; So all "rec.*" groups will be subscribed, while all the other
  2502. ;; groups will be ignored. Note that "options -n !all rec.all" is very
  2503. ;; different from "options -n rec.all !all".
  2504. (defun gnus-newsrc-parse-options (options)
  2505. (let (out eol)
  2506. (save-excursion
  2507. (gnus-set-work-buffer)
  2508. (insert (regexp-quote options))
  2509. ;; First we treat all continuation lines.
  2510. (goto-char (point-min))
  2511. (while (re-search-forward "\n[ \t]+" nil t)
  2512. (replace-match " " t t))
  2513. ;; Then we transform all "all"s into ".+"s.
  2514. (goto-char (point-min))
  2515. (while (re-search-forward "\\ball\\b" nil t)
  2516. (replace-match ".+" t t))
  2517. (goto-char (point-min))
  2518. ;; We remove all other options than the "-n" ones.
  2519. (while (re-search-forward "[ \t]-[^n][^-]*" nil t)
  2520. (replace-match " ")
  2521. (forward-char -1))
  2522. (goto-char (point-min))
  2523. ;; We are only interested in "options -n" lines - we
  2524. ;; ignore the other option lines.
  2525. (while (re-search-forward "[ \t]-n" nil t)
  2526. (setq eol
  2527. (or (save-excursion
  2528. (and (re-search-forward "[ \t]-n" (point-at-eol) t)
  2529. (- (point) 2)))
  2530. (point-at-eol)))
  2531. ;; Search for all "words"...
  2532. (while (re-search-forward "[^ \t,\n]+" eol t)
  2533. (if (eq (char-after (match-beginning 0)) ?!)
  2534. ;; If the word begins with a bang (!), this is a "not"
  2535. ;; spec. We put this spec (minus the bang) and the
  2536. ;; symbol `ignore' into the list.
  2537. (push (cons (concat
  2538. "^" (buffer-substring
  2539. (1+ (match-beginning 0))
  2540. (match-end 0))
  2541. "\\($\\|\\.\\)")
  2542. 'ignore)
  2543. out)
  2544. ;; There was no bang, so this is a "yes" spec.
  2545. (push (cons (concat "^" (match-string 0) "\\($\\|\\.\\)")
  2546. 'subscribe)
  2547. out))))
  2548. (setq gnus-newsrc-options-n out))))
  2549. (eval-and-compile
  2550. (defalias 'gnus-long-file-names
  2551. (if (fboundp 'msdos-long-file-names)
  2552. 'msdos-long-file-names
  2553. (lambda () t))))
  2554. (defun gnus-save-newsrc-file (&optional force)
  2555. "Save .newsrc file."
  2556. ;; Note: We cannot save .newsrc file if all newsgroups are removed
  2557. ;; from the variable gnus-newsrc-alist.
  2558. (when (and (or gnus-newsrc-alist gnus-killed-list)
  2559. gnus-current-startup-file)
  2560. ;; Save agent range limits for the currently active method.
  2561. (when gnus-agent
  2562. (gnus-agent-save-local force))
  2563. (save-excursion
  2564. (if (and (or gnus-use-dribble-file gnus-slave)
  2565. (not force)
  2566. (or (not gnus-dribble-buffer)
  2567. (not (buffer-name gnus-dribble-buffer))
  2568. (zerop (with-current-buffer gnus-dribble-buffer
  2569. (buffer-size)))))
  2570. (gnus-message 4 "(No changes need to be saved)")
  2571. (gnus-run-hooks 'gnus-save-newsrc-hook)
  2572. (if gnus-slave
  2573. (gnus-slave-save-newsrc)
  2574. ;; Save .newsrc.
  2575. (when gnus-save-newsrc-file
  2576. (gnus-message 8 "Saving %s..." gnus-current-startup-file)
  2577. (gnus-gnus-to-newsrc-format)
  2578. (gnus-message 8 "Saving %s...done" gnus-current-startup-file))
  2579. ;; Save .newsrc.eld.
  2580. (set-buffer (gnus-get-buffer-create " *Gnus-newsrc*"))
  2581. (make-local-variable 'version-control)
  2582. (setq version-control gnus-backup-startup-file)
  2583. (setq buffer-file-name
  2584. (concat gnus-current-startup-file ".eld"))
  2585. (setq default-directory (file-name-directory buffer-file-name))
  2586. (buffer-disable-undo)
  2587. (erase-buffer)
  2588. (gnus-message 5 "Saving %s.eld..." gnus-current-startup-file)
  2589. (if gnus-save-startup-file-via-temp-buffer
  2590. (let ((coding-system-for-write gnus-ding-file-coding-system)
  2591. (standard-output (current-buffer)))
  2592. (gnus-gnus-to-quick-newsrc-format)
  2593. (gnus-run-hooks 'gnus-save-quick-newsrc-hook)
  2594. (save-buffer))
  2595. (let ((coding-system-for-write gnus-ding-file-coding-system)
  2596. (version-control gnus-backup-startup-file)
  2597. (startup-file (concat gnus-current-startup-file ".eld"))
  2598. (working-dir (file-name-directory gnus-current-startup-file))
  2599. working-file
  2600. (i -1))
  2601. ;; Generate the name of a non-existent file.
  2602. (while (progn (setq working-file
  2603. (format
  2604. (if (and (eq system-type 'ms-dos)
  2605. (not (gnus-long-file-names)))
  2606. "%s#%d.tm#" ; MSDOS limits files to 8+3
  2607. "%s#tmp#%d")
  2608. working-dir (setq i (1+ i))))
  2609. (file-exists-p working-file)))
  2610. (unwind-protect
  2611. (progn
  2612. (gnus-with-output-to-file working-file
  2613. (gnus-gnus-to-quick-newsrc-format)
  2614. (gnus-run-hooks 'gnus-save-quick-newsrc-hook))
  2615. ;; These bindings will mislead the current buffer
  2616. ;; into thinking that it is visiting the startup
  2617. ;; file.
  2618. (let ((buffer-backed-up nil)
  2619. (buffer-file-name startup-file)
  2620. (file-precious-flag t)
  2621. (setmodes (file-modes startup-file)))
  2622. ;; Backup the current version of the startup file.
  2623. (backup-buffer)
  2624. ;; Replace the existing startup file with the temp file.
  2625. (rename-file working-file startup-file t)
  2626. (gnus-set-file-modes startup-file setmodes)))
  2627. (condition-case nil
  2628. (delete-file working-file)
  2629. (file-error nil)))))
  2630. (gnus-kill-buffer (current-buffer))
  2631. (gnus-message
  2632. 5 "Saving %s.eld...done" gnus-current-startup-file))
  2633. (gnus-dribble-delete-file)
  2634. (gnus-group-set-mode-line)))))
  2635. (defun gnus-gnus-to-quick-newsrc-format (&optional minimal name &rest specific-variables)
  2636. "Print Gnus variables such as `gnus-newsrc-alist' in Lisp format."
  2637. (princ (format ";; -*- mode:emacs-lisp; coding: %s; -*-\n"
  2638. gnus-ding-file-coding-system))
  2639. (if name
  2640. (princ (format ";; %s\n" name))
  2641. (princ ";; Gnus startup file.\n"))
  2642. (unless minimal
  2643. (princ "\
  2644. ;; Never delete this file -- if you want to force Gnus to read the
  2645. ;; .newsrc file (if you have one), touch .newsrc instead.\n")
  2646. (princ "(setq gnus-newsrc-file-version ")
  2647. (princ (gnus-prin1-to-string gnus-version))
  2648. (princ ")\n"))
  2649. (let* ((print-quoted t)
  2650. (print-readably t)
  2651. (print-escape-multibyte nil)
  2652. (print-escape-nonascii t)
  2653. (print-length nil)
  2654. (print-level nil)
  2655. (print-circle nil)
  2656. (print-escape-newlines t)
  2657. (gnus-killed-list
  2658. (if (and gnus-save-killed-list
  2659. (stringp gnus-save-killed-list))
  2660. (gnus-strip-killed-list)
  2661. gnus-killed-list))
  2662. (variables
  2663. (or specific-variables
  2664. (if gnus-save-killed-list gnus-variable-list
  2665. ;; Remove the `gnus-killed-list' from the list of variables
  2666. ;; to be saved, if required.
  2667. (delq 'gnus-killed-list (copy-sequence gnus-variable-list)))))
  2668. ;; Peel off the "dummy" group.
  2669. (gnus-newsrc-alist (cdr gnus-newsrc-alist))
  2670. variable)
  2671. ;; Insert the variables into the file.
  2672. (while variables
  2673. (when (and (boundp (setq variable (pop variables)))
  2674. (symbol-value variable))
  2675. (princ "\n(setq ")
  2676. (princ (symbol-name variable))
  2677. (princ " '")
  2678. (prin1 (symbol-value variable))
  2679. (princ ")\n")))))
  2680. (defun gnus-strip-killed-list ()
  2681. "Return the killed list minus the groups that match `gnus-save-killed-list'."
  2682. (let ((list gnus-killed-list)
  2683. olist)
  2684. (while list
  2685. (when (string-match gnus-save-killed-list (car list))
  2686. (push (car list) olist))
  2687. (pop list))
  2688. (nreverse olist)))
  2689. (defun gnus-gnus-to-newsrc-format (&optional foreign-ok)
  2690. (interactive (list (gnus-y-or-n-p "write foreign groups too? ")))
  2691. ;; Generate and save the .newsrc file.
  2692. (with-current-buffer (create-file-buffer gnus-current-startup-file)
  2693. (let ((newsrc (cdr gnus-newsrc-alist))
  2694. (standard-output (current-buffer))
  2695. info ranges range method)
  2696. (setq buffer-file-name gnus-current-startup-file)
  2697. (setq default-directory (file-name-directory buffer-file-name))
  2698. (buffer-disable-undo)
  2699. (erase-buffer)
  2700. ;; Use a unibyte buffer since group names are unibyte strings;
  2701. ;; in particular, non-ASCII group names are the ones encoded by
  2702. ;; a certain coding system.
  2703. (mm-disable-multibyte)
  2704. ;; Write options.
  2705. (when gnus-newsrc-options
  2706. (insert gnus-newsrc-options))
  2707. ;; Write subscribed and unsubscribed.
  2708. (while (setq info (pop newsrc))
  2709. ;; Don't write foreign groups to .newsrc.
  2710. (when (or (null (setq method (gnus-info-method info)))
  2711. (equal method "native")
  2712. (inline (gnus-server-equal method gnus-select-method))
  2713. foreign-ok)
  2714. (insert (gnus-info-group info)
  2715. (if (> (gnus-info-level info) gnus-level-subscribed)
  2716. "!" ":"))
  2717. (when (setq ranges (gnus-info-read info))
  2718. (insert " ")
  2719. (if (not (listp (cdr ranges)))
  2720. (if (= (car ranges) (cdr ranges))
  2721. (princ (car ranges))
  2722. (princ (car ranges))
  2723. (insert "-")
  2724. (princ (cdr ranges)))
  2725. (while (setq range (pop ranges))
  2726. (if (or (atom range) (= (car range) (cdr range)))
  2727. (princ (or (and (atom range) range) (car range)))
  2728. (princ (car range))
  2729. (insert "-")
  2730. (princ (cdr range)))
  2731. (when ranges
  2732. (insert ",")))))
  2733. (insert "\n")))
  2734. (make-local-variable 'version-control)
  2735. (setq version-control 'never)
  2736. ;; It has been reported that sometime the modtime on the .newsrc
  2737. ;; file seems to be off. We really do want to overwrite it, so
  2738. ;; we clear the modtime here before saving. It's a bit odd,
  2739. ;; though...
  2740. ;; sometimes the modtime clear isn't sufficient. most brute force:
  2741. ;; delete the silly thing entirely first. but this fails to provide
  2742. ;; such niceties as .newsrc~ creation.
  2743. (if gnus-modtime-botch
  2744. (delete-file gnus-startup-file)
  2745. (clear-visited-file-modtime))
  2746. (gnus-run-hooks 'gnus-save-standard-newsrc-hook)
  2747. (let ((coding-system-for-write 'raw-text))
  2748. (save-buffer))
  2749. (kill-buffer (current-buffer)))))
  2750. ;;;
  2751. ;;; Slave functions.
  2752. ;;;
  2753. (defvar gnus-slave-mode nil)
  2754. (defun gnus-slave-mode ()
  2755. "Minor mode for slave Gnusae."
  2756. ;; FIXME: gnus-slave-mode appears to never be set (i.e. it'll always be nil):
  2757. ;; Remove, or fix and use define-minor-mode.
  2758. (add-minor-mode 'gnus-slave-mode " Slave" (make-sparse-keymap))
  2759. (gnus-run-hooks 'gnus-slave-mode-hook))
  2760. (defun gnus-slave-save-newsrc ()
  2761. (with-current-buffer gnus-dribble-buffer
  2762. (let ((slave-name
  2763. (mm-make-temp-file (concat gnus-current-startup-file "-slave-")))
  2764. (modes (ignore-errors
  2765. (file-modes (concat gnus-current-startup-file ".eld")))))
  2766. (let ((coding-system-for-write gnus-ding-file-coding-system))
  2767. (gnus-write-buffer slave-name))
  2768. (when modes
  2769. (gnus-set-file-modes slave-name modes)))))
  2770. (defun gnus-master-read-slave-newsrc ()
  2771. (let ((slave-files
  2772. (directory-files
  2773. (file-name-directory gnus-current-startup-file)
  2774. t (concat
  2775. "^" (regexp-quote
  2776. (concat
  2777. (file-name-nondirectory gnus-current-startup-file)
  2778. "-slave-")))
  2779. t))
  2780. file)
  2781. (if (not slave-files)
  2782. () ; There are no slave files to read.
  2783. (gnus-message 7 "Reading slave newsrcs...")
  2784. (with-current-buffer (gnus-get-buffer-create " *gnus slave*")
  2785. (setq slave-files
  2786. (sort (mapcar (lambda (file)
  2787. (list (nth 5 (file-attributes file)) file))
  2788. slave-files)
  2789. (lambda (f1 f2)
  2790. (or (< (caar f1) (caar f2))
  2791. (< (nth 1 (car f1)) (nth 1 (car f2)))))))
  2792. (while slave-files
  2793. (erase-buffer)
  2794. (setq file (nth 1 (car slave-files)))
  2795. (nnheader-insert-file-contents file)
  2796. (when (condition-case ()
  2797. (progn
  2798. (eval-buffer (current-buffer))
  2799. t)
  2800. (error
  2801. (gnus-error 3.2 "Possible error in %s" file)
  2802. nil))
  2803. (unless gnus-slave ; Slaves shouldn't delete these files.
  2804. (ignore-errors
  2805. (delete-file file))))
  2806. (setq slave-files (cdr slave-files))))
  2807. (gnus-dribble-touch)
  2808. (gnus-message 7 "Reading slave newsrcs...done"))))
  2809. ;;;
  2810. ;;; Group description.
  2811. ;;;
  2812. (defun gnus-read-all-descriptions-files ()
  2813. (let ((methods (cons gnus-select-method
  2814. (nconc
  2815. (when (gnus-archive-server-wanted-p)
  2816. (list "archive"))
  2817. gnus-secondary-select-methods))))
  2818. (while methods
  2819. (gnus-read-descriptions-file (car methods))
  2820. (setq methods (cdr methods)))
  2821. t))
  2822. (defun gnus-read-descriptions-file (&optional method)
  2823. (let ((method (or method gnus-select-method))
  2824. group)
  2825. (when (stringp method)
  2826. (setq method (gnus-server-to-method method)))
  2827. ;; We create the hashtable whether we manage to read the desc file
  2828. ;; to avoid trying to re-read after a failed read.
  2829. (unless gnus-description-hashtb
  2830. (setq gnus-description-hashtb
  2831. (gnus-make-hashtable (length gnus-active-hashtb))))
  2832. ;; Mark this method's desc file as read.
  2833. (gnus-sethash (gnus-group-prefixed-name "" method) "Has read"
  2834. gnus-description-hashtb)
  2835. (gnus-message 5 "Reading descriptions file via %s..." (car method))
  2836. (cond
  2837. ((null (gnus-get-function method 'request-list-newsgroups t))
  2838. t)
  2839. ((not (gnus-check-server method))
  2840. (gnus-message 1 "Couldn't open server")
  2841. nil)
  2842. ((not (gnus-request-list-newsgroups method))
  2843. (gnus-message 1 "Couldn't read newsgroups descriptions")
  2844. nil)
  2845. (t
  2846. (save-excursion
  2847. ;; FIXME: Shouldn't save-restriction be done after set-buffer?
  2848. (save-restriction
  2849. (set-buffer nntp-server-buffer)
  2850. (goto-char (point-min))
  2851. (when (or (search-forward "\n.\n" nil t)
  2852. (goto-char (point-max)))
  2853. (beginning-of-line)
  2854. (narrow-to-region (point-min) (point)))
  2855. ;; If these are groups from a foreign select method, we insert the
  2856. ;; group prefix in front of the group names.
  2857. (and method (not (inline
  2858. (gnus-server-equal
  2859. (gnus-server-get-method nil method)
  2860. (gnus-server-get-method
  2861. nil gnus-select-method))))
  2862. (let ((prefix (gnus-group-prefixed-name "" method)))
  2863. (goto-char (point-min))
  2864. (while (and (not (eobp))
  2865. (progn (insert prefix)
  2866. (zerop (forward-line 1)))))))
  2867. (goto-char (point-min))
  2868. (while (not (eobp))
  2869. ;; If we get an error, we set group to 0, which is not a
  2870. ;; symbol...
  2871. (setq group
  2872. (condition-case ()
  2873. (let ((obarray gnus-description-hashtb))
  2874. ;; Group is set to a symbol interned in this
  2875. ;; hash table.
  2876. (read nntp-server-buffer))
  2877. (error 0)))
  2878. (skip-chars-forward " \t")
  2879. ;; ... which leads to this line being effectively ignored.
  2880. (when (symbolp group)
  2881. (let* ((str (buffer-substring
  2882. (point) (progn (end-of-line) (point))))
  2883. (name (symbol-name group))
  2884. (charset
  2885. (or (gnus-group-name-charset method name)
  2886. (gnus-parameter-charset name)
  2887. gnus-default-charset)))
  2888. ;; Fixme: Don't decode in unibyte mode.
  2889. (when (and str charset (featurep 'mule))
  2890. (setq str (mm-decode-coding-string str charset)))
  2891. (set group str)))
  2892. (forward-line 1))))
  2893. (gnus-message 5 "Reading descriptions file...done")
  2894. t))))
  2895. (defun gnus-group-get-description (group)
  2896. "Get the description of a group by sending XGTITLE to the server."
  2897. (when (gnus-request-group-description group)
  2898. (with-current-buffer nntp-server-buffer
  2899. (goto-char (point-min))
  2900. (when (looking-at "[^ \t]+[ \t]+\\(.*\\)")
  2901. (match-string 1)))))
  2902. ;;;###autoload
  2903. (defun gnus-declare-backend (name &rest abilities)
  2904. "Declare back end NAME with ABILITIES as a Gnus back end."
  2905. (setq gnus-valid-select-methods
  2906. (nconc gnus-valid-select-methods
  2907. (list (apply 'list name abilities))))
  2908. (gnus-redefine-select-method-widget))
  2909. (defun gnus-set-default-directory ()
  2910. "Set the default directory in the current buffer to `gnus-default-directory'.
  2911. If this variable is nil, don't do anything."
  2912. (setq default-directory
  2913. (if (and gnus-default-directory
  2914. (file-exists-p gnus-default-directory))
  2915. (file-name-as-directory (expand-file-name gnus-default-directory))
  2916. default-directory)))
  2917. (defun gnus-display-time-event-handler ()
  2918. (if (and (fboundp 'display-time-event-handler)
  2919. (gnus-boundp 'display-time-timer))
  2920. (display-time-event-handler)))
  2921. (defun gnus-check-reasonable-setup ()
  2922. ;; Check whether nnml and nnfolder share a directory.
  2923. (let ((display-warn
  2924. (if (fboundp 'display-warning)
  2925. 'display-warning
  2926. (lambda (type message)
  2927. (if noninteractive
  2928. (message "Warning (%s): %s" type message)
  2929. (let (window)
  2930. (with-current-buffer (get-buffer-create "*Warnings*")
  2931. (goto-char (point-max))
  2932. (unless (bolp)
  2933. (insert "\n"))
  2934. (insert (format "Warning (%s): %s\n" type message))
  2935. (setq window (display-buffer (current-buffer)))
  2936. (set-window-start
  2937. window
  2938. (prog2
  2939. (forward-line (- 1 (window-height window)))
  2940. (point)
  2941. (goto-char (point-max))))))))))
  2942. method active actives match)
  2943. (dolist (server gnus-server-alist)
  2944. (setq method (gnus-server-to-method server)
  2945. active (intern (format "%s-active-file" (car method))))
  2946. (when (and (member (car method) '(nnml nnfolder))
  2947. (gnus-server-opened method)
  2948. (boundp active))
  2949. (when (setq match (assoc (symbol-value active) actives))
  2950. (funcall display-warn 'gnus-server
  2951. (format "%s and %s share the same active file %s"
  2952. (car method)
  2953. (cadr match)
  2954. (car match))))
  2955. (push (list (symbol-value active) method) actives)))))
  2956. (provide 'gnus-start)
  2957. ;;; gnus-start.el ends here