speedbar.texi 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233
  1. \input texinfo @c -*-texinfo-*-
  2. @setfilename ../../info/speedbar.info
  3. @settitle Speedbar: File/Tag summarizing utility
  4. @include docstyle.texi
  5. @syncodeindex fn cp
  6. @copying
  7. Copyright @copyright{} 1999--2016 Free Software Foundation, Inc.
  8. @quotation
  9. Permission is granted to copy, distribute and/or modify this document
  10. under the terms of the GNU Free Documentation License, Version 1.3 or
  11. any later version published by the Free Software Foundation; with no
  12. Invariant Sections, with the Front-Cover Texts being ``A GNU Manual'',
  13. and with the Back-Cover Texts as in (a) below. A copy of the license
  14. is included in the section entitled ``GNU Free Documentation License''.
  15. (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
  16. modify this GNU manual.''
  17. @end quotation
  18. @end copying
  19. @dircategory Emacs misc features
  20. @direntry
  21. * Speedbar: (speedbar). File/Tag summarizing utility.
  22. @end direntry
  23. @titlepage
  24. @sp 10
  25. @center @titlefont{Speedbar}
  26. @sp 2
  27. @center Eric Ludlam
  28. @vskip 0pt plus 1 fill
  29. @page
  30. @vskip 0pt plus 1filll
  31. @insertcopying
  32. @end titlepage
  33. @contents
  34. @node Top
  35. @top Speedbar
  36. Speedbar is a program for Emacs which can be used to summarize
  37. information related to the current buffer. Its original inspiration
  38. is the ``explorer'' often used in modern development environments, office
  39. packages, and web browsers.
  40. Speedbar displays a narrow frame in which a tree view is shown. This
  41. tree view defaults to containing a list of files and directories. Files
  42. can be ``expanded'' to list tags inside. Directories can be expanded to
  43. list the files within itself. Each file or tag can be jumped to
  44. immediately.
  45. Speedbar expands upon ``explorer'' windows by maintaining context with the
  46. user. For example, when using the file view, the current buffer's file
  47. is highlighted. Speedbar also mimics the explorer windows by providing
  48. multiple display modes. These modes come in two flavors. Major display
  49. modes remain consistent across buffers, and minor display modes appear
  50. only when a buffer of the applicable type is shown. This allows
  51. authors of other packages to provide speedbar summaries customized to
  52. the needs of that mode.
  53. Throughout this manual, activities are defined as ``clicking on'', or
  54. ``expanding'' items. Clicking means using @kbd{Mouse-2} on a
  55. button. Expanding refers to clicking on an expansion button to display
  56. an expanded summary of the entry the expansion button is
  57. on. @xref{Basic Navigation}.
  58. @ifnottex
  59. @insertcopying
  60. @end ifnottex
  61. @menu
  62. * Introduction:: Basics of speedbar.
  63. * Basic Navigation:: Basics of speedbar common between all modes.
  64. * File Mode:: Summarizing files.
  65. * Buffer Mode:: Summarizing buffers.
  66. * Minor Modes:: Additional minor modes such as Info and RMAIL.
  67. * Customizing:: Changing speedbar behavior.
  68. * Extending:: Extend speedbar for your own project.
  69. * GNU Free Documentation License:: The license for this documentation.
  70. * Index::
  71. @end menu
  72. @node Introduction
  73. @chapter Introduction
  74. @cindex introduction
  75. To start using speedbar use the command @kbd{M-x speedbar RET} or
  76. select it from the @samp{Options->Show/Hide} sub-menu. This command
  77. will open a new frame to summarize the local files. On X Window
  78. systems or on MS-Windows, speedbar's frame is twenty characters wide,
  79. and will mimic the height of the frame from which it was started. It
  80. positions itself to the left or right of the frame you started it
  81. from.
  82. To use speedbar effectively, it is important to understand its
  83. relationship with the frame you started it from. This frame is the
  84. @dfn{attached frame} which speedbar will use as a reference point. Once
  85. started, speedbar watches the contents of this frame, and attempts to
  86. make its contents relevant to the buffer loaded into the attached
  87. frame. In addition, all requests made in speedbar that require the
  88. display of another buffer will display in the attached frame.
  89. When used in terminal mode, the new frame appears the same size as the
  90. terminal. Since it is not visible while working in the attached frame,
  91. speedbar will save time by using the @dfn{slowbar mode}, where no tracking is
  92. done until speedbar is requested to show itself (i.e., the speedbar's
  93. frame becomes the selected frame).
  94. @cindex @code{speedbar-get-focus}
  95. The function to use when switching between frames using the keyboard is
  96. @code{speedbar-get-focus}. This function will toggle between frames, and
  97. it's useful to bind it to a key in terminal mode. @xref{Customizing}.
  98. @node Basic Navigation
  99. @chapter Basic Navigation
  100. Speedbar can display different types of data, and has several display
  101. and behavior modes. These modes all have a common behavior, menu
  102. system, and look. If one mode is learned, then the other modes are easy
  103. to use.
  104. @menu
  105. * Basic Key Bindings::
  106. * Basic Visuals::
  107. * Mouse Bindings::
  108. * Displays Submenu::
  109. @end menu
  110. @node Basic Key Bindings
  111. @section Basic Key Bindings
  112. @cindex key bindings
  113. These key bindings are common across all modes:
  114. @table @kbd
  115. @item Q
  116. @cindex quitting speedbar
  117. Quit speedbar, and kill the frame.
  118. @item q
  119. Quit speedbar, and hide the frame. This makes it faster to restore the
  120. speedbar frame, than if you press @kbd{Q}.
  121. @item g
  122. @cindex refresh speedbar display
  123. Refresh whatever contents are in speedbar.
  124. @item t
  125. @cindex slowbar mode
  126. Toggle speedbar to and from slowbar mode. In slowbar mode, frame
  127. tracking is not done.
  128. @item n
  129. @itemx p
  130. @cindex navigation
  131. Move, respectively, to the next or previous item. A summary of that
  132. item will be displayed in the attached frame's minibuffer.
  133. @item M-n
  134. @itemx M-p
  135. Move to the next or previous item in a restricted fashion. If a list is
  136. open, the cursor will skip over it. If the cursor is in an open list,
  137. it will not leave it.
  138. @item C-M-n
  139. @itemx C-M-p
  140. Move forwards and backwards across extended groups. This lets you
  141. quickly skip over all files, directories, or other common sub-items at
  142. the same current depth.
  143. @item C-x b
  144. Switch buffers in the attached frame.
  145. @end table
  146. Speedbar can handle multiple modes. Two are provided by default.
  147. These modes are File mode, and Buffers mode. There are accelerators to
  148. switch into these different modes.
  149. @cindex mode switching hotkeys
  150. @table @kbd
  151. @item b
  152. Switch into Quick Buffers mode (@pxref{Buffer Mode}). After one use, the
  153. previous display mode is restored.
  154. @item f
  155. Switch into File mode.
  156. @item r
  157. Switch back to the previous mode.
  158. @end table
  159. Some modes provide groups, lists and tags. @xref{Basic Visuals}. When
  160. these are available, some additional common bindings are available.
  161. @cindex common keys
  162. @table @kbd
  163. @item RET
  164. @itemx e
  165. Edit/Open the current group or tag. This behavior is dependent on the
  166. mode. In general, files or buffers are opened in the attached frame,
  167. and directories or group nodes are expanded locally.
  168. @item +
  169. @itemx =
  170. Expand the current group, displaying sub items.
  171. When used with a prefix argument, any data that may have been cached is
  172. flushed. This is similar to a power click. @xref{Mouse Bindings}.
  173. @item -
  174. Contract the current group, hiding sub items.
  175. @end table
  176. @node Basic Visuals
  177. @section Basic Visuals
  178. @cindex visuals
  179. Speedbar has visual cues for indicating different types of data. These
  180. cues are used consistently across the different speedbar modes to make
  181. them easier to interpret.
  182. At a high level, in File mode, there are directory buttons, sub
  183. directory buttons, file buttons, tag buttons, and expansion buttons.
  184. This makes it easy to use the mouse to navigate a directory tree, and
  185. quickly view files, or a summary of those files.
  186. The most basic visual effect used to distinguish between these button
  187. types is color and mouse highlighting. Anything the mouse highlights
  188. can be clicked on and is called a button (@pxref{Mouse Bindings}).
  189. Anything not highlighted by the mouse will not be clickable.
  190. Text in speedbar consists of four different types of data. Knowing how
  191. to read these textual elements will make it easier to navigate by
  192. identifying the types of data available.
  193. @subsection Groups
  194. @cindex groups
  195. Groups summarize information in a single line, and provide a high level
  196. view of more complex systems, like a directory tree, or manual chapters.
  197. Groups appear at different indentation levels, and are prefixed with a
  198. @samp{+} in some sort of ``box''. The group name will summarize the
  199. information within it, and the expansion box will display that
  200. information inline. In File mode, directories and files are ``groups''
  201. where the @samp{+} is surrounded by brackets like this:
  202. @example
  203. <+> include
  204. <-> src
  205. [+] foo.c
  206. @end example
  207. In this example, we see both open and closed directories, in addition to
  208. a file. The directories have a box consisting of angle brackets, and a
  209. file uses square brackets.
  210. In all modes, a group can be ``edited'' by pressing @kbd{RET}, meaning a
  211. file will be opened, or a directory explicitly opened in speedbar. A
  212. group can be expanded or contracted using @kbd{+} or
  213. @kbd{-}. @xref{Basic Key Bindings}.
  214. Sometimes groups may have a @samp{?} in its indicator box. This means
  215. that it is a group type, but there are no contents, or no known way of
  216. extracting contents of that group.
  217. When a group has been expanded, the indicator button changes from
  218. @samp{+} to @samp{-}. This indicates that the contents are being shown.
  219. Click the @samp{-} button to contract the group, or hide the contents
  220. currently displayed.
  221. @subsubsection Tags
  222. @cindex tags
  223. Tags are the leaf nodes of the tree system. Tags are generally prefixed
  224. with a simple character, such as @samp{>}. Tags can only be jumped to using
  225. @kbd{RET} or @kbd{e}.
  226. @subsubsection Boolean Flags
  227. Sometimes a group or tag is given a boolean flag. These flags appear as
  228. extra text characters at the end of the line. File mode uses boolean
  229. flags, such as a @samp{*} to indicate that a file has been checked out
  230. of a versioning system.
  231. For additional flags, see
  232. @c Note to self, update these to sub-nodes which are more relevant.
  233. @ref{File Mode}, and @ref{Version Control}.
  234. @subsubsection Unadorned Text
  235. Unadorned text generally starts in column 0, without any special symbols
  236. prefixing them. In Buffers mode different buffer groups are prefixed
  237. with a description of what the following buffers are (Files, scratch
  238. buffers, and invisible buffers.)
  239. Unadorned text will generally be colorless, and not clickable.
  240. @subsubsection Color Cues
  241. Each type of Group, item indicator, and label is given a different
  242. color. The colors chosen are dependent on whether the background color
  243. is light or dark.
  244. Of important note is that the ``current item'', which may be a buffer or
  245. file name, is highlighted red, and underlined.
  246. Colors can be customized from the group @code{speedbar-faces}. Some
  247. modes, such as for Info, will use the Info colors instead of default
  248. speedbar colors as an indication of what is currently being displayed.
  249. The face naming convention mirrors the File display mode. Modes which
  250. do not use files will attempt to use the same colors on analogous
  251. entries.
  252. @node Mouse Bindings
  253. @section Mouse Bindings
  254. @cindex mouse bindings
  255. The mouse has become a common information navigation tool. Speedbar
  256. will use the mouse to navigate file systems, buffer lists, and other
  257. data. The different textual cues provide buttons which can be clicked
  258. on (@pxref{Basic Visuals}). Anything that highlights can be clicked on
  259. with the mouse, or affected by the menu.
  260. The mouse bindings are:
  261. @table @kbd
  262. @item Mouse-1
  263. Move cursor to that location.
  264. @item Mouse-2
  265. @itemx Double-Mouse-1
  266. Activate the current button. @kbd{Double-Mouse-1} is called a @dfn{double
  267. click} on other platforms, and is useful for windows users with two
  268. button mice.
  269. @c Isn't it true that with two-button mice, the right button is Mouse-2?
  270. @c On GNU/Linux, the right button is Mouse-3.
  271. @item S-Mouse-2
  272. @itemx S-Double-Mouse-1
  273. @cindex power click
  274. This has the same effect as @kbd{Mouse-2}, except it is called a power
  275. click. This means that if a group with an expansion button @samp{+} is
  276. clicked, any caches are flushed, and subitems re-read. If it is a name,
  277. it will be opened in a new frame.
  278. @item Mouse-3
  279. Activate the speedbar menu. The item selected affects the line clicked,
  280. not the line where the cursor was.
  281. @item Mouse-1 @r{(mode line)}
  282. Activate the menu. This affects the item the cursor is on before the
  283. click, since the mouse was not clicked on anything.
  284. @item C-Mouse-1
  285. Buffers sub-menu. The buffer in the attached frame is switched.
  286. @end table
  287. When the mouse moves over buttons in speedbar, details of that item
  288. should be displayed in the minibuffer of the attached frame. Sometimes
  289. this can contain extra information such as file permissions, or tag
  290. location.
  291. @node Displays Submenu
  292. @section Displays Submenu
  293. @cindex displays submenu
  294. You can display different data by using different display modes. These
  295. specialized modes make it easier to navigate the relevant pieces of
  296. information, such as files and directories, or buffers.
  297. In the main menu, found by clicking @kbd{Mouse-3}, there is a submenu
  298. labeled @samp{Displays}. This submenu lets you easily choose between
  299. different display modes.
  300. The contents are modes currently loaded into emacs. By default, this
  301. would include Files, Quick Buffers, and Buffers. Other major display
  302. modes such as Info are loaded separately.
  303. @node File Mode
  304. @chapter File Mode
  305. @cindex file mode
  306. File mode displays a summary of your current directory. You can display
  307. files in the attached frame, or summarize the tags found in files. You
  308. can even see if a file is checked out of a version control system, or
  309. has some associated object file.
  310. Advanced behavior, like copying and renaming files, is also provided.
  311. @menu
  312. * Directory Display:: What the display means.
  313. * Hidden Files:: How to display hidden files.
  314. * File Key Bindings:: Performing file operations.
  315. @end menu
  316. @node Directory Display
  317. @section Directory Display
  318. @cindex directory display
  319. There are three major sections in the display. The first line or two is
  320. the root directory speedbar is currently viewing. You can jump to one
  321. of the parent directories by clicking on the name of the directory you
  322. wish to jump to.
  323. Next, directories are listed. A directory starts with the group
  324. indicator button @samp{<+>}. Clicking the directory name makes speedbar
  325. load that directory as the root directory for its display. Clicking the
  326. @samp{<+>} button will list all directories and files beneath.
  327. Next, files are listed. Files start with the group indicator @samp{[+]}
  328. or @samp{[?]}. You can jump to a file in the attached frame by clicking
  329. on the file name. You can expand a file and look at its tags by
  330. clicking on the @samp{[+]} symbol near the file name.
  331. A typical session might look like this:
  332. @example
  333. ~/lisp/
  334. <+> checkdoc
  335. <+> eieio
  336. <-> speedbar
  337. [+] Makefile
  338. [+] rpm.el #
  339. [+] sb-gud.el #
  340. [+] sb-info.el #
  341. [+] sb-rmail.el #
  342. [+] sb-w3.el
  343. [-] speedbar.el *!
  344. @{+@} Types
  345. @{+@} Variables
  346. @{+@} def (group)
  347. @{+@} speedbar-
  348. [+] speedbar.texi *
  349. <+> testme
  350. [+] align.el
  351. [+] autoconf.el
  352. @end example
  353. In this example, you can see several directories. The directory
  354. @file{speedbar} has been opened inline. Inside the directory
  355. @file{speedbar}, the file @file{speedbar.el} has its tags exposed.
  356. These tags are extensive, and they are summarized into tag groups.
  357. Files get additional boolean flags associated with them. Valid flags are:
  358. @cindex file flags
  359. @table @code
  360. @item *
  361. This file has been checked out of a version control
  362. system. @xref{Version Control}.
  363. @cindex @code{speedbar-obj-alist}
  364. @item #
  365. This file has an up to date object file associated with it. The
  366. variable @code{speedbar-obj-alist} defines how speedbar determines this
  367. value.
  368. @item !
  369. This file has an out of date object file associated with it.
  370. @end table
  371. A Tag group is prefixed with the symbol @samp{@{+@}}. Clicking this
  372. symbol will show all symbols that have been organized into that group.
  373. Different types of files have unique tagging methods as defined by their
  374. major mode. Tags are generated with either the @code{imenu} package, or
  375. through the @code{etags} interface.
  376. Tag groups are defined in multiple ways which make it easier to find the
  377. tag you are looking for. Imenu keywords explicitly create groups, and
  378. speedbar will automatically create groups if tag lists are too long.
  379. In our example, Imenu created the groups @samp{Types} and
  380. @samp{Variables}. All remaining top-level symbols are then regrouped
  381. based on the variable @code{speedbar-tag-hierarchy-method}. The
  382. subgroups @samp{def} and @samp{speedbar-} are groupings where the first
  383. few characters of the given symbols are specified in the group name.
  384. Some group names may say something like @samp{speedbar-t to speedbar-v},
  385. indicating that all symbols which alphabetically fall between those
  386. categories are included in that sub-group. @xref{Tag Hierarchy Methods}.
  387. @node Hidden Files
  388. @section Hidden Files
  389. @cindex hidden files
  390. On GNU and Unix systems, a hidden file is a file whose name starts
  391. with a period. They are hidden from a regular directory listing
  392. because the user is not generally interested in them.
  393. In speedbar, a hidden file is a file which isn't very interesting and
  394. might prove distracting to the user. Any uninteresting files are
  395. removed from the File display. There are two levels of uninterest in
  396. speedbar. The first level of uninterest are files which have no
  397. expansion method, or way of extracting tags. The second level is any
  398. file that matches the same pattern used for completion in
  399. @code{find-file}. This is derived from the variable
  400. @code{completion-ignored-extensions}.
  401. You can toggle the display of uninteresting files from the toggle menu
  402. item @samp{Show All Files}. This will display all level one hidden files.
  403. These files will be shown with a @samp{?} indicator. Level 2 hidden
  404. files will still not be shown.
  405. Object files fall into the category of level 2 hidden files. You can
  406. determine their presence by the @samp{#} and @samp{!} file indicators.
  407. @xref{Directory Display}.
  408. @node File Key Bindings
  409. @section File Key Bindings
  410. @cindex file key bindings
  411. File mode has key bindings permitting different file system operations
  412. such as copy or rename. These commands all operate on the @dfn{current
  413. file}. In this case, the current file is the file at point, or clicked
  414. on when pulling up the menu.
  415. @table @kbd
  416. @item U
  417. Move the entire speedbar display up one directory.
  418. @item I
  419. Display information in the minibuffer about this line. This is the same
  420. information shown when navigating with @kbd{n} and @kbd{p}, or moving
  421. the mouse over an item.
  422. @item B
  423. Byte compile the Emacs Lisp file on this line.
  424. @item L
  425. Load the Emacs Lisp file on this line. If a @file{.elc} file exists,
  426. optionally load that.
  427. @item C
  428. Copy the current file to some other location.
  429. @item R
  430. Rename the current file, possibly moving it to some other location.
  431. @item D
  432. Delete the current file.
  433. @item O
  434. Delete the current file's object file. Use the symbols @samp{#} and
  435. @samp{!} to determine if there is an object file available.
  436. @end table
  437. One menu item toggles the display of all available files. By default,
  438. only files which Emacs understands, and knows how to convert into a tag
  439. list, are shown. By showing all files, additional files such as text files are
  440. also displayed, but they are prefixed with the @samp{[?]} symbol. This
  441. means that it is a file, but Emacs doesn't know how to expand it.
  442. @node Buffer Mode
  443. @chapter Buffer Mode
  444. @cindex buffer mode
  445. Buffer mode is very similar to File mode, except that instead of
  446. tracking the current directory and all files available there, the
  447. current list of Emacs buffers is shown.
  448. These buffers can have their tags expanded in the same way as files,
  449. and uses the same unknown file indicator (@pxref{File Mode}).
  450. Buffer mode does not have file operation bindings, but the following
  451. buffer specific key bindings are available:
  452. @table @kbd
  453. @item k
  454. Kill this buffer. Do not touch its file.
  455. @item r
  456. Revert this buffer, reloading from disk.
  457. @end table
  458. In addition to Buffer mode, there is also Quick Buffer mode. In fact,
  459. Quick Buffers is bound to the @kbd{b} key. The only difference between
  460. Buffers and Quick Buffers is that after one operation is performed
  461. which affects the attached frame, the display is immediately reverted to
  462. the last displayed mode.
  463. Thus, if you are in File mode, and you need quick access to a buffer,
  464. press @kbd{b}, click on the buffer you want, and speedbar will revert
  465. back to File mode.
  466. @node Minor Modes
  467. @chapter Minor Display Modes
  468. @cindex minor display modes
  469. For some buffers, a list of files and tags makes no sense. This could
  470. be because files are not currently in reference (such as web pages), or
  471. that the files you might be interested have special properties (such as
  472. email folders.)
  473. In these cases, a minor display mode is needed. A minor display mode
  474. will override any major display mode currently being displayed for the
  475. duration of the specialized buffer's use. Minor display modes
  476. will follow the general rules of their major counterparts in terms of
  477. key bindings and visuals, but will have specialized behaviors.
  478. @menu
  479. * RMAIL:: Managing folders.
  480. * Info:: Browsing topics.
  481. * GDB:: Watching expressions or managing the current
  482. stack trace.
  483. @end menu
  484. @node RMAIL
  485. @section RMAIL
  486. @cindex RMAIL
  487. When using RMAIL, speedbar will display two sections. The first is a
  488. layer one reply button. Clicking here will initialize a reply buffer
  489. showing only this email address in the @samp{To:} field.
  490. The second section lists all RMAIL folders in the same directory as your
  491. main RMAIL folder. The general rule is that RMAIL folders always appear
  492. in all caps, or numbers. It is possible to save mail in folders with
  493. lower case letters, but there is no clean way of detecting such RMAIL folders
  494. without opening them all.
  495. Each folder can be visited by clicking the name. You can move mail from
  496. the current RMAIL folder into a different folder by clicking the
  497. @samp{<M>} button. The @samp{M} stands for Move.
  498. In this way you can manage your existing RMAIL folders fairly easily
  499. using the mouse.
  500. @node Info
  501. @section Info
  502. @cindex Info
  503. When browsing Info files, all local relevant information is displayed in
  504. the info buffer and a topical high-level view is provided in speedbar.
  505. All top-level info nodes are shown in the speedbar frame, and can be
  506. jumped to by clicking the name.
  507. You can open these nodes with the @samp{[+]} button to see what sub-topics
  508. are available. Since these sub-topics are not examined until you click
  509. the @samp{[+]} button, sometimes a @samp{[?]} will appear when you click on
  510. a @samp{[+]}, indicating that there are no sub-topics.
  511. @node GDB
  512. @section GDB
  513. @cindex gdb
  514. @cindex gud
  515. You can debug an application with GDB in Emacs using graphical mode or
  516. text command mode (@pxref{GDB Graphical Interface,,, emacs, The
  517. extensible self-documenting text editor}).
  518. If you are using graphical mode you can see how selected variables
  519. change each time your program stops (@pxref{Watch Expressions,,,
  520. emacs, The extensible self-documenting text editor}).
  521. If you are using text command mode, speedbar can show
  522. you the current stack when the current buffer is the @file{*gdb*}
  523. buffer. Usually, it will just report that there is no stack, but when
  524. the application is stopped, the current stack will be shown.
  525. You can click on any stack element and gdb will move to that stack
  526. level. You can then check variables local to that level at the GDB
  527. prompt.
  528. @node Customizing
  529. @chapter Customizing
  530. @cindex customizing
  531. Speedbar is highly customizable, with a plethora of control elements.
  532. Since speedbar is so visual and reduces so much information, this is an
  533. important aspect of its behavior.
  534. In general, there are three custom groups you can use to quickly modify
  535. speedbar's behavior.
  536. @table @code
  537. @item speedbar
  538. Basic speedbar behaviors.
  539. @item speedbar-vc
  540. Customizations regarding version control handling.
  541. @item speedbar-faces
  542. Customize speedbar's many colors and fonts.
  543. @end table
  544. @menu
  545. * Frames and Faces:: Visible behaviors.
  546. * Tag Hierarchy Methods:: Customizing how tags are displayed.
  547. * Version Control:: Adding new VC detection modes.
  548. * Hooks:: The many hooks you can use.
  549. @end menu
  550. @node Frames and Faces
  551. @section Frames and Faces
  552. @cindex faces
  553. @cindex frame parameters
  554. There are several faces speedbar generates to provide a consistent
  555. color scheme across display types. You can customize these faces using
  556. your favorite method. They are:
  557. @table @asis
  558. @cindex @code{speedbar-button-face}
  559. @item speedbar-button-face
  560. Face used on expand/contract buttons.
  561. @cindex @code{speedbar-file-face}
  562. @item speedbar-file-face
  563. Face used on Files. Should also be used on non-directory like nodes.
  564. @cindex @code{speedbar-directory-face}
  565. @item speedbar-directory-face
  566. Face used for directories, or nodes which consist of groups of other nodes.
  567. @cindex @code{speedbar-tag-face}
  568. @item speedbar-tag-face
  569. Face used for tags in a file, or for leaf items.
  570. @cindex @code{speedbar-selected-face}
  571. @item speedbar-selected-face
  572. Face used to highlight the selected item. This would be the current
  573. file being edited.
  574. @cindex @code{speedbar-highlight-face}
  575. @item speedbar-highlight-face
  576. Face used when the mouse passes over a button.
  577. @end table
  578. You can also customize speedbar's initial frame parameters. How this is
  579. accomplished is dependent on your platform being Emacs or XEmacs.
  580. @cindex @code{speedbar-frame-parameters}, Emacs
  581. In Emacs, change the alist @code{speedbar-frame-parameters}. This
  582. variable is used to set up initial details. Height is also
  583. automatically added when speedbar is created, though you can override
  584. it.
  585. @cindex @code{speedbar-frame-plist}, XEmacs
  586. In XEmacs, change the plist @code{speedbar-frame-plist}. This is the
  587. XEmacs way of doing the same thing.
  588. @node Tag Hierarchy Methods
  589. @section Tag Hierarchy Methods
  590. @cindex tag hierarchy
  591. @cindex tag groups
  592. @cindex tag sorting
  593. When listing tags within a file, it is possible to get an annoyingly
  594. long list of entries. Imenu (which generates the tag list in Emacs)
  595. will group some classes of items automatically. Even here, however,
  596. some tag groups can be quite large.
  597. @cindex @code{speedbar-tag-hierarchy-method}
  598. To solve this problem, tags can be grouped into logical units through a
  599. hierarchy processor. The specific variable to use is
  600. @code{speedbar-tag-hierarchy-method}. There are several methods that
  601. can be applied in any order. They are:
  602. @table @code
  603. @cindex @code{speedbar-trim-words-tag-hierarchy}
  604. @item speedbar-trim-words-tag-hierarchy
  605. Find a common prefix for all elements of a group, and trim it off.
  606. @cindex @code{speedbar-prefix-group-tag-hierarchy}
  607. @item speedbar-prefix-group-tag-hierarchy
  608. If a group is too large, place sets of tags into bins based on common
  609. prefixes.
  610. @cindex @code{speedbar-simple-group-tag-hierarchy}
  611. @item speedbar-simple-group-tag-hierarchy
  612. Take all items in the top level list not in a group, and stick them into
  613. a @samp{Tags} group.
  614. @cindex @code{speedbar-sort-tag-hierarchy}
  615. @item speedbar-sort-tag-hierarchy
  616. Sort all items, leaving groups on top.
  617. @end table
  618. You can also add your own functions to reorganize tags as you see fit.
  619. Some other control variables are:
  620. @table @code
  621. @cindex @code{speedbar-tag-group-name-minimum-length}
  622. @item speedbar-tag-group-name-minimum-length
  623. Default value: 4.
  624. The minimum length of a prefix group name before expanding. Thus, if
  625. the @code{speedbar-tag-hierarchy-method} includes
  626. @code{speedbar-prefix-group-tag-hierarchy} and one such group's common
  627. characters is less than this number of characters, then the group name
  628. will be changed to the form of:
  629. @example
  630. worda to wordb
  631. @end example
  632. instead of just
  633. @example
  634. word
  635. @end example
  636. This way we won't get silly looking listings.
  637. @cindex @code{speedbar-tag-split-minimum-length}
  638. @item speedbar-tag-split-minimum-length
  639. Default value: 20.
  640. Minimum length before we stop trying to create sub-lists in tags.
  641. This is used by all tag-hierarchy methods that break large lists into
  642. sub-lists.
  643. @cindex @code{speedbar-tag-regroup-maximum-length}
  644. @item speedbar-tag-regroup-maximum-length
  645. Default value: 10.
  646. Maximum length of submenus that are regrouped.
  647. If the regrouping option is used, then if two or more short subgroups
  648. are next to each other, then they are combined until this number of
  649. items is reached.
  650. @end table
  651. @node Version Control
  652. @section Version Control
  653. @cindex version control
  654. @cindex vc extensions
  655. When using the file mode in speedbar, information regarding a version
  656. control system adds small details to the display. If a file is in a
  657. version control system, and is ``checked out'' or ``locked'' locally, an
  658. asterisk @samp{*} appears at the end of the file name. In addition,
  659. the directory name for Version Control systems are left out of the
  660. speedbar display.
  661. @cindex @code{speedbar-directory-unshown-regexp}
  662. You can easily add new version control systems into speedbar's detection
  663. scheme. To make a directory ``disappear'' from the list, use the variable
  664. @code{speedbar-directory-unshown-regexp}.
  665. @cindex @code{speedbar-vc-path-enable-hook}
  666. Next, you need to write entries for two hooks. The first is
  667. @code{speedbar-vc-path-enable-hook} which will enable a VC check in the
  668. current directory for the group of files being checked. Your hook
  669. function should take one parameter (the directory to check) and return
  670. @code{t} if your VC method is in control here.
  671. @cindex @code{speedbar-vc-in-control-hook}
  672. The second function is @code{speedbar-vc-in-control-hook}. This hook
  673. takes two parameters, the @var{path} of the file to check, and the
  674. @var{file} name. Return @code{t} if you want to have the asterisk
  675. placed near this file.
  676. @cindex @code{speedbar-vc-indicator}
  677. Lastly, you can change the VC indicator using the variable
  678. @code{speedbar-vc-indicator}, and specify a single character string.
  679. @node Hooks
  680. @section Hooks
  681. @cindex hooks
  682. There are several hooks in speedbar allowing custom behaviors to be
  683. added. Available hooks are:
  684. @table @code
  685. @cindex @code{speedbar-visiting-file-hook}
  686. @item speedbar-visiting-file-hook
  687. Hooks run when speedbar visits a file in the selected frame.
  688. @cindex @code{speedbar-visiting-tag-hook}
  689. @item speedbar-visiting-tag-hook
  690. Hooks run when speedbar visits a tag in the selected frame.
  691. @cindex @code{speedbar-load-hook}
  692. @item speedbar-load-hook
  693. Hooks run when speedbar is loaded.
  694. @cindex @code{speedbar-reconfigure-keymaps-hook}
  695. @item speedbar-reconfigure-keymaps-hook
  696. Hooks run when the keymaps are regenerated. Keymaps are reconfigured
  697. whenever modes change. This will let you add custom key bindings.
  698. @cindex @code{speedbar-before-popup-hook}
  699. @item speedbar-before-popup-hook
  700. Hooks called before popping up the speedbar frame.
  701. New frames are often popped up when ``power clicking'' on an item to view
  702. it.
  703. @cindex @code{speedbar-before-delete-hook}
  704. @item speedbar-before-delete-hook
  705. Hooks called before deleting or hiding the speedbar frame.
  706. @cindex @code{speedbar-mode-hook}
  707. @item speedbar-mode-hook
  708. Hooks called after creating a speedbar buffer.
  709. @cindex @code{speedbar-timer-hook}
  710. @item speedbar-timer-hook
  711. Hooks called after running the speedbar timer function.
  712. @cindex @code{speedbar-scanner-reset-hook}
  713. @item speedbar-scanner-reset-hook
  714. Hook called whenever generic scanners are reset.
  715. Set this to implement your own scanning or rescan safe functions with
  716. state data.
  717. @end table
  718. @node Extending
  719. @chapter Extending
  720. @cindex extending
  721. Speedbar can run different types of Major display modes such as Files
  722. (@pxref{File Mode}), and Buffers (@pxref{Buffer Mode}). It can also manage
  723. different minor display modes for use with buffers handling specialized
  724. data.
  725. These major and minor display modes are handled through an extension
  726. system which permits specialized keymaps and menu extensions, in
  727. addition to a unique rendering function. You can also specify a wide
  728. range of tagging functions. The default uses @code{imenu}, but new
  729. tagging methods can be easily added. In this chapter, you will
  730. learn how to write your own major or minor display modes, and how to
  731. create specialized tagging functions.
  732. @menu
  733. * Minor Display Modes:: How to create a minor display mode.
  734. * Major Display Modes:: How to create a major display mode.
  735. * Tagging Extensions:: How to create your own tagging methods.
  736. * Creating a display:: How to insert buttons and hierarchies.
  737. @end menu
  738. @node Minor Display Modes
  739. @section Minor Display Modes
  740. @cindex create minor display mode
  741. A @dfn{minor display mode} is a mode useful when using a specific type of
  742. buffer. This mode might not be useful for any other kind of data or
  743. mode, or may just be more useful that a files or buffers based mode when
  744. working with a specialized mode.
  745. Examples that already exist for speedbar include RMAIL, Info, and gdb.
  746. These modes display information specific to the major mode shown in the
  747. attached frame.
  748. To enable a minor display mode in your favorite Major mode, follow these
  749. steps. The string @samp{@var{name}} is the name of the major mode being
  750. augmented with speedbar.
  751. @enumerate
  752. @item
  753. Create the keymap variable @code{@var{name}-speedbar-key-map}.
  754. @item
  755. Create a function, named whatever you like, which assigns values into your
  756. keymap. Use this command to create the keymap before assigning
  757. bindings:
  758. @smallexample
  759. (setq @var{name}-speedbar-key-map (speedbar-make-specialized-keymap))
  760. @end smallexample
  761. This function creates a special keymap for use in speedbar.
  762. @item
  763. Call your install function, or assign it to a hook like this:
  764. @smallexample
  765. (if (featurep 'speedbar)
  766. (@var{name}-install-speedbar-variables)
  767. (add-hook 'speedbar-load-hook '@var{name}-install-speedbar-variables))
  768. @end smallexample
  769. @item
  770. Create an easymenu compatible vector named
  771. @code{@var{name}-speedbar-menu-items}. This will be spliced into
  772. speedbar's control menu.
  773. @item
  774. Create a function called @code{@var{name}-speedbar-buttons}. This function
  775. should take one variable, which is the buffer for which it will create
  776. buttons. At this time @code{(current-buffer)} will point to the
  777. uncleared speedbar buffer.
  778. @end enumerate
  779. When writing @code{@var{name}-speedbar-buttons}, the first thing you will
  780. want to do is execute a check to see if you need to re-create your
  781. display. If it needs to be cleared, you need to erase the speedbar
  782. buffer yourself, and start drawing buttons. @xref{Creating a display}.
  783. @node Major Display Modes
  784. @section Major Display Modes
  785. @cindex create major display mode
  786. Creating a @dfn{Major Display Mode} for speedbar requires authoring a keymap,
  787. an easy-menu segment, and writing several functions. These items can be
  788. given any name, and are made the same way as in a minor display mode
  789. (@pxref{Minor Display Modes}). Once this is done, these items need to be
  790. registered.
  791. Because this setup activity may or may not have speedbar available when
  792. it is being loaded, it is necessary to create an install function. This
  793. function should create and initialize the keymap, and add your
  794. expansions into the customization tables.
  795. @cindex @code{speedbar-make-specialized-keymap}
  796. When creating the keymap, use the function
  797. @code{speedbar-make-specialized-keymap} instead of other keymap making
  798. functions. This will provide you with the initial bindings needed.
  799. Some common speedbar functions you might want to bind are:
  800. @table @code
  801. @cindex @code{speedbar-edit-line}
  802. @item speedbar-edit-line
  803. Edit the item on the current line.
  804. @cindex @code{speedbar-expand-line}
  805. @item speedbar-expand-line
  806. Expand the item under the cursor.
  807. With a numeric argument (@kbd{C-u}), flush cached data before expanding.
  808. @cindex @code{speedbar-contract-line}
  809. @item speedbar-contract-line
  810. Contract the item under the cursor.
  811. @end table
  812. @cindex @code{speedbar-line-path}
  813. These function require that function @code{speedbar-line-path} be
  814. correctly overloaded to work.
  815. Next, register your extension like this;
  816. @example
  817. (speedbar-add-expansion-list '("MyExtension"
  818. MyExtension-speedbar-menu-items
  819. MyExtension-speedbar-key-map
  820. MyExtension-speedbar-buttons))
  821. @end example
  822. There are no limitations to the names you use.
  823. The first parameter is the string representing your display mode.
  824. The second parameter is a variable name containing an easymenu compatible
  825. menu definition. This will be stuck in the middle of speedbar's menu.
  826. The third parameter is the variable name containing the keymap we
  827. discussed earlier.
  828. The last parameter is a function which draws buttons for your mode.
  829. This function must take two parameters. The directory currently being
  830. displayed, and the depth at which you should start rendering buttons.
  831. The function will then draw (starting at the current cursor position)
  832. any buttons deemed necessary based on the input parameters.
  833. @xref{Creating a display}.
  834. Next, you need to register function overrides. This may look something
  835. like this:
  836. @example
  837. (speedbar-add-mode-functions-list
  838. '("MYEXTENSION"
  839. (speedbar-item-info . MyExtension-speedbar-item-info)
  840. (speedbar-line-path . MyExtension-speedbar-line-path)))
  841. @end example
  842. The first element in the list is the name of you extension. The second
  843. is an alist of functions to overload. The function to overload is
  844. first, followed by what you want called instead.
  845. For @code{speedbar-line-path} your function should take an optional DEPTH
  846. parameter. This is the starting depth for heavily indented lines. If
  847. it is not provided, you can derive it like this:
  848. @example
  849. (save-match-data
  850. (if (not depth)
  851. (progn
  852. (beginning-of-line)
  853. (looking-at "^\\([0-9]+\\):")
  854. (setq depth (string-to-int (match-string 1)))))
  855. @end example
  856. @noindent
  857. where the depth is stored as invisible text at the beginning of each
  858. line.
  859. The path returned should be the full path name of the file associated
  860. with that line. If the cursor is on a tag, then the file containing
  861. that tag should be returned. This is critical for built in file based
  862. functions to work (meaning less code for you to write). If your display
  863. does not deal in files, you do not need to overload this function.
  864. @cindex @code{speedbar-item-info}
  865. The function @code{speedbar-item-info}, however, is very likely to need
  866. overloading. This function takes no parameters and must derive a text
  867. summary to display in the minibuffer.
  868. There are several helper functions you can use if you are going to use
  869. built in tagging. These functions can be @code{or}ed since each one
  870. returns non-@code{nil} if it displays a message. They are:
  871. @table @code
  872. @cindex @code{speedbar-item-info-file-helper}
  873. @item speedbar-item-info-file-helper
  874. This takes an optional @var{filename} parameter. You can derive your own
  875. filename, or it will derive it using a (possibly overloaded) function
  876. @code{speedbar-line-file}. It shows details about a file.
  877. @cindex @code{speedbar-item-info-tag-helper}
  878. @item speedbar-item-info-tag-helper
  879. If the current line is a tag, then display information about that tag,
  880. such as its parent file, and location.
  881. @end table
  882. Your custom function might look like this:
  883. @example
  884. (defun MyExtension-item-info ()
  885. "Display information about the current line."
  886. (or (speedbar-item-info-tag-helper)
  887. (message "Interesting detail.")))
  888. @end example
  889. Once you have done all this, speedbar will show an entry in the
  890. @samp{Displays} menu declaring that your extension is available.
  891. @node Tagging Extensions
  892. @section Tagging Extensions
  893. It is possible to create new methods for tagging files in speedbar.
  894. To do this, you need two basic functions, one function to fetch the
  895. tags from a buffer, the other to insert them below the filename.
  896. @defun my-fetch-dynamic-tags file
  897. Parse @var{file} for a list of tags. Return the list, or @code{t} if there was
  898. an error.
  899. @end defun
  900. The non-error return value can be anything, as long as it can be
  901. inserted by its paired function:
  902. @defun my-insert-tag-list level lst
  903. Insert a list of tags @var{lst} started at indentation level
  904. @var{level}. Creates buttons for each tag, and provides any other
  905. display information required.
  906. @end defun
  907. @cindex @code{speedbar-create-tag-hierarchy}
  908. It is often useful to use @code{speedbar-create-tag-hierarchy} on your
  909. token list. See that function's documentation for details on what it
  910. requires.
  911. @cindex @code{speedbar-dynamic-tags-function-list}
  912. Once these two functions are written, modify the variable
  913. @code{speedbar-dynamic-tags-function-list} to include your parser at the
  914. beginning, like this:
  915. @example
  916. (add-to-list 'speedbar-dynamic-tags-function-list
  917. '(my-fetch-dynamic-tags . my-insert-tag-list))
  918. @end example
  919. If your parser is only good for a few types of files, make sure that it
  920. is either a buffer local modification, or that the tag generator returns
  921. @code{t} for non valid buffers.
  922. @node Creating a display
  923. @section Creating a display
  924. @cindex creating a display
  925. Rendering a display in speedbar is completely flexible. When your
  926. button function is called, see @ref{Minor Display Modes}, and @ref{Major
  927. Display Modes}, you have control to @code{insert} anything you want.
  928. The conventions allow almost anything to be inserted, but several helper
  929. functions are provided to make it easy to create the standardized
  930. buttons.
  931. To understand the built in functions, each ``button'' in speedbar consists
  932. of four important pieces of data. The text to be displayed, token
  933. data to be associated with the text, a function to call, and some face to
  934. display it in.
  935. When a function is provided, then that text becomes mouse activated,
  936. meaning the mouse will highlight the text.
  937. Additionally, for data which can form deep trees, each line is given a
  938. depth which indicates how far down the tree it is. This information is
  939. stored in invisible text at the beginning of each line, and is used by
  940. the navigation commands.
  941. @defun speedbar-insert-button text face mouse function &optional token prevline
  942. This function inserts one button into the current location.
  943. @var{text} is the text to insert. @var{face} is the face in which it
  944. will be displayed. @var{mouse} is the face to display over the text
  945. when the mouse passes over it. @var{function} is called whenever the
  946. user clicks on the text.
  947. The optional argument @var{token} is extra data to associated with the
  948. text. Lastly @var{prevline} should be non-@code{nil} if you want this line to
  949. appear directly after the last button which was created instead of on
  950. the next line.
  951. @end defun
  952. @defun speedbar-make-tag-line exp-button-type exp-button-char exp-button-function exp-button-data tag-button tag-button-function tag-button-data tag-button-face depth
  953. Create a tag line with @var{exp-button-type} for the small expansion
  954. button. This is the button that expands or contracts a node (if
  955. applicable), and @var{exp-button-char} the character in it (@samp{+},
  956. @samp{-}, @samp{?}, etc.). @var{exp-button-function} is the function
  957. to call if it's clicked on. Button types are @code{bracket},
  958. @code{angle}, @code{curly}, @code{expandtag}, @code{statictag}, and
  959. @code{nil}. @var{exp-button-data} is extra data attached to the text
  960. forming the expansion button.
  961. Next, @var{tag-button} is the text of the tag.
  962. @var{tag-button-function} is the function to call if clicked on, and
  963. @var{tag-button-data} is the data to attach to the text field (such a
  964. tag positioning, etc.). @var{tag-button-face} is a face used for this
  965. type of tag.
  966. Lastly, @var{depth} shows the depth of expansion.
  967. This function assumes that the cursor is in the speedbar window at the
  968. position to insert a new item, and that the new item will end with a CR.
  969. @end defun
  970. @defun speedbar-insert-generic-list level list expand-fun find-fun
  971. At @var{level}, (the current indentation level desired) insert a generic
  972. multi-level alist @var{list}. Associations with lists get @samp{@{+@}}
  973. tags (to expand into more nodes) and those with positions or other data
  974. just get a @samp{>} as the indicator. @samp{@{+@}} buttons will have the
  975. function @var{expand-fun} and the token is the @code{cdr} list. The
  976. token name will have the function @var{find-fun} and not token.
  977. Each element of the list can have one of these forms:
  978. @table @code
  979. @item (@var{name} . marker-or-number)
  980. One tag at this level.
  981. @item (@var{name} (@var{name} . marker-or-number) (@var{name} . marker-or-number) ... )
  982. One group of tags.
  983. @item (@var{name} marker-or-number (@var{name} . marker-or-number) ... )
  984. One Group of tags where the group has a starting position.
  985. @end table
  986. When you use @code{speedbar-insert-generic-list}, there are some
  987. variables you can set buffer-locally to change the behavior. The most
  988. obvious is @code{speedbar-tag-hierarchy-method}.
  989. @xref{Tag Hierarchy Methods}.
  990. @defvar speedbar-generic-list-group-expand-button-type
  991. This is the button type used for groups of tags, whether expanded
  992. or added in via a hierarchy method. Two good values are
  993. @code{curly} and @code{expandtag}. Curly is the default button, and
  994. @code{expandtag} is useful if the groups also has a position.
  995. @end defvar
  996. @defvar speedbar-generic-list-tag-button-type
  997. This is the button type used for a single tag.
  998. Two good values are @code{nil} and @code{statictag}.
  999. @code{nil} is the default, and @code{statictag} has the same width as
  1000. @code{expandtag}.
  1001. @end defvar
  1002. @end defun
  1003. @node GNU Free Documentation License
  1004. @appendix GNU Free Documentation License
  1005. @include doclicense.texi
  1006. @node Index
  1007. @unnumbered Concept Index
  1008. @printindex cp
  1009. @bye
  1010. @c LocalWords: speedbar's xref slowbar kbd subsubsection
  1011. @c LocalWords: keybindings