Mercurial > emacs
annotate lisp/buff-menu.el @ 105973:b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-clone-subtree-with-time-shift): Make it work at the
end of the buffer.
* org-mobile.el (org-mobile-write-checksums): Specify coding
system.
(org-mobile-timestamp-buffer): Keep local variable/mode line at
beginning of buffer.
* org-latex.el (org-latex-entities-regexp): Fix typo in regexp.
* org.el (org-block-todo-from-children-or-siblings-or-parent)
(org-block-todo-from-checkboxes): Do not block changes to a nil
TODO state.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-habit.el (org-habit-parse-todo): Indicate which habit is
wrongly set up in the error messages.
* org-colview.el (org-columns-display-here): Don't try to
calculate values if the underlying property is not set.
(org-columns-string-to-number): Convert age strings back into
fractional days.
(org-agenda-colview-summarize): Handle extended summary types
properly.
* org-colview-xemacs.el (org-columns-display-here): Don't try to
calculate values if the underlying property is not set.
(org-columns-string-to-number): Convert age strings back into
fractional days.
(org-agenda-colview-summarize): Handle extended summary types
properly.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-export-format-drawer-function): New variable.
(org-export-format-drawer): New function.
(org-export-preprocess-string): Pass the backend as a parameter to
`org-export-remove-or-extract-drawers'.
(org-export-remove-or-extract-drawers): New parameter BACKEND.
* org-protocol.el (org-protocol-char-to-string): New defsubst.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-diary-entry-in-org-file): Add error
message when no block is selected.
* org-latex.el (org-export-latex-links): Check for protectedness
in the last matched character, not after the match.
* org-datetree.el (org-datetree-find-date-create): Respect
restriction when KEEP-RESTRICTION is set.
(org-datetree-file-entry-under): New function.
(org-datetree-cleanup): New command.
2009-11-13 Dan Davison <davison@stats.ox.ac.uk>
* org-src.el (org-edit-src-code): New optional argument context
allows calling functions to avoid altering the saved window
configuration.
(org-edit-src-exit): Do not restore window configuration when this
function is used in the context of saving the edit buffer.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-out, org-clock-cancel): Revert to
instances to switching to with-current-buffer, because these seem
to cause problems - no idea why.
* org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file):
Require diary-lib for (diary-date-display-form).
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-log-reschedule, org-log-redeadline): New options.
(org-log-note-headings): Add templates for rescheduling and
deadline changing.
(org-startup-options): Add in-buffer settings for logging changing
schedule and deadline time stamps.
(org-deadline, org-schedule): Check for existing date and arrange
for logging if the user requests it.
(org-add-log-note): Prepare proper note buffers for rescheduling
and deadline changes.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-diary-entry-in-org-file)
(org-agenda-add-entry-to-org-agenda-diary-file)
(org-agenda-insert-diary-make-new-entry): New functions.
(org-agenda-diary-entry): Call
`org-agenda-diary-entry-in-org-file' when appropriate.
* org.el (org-calendar-insert-diary-entry-key): New option.
(org-agenda-diary-file): New option.
("calendar"): Install our insertion function in the calendar.
* org-remember.el (org-datetree): Require.
(org-remember-templates): Add new positioning option.
(org-remember-reference-date): New variable.
(org-remember-apply-template): Store the reference date in a local
variable.
(org-remember-handler): Implement date tree positioning of entries.
* org-datetree.el: New file.
* org-latex.el (org-export-latex-preprocess): Protect targets in
verbatim emphasis.
* org-html.el (org-export-as-html): Protect targets in verbatim
emphasis.
* org-docbook.el (org-export-as-docbook): Protect targets in
verbatim emphasis.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-show-notification): Handle messages that
contain a percent character.
* org-remember.el (org-remember-apply-template): Turn of partial
completion.
* org-mobile.el (org-mobile-before-process-capture-hook): New hook.
(org-mobile-pull): Run `org-mobile-before-process-capture-hook'.
* org.el (org-indent-mode): Define variable already in org.el.
(org-unfontify-region): Remove line-prefix and wrap-prefix
properties only if org-indent-mode is active.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-icalendar.el (org-print-icalendar-entries): Save match data
around call to verify function.
(org-print-icalendar-entries): Add a call to the verification
function.
* org.el (org-speedbar-set-agenda-restriction): Remove unnecessary
save-restrivtion' form.
2009-11-13 Dan Davison <davison@stats.ox.ac.uk>
* org-exp.el (org-export-format-source-code-or-example): restrict
scope of preserve-indentp to the let binding.
(org-src): require org-src, since org-src-preserve-indentation is used.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-timer.el (org-timer-set-timer): Set variables
org-timer-timer[123] correctly.
* org-mobile.el (org-mobile-files-alist): Make it work when
`agenda-archives' is included in
`org-agenda-text-search-extra-files'.
(org-mobile-push): Restore agenda after mobile push.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-clock.el (org-resolve-clocks-if-idle): Another fix to the
way the amount of idle time is presented in the minibuffer.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-icalendar.el (org-print-icalendar-entries): Use
org-icalendar-verify-function only if non-nil.
* org.el (org-refile): Refile to clock only if the prefix arg is
2.
(org-sparse-tree): Fix docstring to be in line with prompt.
(org-update-parent-todo-statistics): Call
`org-after-todo-statistics-hook' on each level.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-remember.el (org-remember-apply-template): Make sure the
buffer exists.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-tab-ind-state): New variable.
(org-cycle-level): New function.
(org-cycle-level-after-item/entry-creation): New option.
(org-flag-subtree): New function.
(org-hide-archived-subtrees): Call `org-flag-subtree'.
(org-set-effort): Indexed access.
* org-list.el (org-cycle-item-indentation): New function.
* org.el (org-refile): Make prefix argument 2 refile to current
clock.
(org-priority): Interpret action `remove' as call to remove the
priority cookie.
* org-remember.el (org-remember-apply-template): Don't depend on
buffer name being like file name.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-play-sound): Expand file in
org-clock-sound, to allow ~ for home.
* org-remember.el (org-remember-handler): Set
text-before-node-creation even if this already looks like a node,
because the string might be needed on non-org-mode target files.
* org-agenda.el (org-agenda-open-link): Make this work in agenda
clocktables.
(org-agenda-switch-to): Follow a link at point if
org-return-follows-link' is set and there is nothing else to do in
this line.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-colview-xemacs.el: Add in changes from org-colview.el
2009-11-13 Dan Davison <davison@stats.ox.ac.uk>
* org-exp-blocks.el: Modify split separator regexp to avoid empty
strings.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-colview.el (org-columns-new): Make this work with the new
operators.
(org-columns-store-format): Make this work with the new operators.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-src.el (org-src-preserve-indentation): Document that this
variable is also used during export.
* org-exp.el (org-export-format-source-code-or-example): Preserve
indentation if a block has a -i option, or if
`org-src-preserve-indentation' is set.
* org-exp-blocks.el (org-export-blocks-preprocess): Preserve
indentation if a block has a -i option, or if
`org-src-preserve-indentation' is set.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-mode-map): Define the new archiving keys.
(org-speed-commands-default): Define an archiving key in the speed
command map.
(org-org-menu): Improve the menu structure concerning archiving.
* org-archive.el (org-archive-subtree-default-with-confirmation):
New command.
* org-agenda.el (org-agenda-mode-map): Define the new archiving keys.
(org-agenda-menu): Add the new archiving commands to the menu.
(org-agenda-archive-default)
(org-agenda-archive-default-with-confirmation): New commands.
(org-agenda-archive, org-agenda-archive-to-archive-sibling): Just
call `org-agenda-archive-with'.
(org-agenda-archive-with): New function.
* org-table.el (org-table-convert-region): Inert spaces around "|"
to avoid line beginnings like "|-1" which will be mistaken as
hlines.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-offer-links-in-entry): Return nil if there are no
links, t if a link has been selected.
(org-open-at-point): Open attachment directory when called in the
headline and there are no links in the entry body.
(org-speed-commands-default): Add "o" for open-at-point as a speed
command.
* org-attach.el (org-attach-reveal): Optional prefix arg
IF-EXISTS, which avoids creating the attachment directory if it
does not yet exist.
* org-agenda.el (org-agenda, org-run-agenda-series): Evaluate
MATCH.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el ("abbrev"): Work with abbrev tables only after they have
been loaded.
* org-list.el (org-list-send-list): Fix bug related to match
data.
* org-latex.el (org-export-latex-fontify): Apply verbatim
emphasis.
(org-export-latex-make-header): Insert \obeylines if line breaks
should be preserved.
* org-exp.el (org-export-protect-verbatim): Add an
`org-verbatim-emph' property to such text.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-icalendar.el (org-icalendar-use-plain-timestamp): New option.
(org-print-icalendar-entries): Skip entries where the timestamp is
not a deadline and not scheduled, if the user requests that.
* org-latex.el (org-export-latex-quotation-marks): Allow a bracket
before an opening quote.
* org-archive.el (org-archive-subtree): Keep archive after
archiving something.
* org-id.el (org-id-update-id-locations): Add archive files if
that is required by `org-id-extra-files'.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-src.el (org-src-window-setup): New option.
(org-src-switch-to-buffer): New function.
(org-edit-src-exit): Add optional argument CONTEXT and use it to
restore window configuration.
(org-edit-src-code, org-edit-src-continue, org-edit-src-exit):
Call `org-src-switch-to-buffer'.
* org.el (org-default-properties): Add STYLE property.
(org-files-list): Use the function call to get the files.
(org-additional-option-like-keywords): Add SETUPFILE to completion
list.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-table.el (org-table-convert-region): Correctly interpret
quoting in csv import.
* org.el (org-icompleting-read): Make iswitchb completion work
with lists and tables.
* org-agenda.el (org-agenda-add-entry-text): Never add entry text
while pushing the mobile agenda.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-clock.el
(org-clock-auto-clock-resolution): Now takes three values: nil, t
and `when-no-clock-is-running'.
(org-clock-in): Use `org-clock-auto-clock-resolution' to determine
whether or not to resolve Org buffers on clock in.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-colview.el (org-format-time-period): Function to format
times in fractional days for display.
(org-columns-display-here): Add support for showing a calculated
value in place of the property.
(org-columns): Set `org-columns-time' to the current time so time
difference calculations will work.
(org-columns-time): Use to store the current time when column view
is displayed, so all time differences will use the same reference
point.
(org-columns-compile-map): There is now an extra position in each
entry specifying the function to use to calculate the displayed
value for the non-calculated properties in the column,
(org-columns-compute-all): Set `org-columns-time' to the current
time so time difference calculations will work.
(org-columns-compute): Handle column operators where the values
used are calculated from the underlying property.
(org-columns-number-to-string): Handle the 'age' column format
(org-columns-string-to-number): Correct the function name (was
org-column...). Add support for the 'age' column format.
(org-columns-compile-format): Support the additional parameter in
org-columns-compile-map.
2009-11-13 Bastien Guerry <bzg@altern.org>
* org.el (org-mode-hook): Turn `org-mode-hook' into a customizable
variable.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-has-been-used): New variable.
(org-clock-in): Set `org-clock-has-been-used'.
(org-clock-save): Save only if clock data has been used or created
during this session.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-persist): New value, to store only the
clock history.
(org-clock-save): Don't save the clock if only the history should
be stored.
(org-clock-load): Turn off John Wiegley's auto resolving mechanism
when restoring a saved clock.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-clock.el (org-clock-display, org-clock-put-overlay): Use
`org-time-clock-use-fractional'.
* org.el (org-time-clocksum-use-fractional)
(org-time-clocksum-fractional-format): Two new customizable
variables which allow the user to select fractional times (1.25
instead of 1:25) in the `org-clock-display' report.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-ascii.el (org-export-ascii-table-keep-all-vertical-lines):
New option.
* org.el (org-tag-alist): Fix customization type.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-update-checksum-for-capture-file):
Make sure the regexp search can fail without throwing an error.
(org-mobile-apply): Save the inbox buffer after removing
successfully applied changes.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-clock.el (org-resolve-clocks-if-idle): Fix to the way idle
time is reported after the user comes back (but before they
resolve time).
* org.el (org-get-repeat): Change so that this function can be
called with either `org-scheduled-string' or
`org-deadline-string'.
* org-clock.el (org-clock-auto-clock-resolution): Renamed
`org-clock-disable-clock-resolution', since negatives don't sound
good in customization variables.
(org-clock-in): Don't use the auto-resolution logic if the user is
clocking into a different task while an active clock is running.
This then allows the default behavior of clocking out of the open
task and then into the new task.
* org.el (org-modules): Made this variable more consistent, since
it was referring to Org, OrgMode and Org-mode, whereas the docs
for the variable always refer to Org-mode.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org.el (org-repeat-re): The changed org-repeat-re no longer
matched simple +2d type repeaters. Fix it so it does.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-latex.el (org-export-latex-preprocess): Protect the vspace
macro in the VERSE environment.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-habit.el (org-habit-get-priority): A new function that
determines the relative priority of a habit, based on how long
past its scheduled date it is, and how near the deadline is.
* org-agenda.el (org-agenda-get-scheduled): Set habit priority
using `org-habit-get-priority'.
* org-habit.el (org-habit-build-graph): Start displaying colors
from the first scheduled date, if that date is earlier than the
first completion date.
* org-habit.el: Changed all "color" variables to faces, and made
them appropriate for light and dark backgrounds.
* org-habit.el (org-habit-duration-to-days): Made this function
more general.
(org-habit-parse-todo): Parse the new ".+N/N" style repeater.
* org-agenda.el (org-agenda-get-deadlines): Removed all mention of
habits, since they don't use DEADLINE anymore.
* org.el (org-repeat-re, org-display-custom-time)
(org-timestamp-change): Extended to support the new ".+N/N"
syntax, used for habits.
* org-clock.el (org-clock-resolve-clock): Fixed an incorrect
variable reference.
* org-agenda.el (org-agenda-set-mode-name): Show Habit in the
modeline when habits are being displayed (if that module is being
loaded).
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-clock.el (org-x11-idle-seconds): Add a method to get the X11
idle time using the xscreensaver extension.
(org-user-idle-seconds): Use X11 idle time if available.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-next-line): New command.
(org-agenda-previous-line): New commands.
(org-agenda-show-and-scroll-up, org-agenda-show-scroll-down): New
commands.
(org-agenda-follow-mode): Do the follow immediately if the mode is
turned on here.
(previous-line, next-line): Replace keys with the corresponding
org functions.
(org-agenda-mode-map): Bind backspace and delete to the scrolling
command.
* org.el (org-icompleting-read): Turn off partial completion mode
for the duration of this completion round.
* org-latex.el (org-export-latex-fontify-headline): Protect TeX
macros in author lines and similar stuff.
* org.el (org-file-tags): Fix docstring.
(org-get-buffer-tags): Add the #+FILETAGS tags.
("ecb"): Maks ecb show context after jumping into an Org file.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-agenda.el (org-finalize-agenda): Draw habit consistency
graphs after everything else in the buffer has been setup.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-apply): Count success and failure.
* org.el (org-indent-line-function): Fix regexp replace problem.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-clock.el (org-clock-disable-clock-resolution): New
customization variable that disable automatic clock resolution on
clock in.
(org-clock-in): If `org-clock-disable-clock-resolution' is set, do
not automatically resolve anything. This is does not affect
idle-time resolution, however, if `org-clock-idle-time' is set.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-habit.el: New file, which implements code to build a "habit
consistency graph".
* org-agenda.el (org-agenda-get-deadlines)
(org-agenda-get-scheduled): Display consistency graphs when
outputting habits into the agenda. The graphs are always relative
to the current time.
(org-format-agenda-item): Added new parameter `habitp', which
indicates whether we are formatting a habit or not. Do not
display "extra" leading information if habitp is true.
* org.el (org-repeat-re): Improved regexp to include .+ and ++
leaders for repeat strings.
(org-get-repeat): Now takes a string parameter `tagline', so the
caller can obtain the SCHEDULED repeat, or the DEADLINE repeat.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-agenda.el (org-agenda-auto-exclude-function): New
customization variable for allowing the user to create an "auto
exclusion" filter for doing context-aware auto tag filtering.
(org-agenda-filter-by-tag): Changes to support the use of
`org-agenda-auto-exclude-function'. See the new manual addition,.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org.el (org-files-list): Don't attempt to return a file name for
Org buffers which have no associated file.
* org-agenda.el (org-agenda-do-action): Fixed a typo.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-locate-entry): Interpret files
relative to org-directory.
(org-mobile-inbox-for-pull): Document the best location for this
file.
(org-mobile-check-setup): Verify `org-directory'.
(org-mobile-create-index-file): Sort the files to be listed in
index.org.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org.el (org-fast-tag-selection): Add a way to display a
description for a tag group. This is done by adding a string to
either the startgroup or endgroup cell.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-resolve, org-resolve-clocks)
(org-emacs-idle-seconds): Use `org-float-time' instead of
`time-to-seconds'
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-sorting-strategy): Fix customization
type.
* org.el (org-pre-cycle-hook): Document that `empty' can also be
the value of ARG when doing local cycling.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-clock.el (org-clock-resolve-clock): If keeping or
subtracting time results in a clock out at a time in the past, and
if the resolution occurred due to idleness or invoking `M-x
org-resolve-clocks', remember that past moment in time. On the
next clock in, the user will be prompted to see if they want to
back-date their new clock to then.
(org-clock-resolve): Do not jump the user to the location of a
dangling clock if the resolution is occuring due to an idle
timeout. In that case there is typically only one dangling clock,
the active one, and there is no value gained by shuffling their
windows around to show it to them. Being prompted to resolve an
idle clock should be as inobtrusive as possible.
(org-resolve-clocks-if-idle): New function that resolves only the
currently active clock if the user has exceeded the time returned
by `org-user-idle-seconds', based on the value of
`org-clock-idle-time'.
(org-clock-in): If, after resolving clocks,
(org-clock-out): Cancel the `org-clock-idle-timer' on clock out.
* org-clock.el (org-clock-resolve-clock): New function that
resolves a clock to a specific time, closing or resuming as need
be, and possibly even starting a new clock.
(org-clock-resolve): New function used by `org-resolve-clocks'
that sets up for the call to `org-clock-resolve-clock'. It
determines the time to resolve to based on a single-character
selection from the user to either keep time, subtract away time or
cancel the clock.
(org-resolve-clocks): New user command which resolves dangling
clocks -- that is, open but not active -- anywhere in the file
list returned by `org-files-list'.
(org-clock-in): Automatically resolve dangling clocks whenever a
user clocks in.
(org-clock-cancel): If the user cancels the solely clock in a
LOGBOOK, remove the empty drawer.
* org-clock.el (org-clock-idle-time): New user customizable option
for detecting whether the user has left a clock idle. Note: it is
only used in this commit to test whether it's worthwhile to check
OS X to get the Mac user's current idle time. If the Emacs idle
time is less than the value, the user hasn't been away long enough
to be worth checking (a more expensive test than just getting
Emacs idle time).
(org-user-idle-seconds, org-mac-idle-seconds)
(org-emacs-idle-seconds): This three functions, in conjunction
with the user customization variable `org-clock-idle-time', return
the number of seconds (as a floating point) that the user has been
away from their Emacs (or, if running on OS X, their computer).
* org-clock.el (org-find-open-clocks): New function that returns a
list of all open clocks in the given FILE. Note that each clock
it returns is a cons cell of the format (MARKER . START-TIME).
This "clock" value is used by several of the new clock module
utility functions.
(org-is-active-clock): New inline function which tests whether the
given clock value is the same as the currently active clock.
Returns non-nil if this is the case.
(org-with-clock-position): New macro that evaluates FORMS with
point in the buffer and at the position of the given clock.
Changes to the current clock are global.
(org-with-clock): New macro that evaluates FORMS with point in the
buffer and at the position of the given clock. However, changes
to the current clock are local and have no effect on the user's
active clock. This allows, for example, far any clock to be
cancelled without cancelling the active clock.
(org-clock-clock-in): New inline function that switches the active
clock to the given clock. If either the argument RESUME, or the
global `org-clock-in-resume', are non-nil, it will resume a clock
that was previously left open.
(org-clock-clock-out): New inline function that clocks out the
given clock value without affecting the currently active clock.
(org-clock-clock-cancel): New inline function that cancels the
given clock value without affecting the currently active clock.
* org-clock.el (org-clock-in): Before creating
`org-clock-mode-line-timer', check to make sure an older timer is
not currently running.
(org-clock-out): Accept new third parameter `at-time', which
permits a clock to be clocked out at a specific time. Note that
no attempt is made to verify that the clock out time is later than
the clock in time.
* org.el (org-files-list): New utility function for returning a
list of all open org-mode buffers, plus all files used to build
the agenda buffer. Note that not all the files will necessarily
be visited by a buffer at time of call.
(org-entry-beginning-position): Like the function
`line-beginning-position', this inline function returns the
beginning position of the current heading/entry.
(org-entry-end-position): Like the function `line-end-position',
this inline function returns the end position of the current
heading/entry.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-list): Mark the all-todo items line as
a header line.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-inlinetask-remove-END-maybe): Declare function.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-filter-make-matcher): Allow to filter
entries that have no tags.
(org-agenda-search-view): New customize group.
(org-agenda-search-view-search-words-only): New option.
(org-search-view): Implement substring search.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-outline-level): Add doc string.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-inlinetask.el (org-inlinetask-export): Re-introduce
variable.
(org-inlinetask-export-handler): Only export inline task if the
user option calls for it.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-export-handle-export-tags): Remove inlinetask
END if present.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-latex.el (org-export-latex-tables): Don't format in
protected regions.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-src.el (org-edit-src-code)
(org-edit-src-find-region-and-lang, org-edit-src-exit): Handle
macro editing.
* org-agenda.el (org-prefix-category-max-length): New variable.
(org-format-agenda-item): Use `org-prefix-category-max-length'.
(org-compile-prefix-format): Set `org-prefix-category-max-length'.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-create-index-file): Improve the
listing of tags and todo keywords.
* org-latex.el (org-export-latex-format-image): New function.
(org-export-latex-links): Use `org-export-latex-format-image'.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-inlinetask.el (org-inlinetask-get-current-indentation)
(org-inlinetask-remove-terminator): New functions.
(org-inlinetask-export-handler): Terminate the description list.
* org-exp.el (org-export-select-backend-specific-text): Remove the
region markers.
* org-inlinetask.el (org-inlinetask-export-handler): fix bug for
tasks without content.
* org-clock.el: Make sure the clock-in target position does not
move to a different node by widening the buffer.
* org-html.el (org-export-html-format-image): Wrap image into
figure div only when there is a caption.
* org-archive.el (org-archive-mark-done): Change default value to
nil.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-context): Call `bobp', not `eobp'.
* org-clock.el (org-clock-cancel): Remove quotes from marker
variables.
* org.el (org-read-date-prefer-future): New allowed value `time'.
(org-read-date-analyze): Shift day to tomorrow depending on time
entered and value of `org-read-date-prefer-future'.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Fri, 13 Nov 2009 08:37:55 +0000 |
parents | f7147d70f6ef |
children | 1d1d5d9bd884 |
rev | line source |
---|---|
58425
f0b9b97606f9
(list-buffers-noselect): Use fixed-pitch only in the header-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58352
diff
changeset
|
1 ;;; buff-menu.el --- buffer menu main function and support functions -*- coding:utf-8 -*- |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
194
diff
changeset
|
2 |
58299
40fc4ca7acc0
(list-buffers-noselect): Massage to fit in 80 columns.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58276
diff
changeset
|
3 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 2000, 2001, 2002, 2003, |
100908 | 4 ;; 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
845 | 5 |
801
e9e34745ae3b
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
777
diff
changeset
|
6 ;; Maintainer: FSF |
39012 | 7 ;; Keywords: convenience |
194 | 8 |
9 ;; This file is part of GNU Emacs. | |
10 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92953
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
194 | 12 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92953
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92953
diff
changeset
|
14 ;; (at your option) any later version. |
194 | 15 |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92953
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
194 | 23 |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
24 ;;; Commentary: |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
25 |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
26 ;; Edit, delete, or change attributes of all currently active Emacs |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
2736
diff
changeset
|
27 ;; buffers from a list summarizing their state. A good way to browse |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
28 ;; any special or scratch buffers you have loaded, since you can't find |
39012 | 29 ;; them by filename. The single entry point is `list-buffers', |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
30 ;; normally bound to C-x C-b. |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
31 |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
32 ;;; Change Log: |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
33 |
25166
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
34 ;; Buffer-menu-view: New function |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
35 ;; Buffer-menu-view-other-window: New function |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
36 |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
37 ;; Merged by esr with recent mods to Emacs 19 buff-menu, 23 Mar 1993 |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
38 ;; |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
39 ;; Modified by Bob Weiner, Motorola, Inc., 4/14/89 |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
40 ;; |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
41 ;; Added optional backup argument to 'Buffer-menu-unmark' to make it undelete |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
42 ;; current entry and then move to previous one. |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
43 ;; |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
44 ;; Based on FSF code dating back to 1985. |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
45 |
801
e9e34745ae3b
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
777
diff
changeset
|
46 ;;; Code: |
30851
f9233f642b88
* buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents:
30828
diff
changeset
|
47 |
54580
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
48 ;;Trying to preserve the old window configuration works well in |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
49 ;;simple scenarios, when you enter the buffer menu, use it, and exit it. |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
50 ;;But it does strange things when you switch back to the buffer list buffer |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
51 ;;with C-x b, later on, when the window configuration is different. |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
52 ;;The choice seems to be, either restore the window configuration |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
53 ;;in all cases, or in no cases. |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
54 ;;I decided it was better not to restore the window config at all. -- rms. |
10592
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
55 |
54580
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
56 ;;But since then, I changed buffer-menu to use the selected window, |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
57 ;;so q now once again goes back to the previous window configuration. |
10592
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
58 |
54580
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
59 ;;(defvar Buffer-menu-window-config nil |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
60 ;; "Window configuration saved from entry to `buffer-menu'.") |
194 | 61 |
54580
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
62 ;; Put buffer *Buffer List* into proper mode right away |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
63 ;; so that from now on even list-buffers is enough to get a buffer menu. |
194 | 64 |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
65 (defgroup Buffer-menu nil |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
66 "Show a menu of all buffers in a buffer." |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
67 :group 'tools |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
68 :group 'convenience) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
69 |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
70 (defcustom Buffer-menu-use-header-line t |
100171 | 71 "Non-nil means to use an immovable header-line." |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
72 :type 'boolean |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
73 :group 'Buffer-menu) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
74 |
68228
badae83666f6
(buffer-menu-buffer) <defface>: Renamed from
Juri Linkov <juri@jurta.org>
parents:
67492
diff
changeset
|
75 (defface buffer-menu-buffer |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
76 '((t (:weight bold))) |
68228
badae83666f6
(buffer-menu-buffer) <defface>: Renamed from
Juri Linkov <juri@jurta.org>
parents:
67492
diff
changeset
|
77 "Face used to highlight buffer names in the buffer menu." |
65733
296124f7ef0e
(Buffer-menu-buffer): Remove group `font-lock-highlighting-faces'.
Juri Linkov <juri@jurta.org>
parents:
65355
diff
changeset
|
78 :group 'Buffer-menu) |
68228
badae83666f6
(buffer-menu-buffer) <defface>: Renamed from
Juri Linkov <juri@jurta.org>
parents:
67492
diff
changeset
|
79 (put 'Buffer-menu-buffer 'face-alias 'buffer-menu-buffer) |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
80 |
48889
ec1a96fb72d6
Change default width of Buffer-menu-buffer+size-width to 24
Robert J. Chassell <bob@rattlesnake.com>
parents:
48864
diff
changeset
|
81 (defcustom Buffer-menu-buffer+size-width 26 |
100171 | 82 "How wide to jointly make the buffer name and size columns." |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
83 :type 'number |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
84 :group 'Buffer-menu) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
85 |
48889
ec1a96fb72d6
Change default width of Buffer-menu-buffer+size-width to 24
Robert J. Chassell <bob@rattlesnake.com>
parents:
48864
diff
changeset
|
86 (defcustom Buffer-menu-mode-width 16 |
100171 | 87 "How wide to make the mode name column." |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
88 :type 'number |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
89 :group 'Buffer-menu) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
90 |
67327
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
91 (defcustom Buffer-menu-use-frame-buffer-list t |
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
92 "If non-nil, the Buffer Menu uses the selected frame's buffer list. |
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
93 Buffers that were never selected in that frame are listed at the end. |
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
94 If the value is nil, the Buffer Menu uses the global buffer list. |
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
95 This variable matters if the Buffer Menu is sorted by visited order, |
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
96 as it is by default." |
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
97 :type 'boolean |
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
98 :group 'Buffer-menu |
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
99 :version "22.1") |
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
100 |
54580
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
101 ;; This should get updated & resorted when you click on a column heading |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
102 (defvar Buffer-menu-sort-column nil |
77727
02de25cb97f4
(Buffer-menu-sort-column): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
77707
diff
changeset
|
103 "Which column to sort the menu on. |
02de25cb97f4
(Buffer-menu-sort-column): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
77707
diff
changeset
|
104 Use 2 to sort by buffer names, or 5 to sort by file names. |
85610
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
105 A nil value means sort by visited order (the default).") |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
106 |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
107 (defconst Buffer-menu-buffer-column 4) |
6640
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
108 |
54594
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
109 (defvar Buffer-menu-files-only nil |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
110 "Non-nil if the current buffer-menu lists only file buffers. |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
111 This variable determines whether reverting the buffer lists only |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
112 file buffers. It affects both manual reverting and reverting by |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
113 Auto Revert Mode.") |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
114 |
85610
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
115 (make-variable-buffer-local 'Buffer-menu-files-only) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
116 |
70967
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
117 (defvar Info-current-file) ;; from info.el |
72289
40a24db2adc4
(list-buffers-noselect): For Info buffers, use "(file)node" instead of the
Eli Zaretskii <eliz@gnu.org>
parents:
71516
diff
changeset
|
118 (defvar Info-current-node) ;; from info.el |
70967
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
119 |
85610
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
120 (defvar Buffer-menu-mode-map |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
121 (let ((map (make-keymap)) |
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
122 (menu-map (make-sparse-keymap))) |
85610
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
123 (suppress-keymap map t) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
124 (define-key map "v" 'Buffer-menu-select) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
125 (define-key map "2" 'Buffer-menu-2-window) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
126 (define-key map "1" 'Buffer-menu-1-window) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
127 (define-key map "f" 'Buffer-menu-this-window) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
128 (define-key map "e" 'Buffer-menu-this-window) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
129 (define-key map "\C-m" 'Buffer-menu-this-window) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
130 (define-key map "o" 'Buffer-menu-other-window) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
131 (define-key map "\C-o" 'Buffer-menu-switch-other-window) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
132 (define-key map "s" 'Buffer-menu-save) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
133 (define-key map "d" 'Buffer-menu-delete) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
134 (define-key map "k" 'Buffer-menu-delete) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
135 (define-key map "\C-d" 'Buffer-menu-delete-backwards) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
136 (define-key map "\C-k" 'Buffer-menu-delete) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
137 (define-key map "x" 'Buffer-menu-execute) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
138 (define-key map " " 'next-line) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
139 (define-key map "n" 'next-line) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
140 (define-key map "p" 'previous-line) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
141 (define-key map "\177" 'Buffer-menu-backup-unmark) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
142 (define-key map "~" 'Buffer-menu-not-modified) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
143 (define-key map "u" 'Buffer-menu-unmark) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
144 (define-key map "m" 'Buffer-menu-mark) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
145 (define-key map "t" 'Buffer-menu-visit-tags-table) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
146 (define-key map "%" 'Buffer-menu-toggle-read-only) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
147 (define-key map "b" 'Buffer-menu-bury) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
148 (define-key map "V" 'Buffer-menu-view) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
149 (define-key map "T" 'Buffer-menu-toggle-files-only) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
150 (define-key map [mouse-2] 'Buffer-menu-mouse-select) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
151 (define-key map [follow-link] 'mouse-face) |
96954
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
152 (define-key map (kbd "M-s a C-s") 'Buffer-menu-isearch-buffers) |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
153 (define-key map (kbd "M-s a M-C-s") 'Buffer-menu-isearch-buffers-regexp) |
105836
64be816ccd0e
(Buffer-menu-mode-map): Add hyphen between "Buffer"
Juri Linkov <juri@jurta.org>
parents:
105765
diff
changeset
|
154 (define-key map [menu-bar Buffer-menu-mode] (cons (purecopy "Buffer-Menu") menu-map)) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
155 (define-key menu-map [quit] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
156 `(menu-item ,(purecopy "Quit") quit-window |
105836
64be816ccd0e
(Buffer-menu-mode-map): Add hyphen between "Buffer"
Juri Linkov <juri@jurta.org>
parents:
105765
diff
changeset
|
157 :help ,(purecopy "Remove the buffer menu from the display"))) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
158 (define-key menu-map [rev] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
159 `(menu-item ,(purecopy "Refresh") revert-buffer |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
160 :help ,(purecopy "Refresh the *Buffer List* buffer contents"))) |
105940
f7147d70f6ef
* subr.el (menu-bar-separator): New defconst.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105887
diff
changeset
|
161 (define-key menu-map [s0] menu-bar-separator) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
162 (define-key menu-map [tf] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
163 `(menu-item ,(purecopy "Show only file buffers") Buffer-menu-toggle-files-only |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
164 :button (:toggle . Buffer-menu-files-only) |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
165 :help ,(purecopy "Toggle whether the current buffer-menu displays only file buffers"))) |
105940
f7147d70f6ef
* subr.el (menu-bar-separator): New defconst.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105887
diff
changeset
|
166 (define-key menu-map [s1] menu-bar-separator) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
167 ;; FIXME: The "Select" entries could use better names... |
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
168 (define-key menu-map [sel] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
169 `(menu-item ,(purecopy "Select marked") Buffer-menu-select |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
170 :help ,(purecopy "Select this line's buffer; also display buffers marked with `>'"))) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
171 (define-key menu-map [bm2] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
172 `(menu-item ,(purecopy "Select two") Buffer-menu-2-window |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
173 :help ,(purecopy "Select this line's buffer, with previous buffer in second window"))) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
174 (define-key menu-map [bm1] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
175 `(menu-item ,(purecopy "Select current") Buffer-menu-1-window |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
176 :help ,(purecopy "Select this line's buffer, alone, in full frame"))) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
177 (define-key menu-map [ow] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
178 `(menu-item ,(purecopy "Select in other window") Buffer-menu-other-window |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
179 :help ,(purecopy "Select this line's buffer in other window, leaving buffer menu visible"))) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
180 (define-key menu-map [tw] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
181 `(menu-item ,(purecopy "Select in current window") Buffer-menu-this-window |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
182 :help ,(purecopy "Select this line's buffer in this window"))) |
105940
f7147d70f6ef
* subr.el (menu-bar-separator): New defconst.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105887
diff
changeset
|
183 (define-key menu-map [s2] menu-bar-separator) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
184 (define-key menu-map [is] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
185 `(menu-item ,(purecopy "Regexp Isearch marked buffers") Buffer-menu-isearch-buffers-regexp |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
186 :help ,(purecopy "Search for a regexp through all marked buffers using Isearch"))) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
187 (define-key menu-map [ir] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
188 `(menu-item ,(purecopy "Isearch marked buffers") Buffer-menu-isearch-buffers |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
189 :help ,(purecopy "Search for a string through all marked buffers using Isearch"))) |
105940
f7147d70f6ef
* subr.el (menu-bar-separator): New defconst.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105887
diff
changeset
|
190 (define-key menu-map [s3] menu-bar-separator) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
191 (define-key menu-map [by] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
192 `(menu-item ,(purecopy "Bury") Buffer-menu-bury |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
193 :help ,(purecopy "Bury the buffer listed on this line"))) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
194 (define-key menu-map [vt] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
195 `(menu-item ,(purecopy "Set unmodified") Buffer-menu-not-modified |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
196 :help ,(purecopy "Mark buffer on this line as unmodified (no changes to save)"))) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
197 (define-key menu-map [ex] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
198 `(menu-item ,(purecopy "Execute") Buffer-menu-execute |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
199 :help ,(purecopy "Save and/or delete buffers marked with s or k commands"))) |
105940
f7147d70f6ef
* subr.el (menu-bar-separator): New defconst.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105887
diff
changeset
|
200 (define-key menu-map [s4] menu-bar-separator) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
201 (define-key menu-map [delb] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
202 `(menu-item ,(purecopy "Mark for delete and move backwards") Buffer-menu-delete-backwards |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
203 :help ,(purecopy "Mark buffer on this line to be deleted by x command and move up one line"))) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
204 (define-key menu-map [del] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
205 `(menu-item ,(purecopy "Mark for delete") Buffer-menu-delete |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
206 :help ,(purecopy "Mark buffer on this line to be deleted by x command"))) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
207 |
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
208 (define-key menu-map [sv] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
209 `(menu-item ,(purecopy "Mark for save") Buffer-menu-save |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
210 :help ,(purecopy "Mark buffer on this line to be saved by x command"))) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
211 (define-key menu-map [umk] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
212 `(menu-item ,(purecopy "Unmark") Buffer-menu-unmark |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
213 :help ,(purecopy "Cancel all requested operations on buffer on this line and move down"))) |
101214
30b48e66ac86
(Buffer-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101213
diff
changeset
|
214 (define-key menu-map [mk] |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
215 `(menu-item ,(purecopy "Mark") Buffer-menu-mark |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105595
diff
changeset
|
216 :help ,(purecopy "Mark buffer on this line for being displayed by v command"))) |
85610
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
217 map) |
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
218 "Local keymap for `Buffer-menu-mode' buffers.") |
194 | 219 |
220 ;; Buffer Menu mode is suitable only for specially formatted data. | |
221 (put 'Buffer-menu-mode 'mode-class 'special) | |
222 | |
101208
fe8f14e36526
(Buffer-menu-mode): Derive from special-mode.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100908
diff
changeset
|
223 (define-derived-mode Buffer-menu-mode special-mode "Buffer Menu" |
194 | 224 "Major mode for editing a list of buffers. |
225 Each line describes one of the buffers in Emacs. | |
226 Letters do not insert themselves; instead, they are commands. | |
227 \\<Buffer-menu-mode-map> | |
6609
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
228 \\[Buffer-menu-mouse-select] -- select buffer you click on, in place of the buffer menu. |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
229 \\[Buffer-menu-this-window] -- select current line's buffer in place of the buffer menu. |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
230 \\[Buffer-menu-other-window] -- select that buffer in another window, |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
231 so the buffer menu buffer remains visible in its window. |
25166
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
232 \\[Buffer-menu-view] -- select current line's buffer, but in view-mode. |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
233 \\[Buffer-menu-view-other-window] -- select that buffer in |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
234 another window, in view-mode. |
6609
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
235 \\[Buffer-menu-switch-other-window] -- make another window display that buffer. |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
236 \\[Buffer-menu-mark] -- mark current line's buffer to be displayed. |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
237 \\[Buffer-menu-select] -- select current line's buffer. |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
238 Also show buffers marked with m, in other windows. |
777 | 239 \\[Buffer-menu-1-window] -- select that buffer in full-frame window. |
194 | 240 \\[Buffer-menu-2-window] -- select that buffer in one window, |
241 together with buffer selected before this one in another window. | |
96957
b4a078aa9b15
(Buffer-menu-mode): Document new commands in docstring.
Juri Linkov <juri@jurta.org>
parents:
96954
diff
changeset
|
242 \\[Buffer-menu-isearch-buffers] -- Do incremental search in the marked buffers. |
b4a078aa9b15
(Buffer-menu-mode): Document new commands in docstring.
Juri Linkov <juri@jurta.org>
parents:
96954
diff
changeset
|
243 \\[Buffer-menu-isearch-buffers-regexp] -- Isearch for regexp in the marked buffers. |
194 | 244 \\[Buffer-menu-visit-tags-table] -- visit-tags-table this buffer. |
245 \\[Buffer-menu-not-modified] -- clear modified-flag on that buffer. | |
246 \\[Buffer-menu-save] -- mark that buffer to be saved, and move down. | |
247 \\[Buffer-menu-delete] -- mark that buffer to be deleted, and move down. | |
248 \\[Buffer-menu-delete-backwards] -- mark that buffer to be deleted, and move up. | |
249 \\[Buffer-menu-execute] -- delete or save marked buffers. | |
250 \\[Buffer-menu-unmark] -- remove all kinds of marks from current line. | |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
251 With prefix argument, also move up one line. |
2378
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
252 \\[Buffer-menu-backup-unmark] -- back up a line and remove marks. |
16401
249f797c3750
(Buffer-menu-revert): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
253 \\[Buffer-menu-toggle-read-only] -- toggle read-only status of buffer on this line. |
101208
fe8f14e36526
(Buffer-menu-mode): Derive from special-mode.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100908
diff
changeset
|
254 \\[revert-buffer] -- update the list of buffers. |
54594
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
255 \\[Buffer-menu-toggle-files-only] -- toggle whether the menu displays only file buffers. |
18280
f693db11df45
(Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18278
diff
changeset
|
256 \\[Buffer-menu-bury] -- bury the buffer listed on this line." |
54594
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
257 (set (make-local-variable 'revert-buffer-function) |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
258 'Buffer-menu-revert-function) |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
259 (set (make-local-variable 'buffer-stale-function) |
54670
e30c06266ba0
(Buffer-menu-mode): Make the buffer-stale-function return `fast'.
Luc Teirlinck <teirllm@auburn.edu>
parents:
54594
diff
changeset
|
260 #'(lambda (&optional noconfirm) 'fast)) |
194 | 261 (setq truncate-lines t) |
85610
e8808cf949cd
(Buffer-menu-sort-column): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
78236
diff
changeset
|
262 (setq buffer-read-only t)) |
8161
6b104526819d
(Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7659
diff
changeset
|
263 |
97960
f0549c923102
(buffer-menu-mode-hook): Add obsolete alias.
Glenn Morris <rgm@gnu.org>
parents:
96957
diff
changeset
|
264 (define-obsolete-variable-alias 'buffer-menu-mode-hook |
f0549c923102
(buffer-menu-mode-hook): Add obsolete alias.
Glenn Morris <rgm@gnu.org>
parents:
96957
diff
changeset
|
265 'Buffer-menu-mode-hook "23.1") |
f0549c923102
(buffer-menu-mode-hook): Add obsolete alias.
Glenn Morris <rgm@gnu.org>
parents:
96957
diff
changeset
|
266 |
8161
6b104526819d
(Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7659
diff
changeset
|
267 (defun Buffer-menu-revert-function (ignore1 ignore2) |
59092
49971daa80c5
(Buffer-menu-revert-function): Clear out undo info before reverting
Luc Teirlinck <teirllm@auburn.edu>
parents:
58955
diff
changeset
|
268 (or (eq buffer-undo-list t) |
49971daa80c5
(Buffer-menu-revert-function): Clear out undo info before reverting
Luc Teirlinck <teirllm@auburn.edu>
parents:
58955
diff
changeset
|
269 (setq buffer-undo-list nil)) |
54594
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
270 ;; We can not use save-excursion here. The buffer gets erased. |
62703
a078b317d07c
(Buffer-menu-revert-function): Improve handling of point after reverting.
Luc Teirlinck <teirllm@auburn.edu>
parents:
62634
diff
changeset
|
271 (let ((opoint (point)) |
a078b317d07c
(Buffer-menu-revert-function): Improve handling of point after reverting.
Luc Teirlinck <teirllm@auburn.edu>
parents:
62634
diff
changeset
|
272 (eobp (eobp)) |
a078b317d07c
(Buffer-menu-revert-function): Improve handling of point after reverting.
Luc Teirlinck <teirllm@auburn.edu>
parents:
62634
diff
changeset
|
273 (ocol (current-column)) |
57555
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
274 (oline (progn (move-to-column 4) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
275 (get-text-property (point) 'buffer))) |
59092
49971daa80c5
(Buffer-menu-revert-function): Clear out undo info before reverting
Luc Teirlinck <teirllm@auburn.edu>
parents:
58955
diff
changeset
|
276 (prop (point-min)) |
49971daa80c5
(Buffer-menu-revert-function): Clear out undo info before reverting
Luc Teirlinck <teirllm@auburn.edu>
parents:
58955
diff
changeset
|
277 ;; do not make undo records for the reversion. |
49971daa80c5
(Buffer-menu-revert-function): Clear out undo info before reverting
Luc Teirlinck <teirllm@auburn.edu>
parents:
58955
diff
changeset
|
278 (buffer-undo-list t)) |
67170
82157c2afd44
(Buffer-menu-revert-function): Make the selected window's buffer the
Luc Teirlinck <teirllm@auburn.edu>
parents:
65733
diff
changeset
|
279 ;; We can be called by Auto Revert Mode with the "*Buffer Menu*" |
82157c2afd44
(Buffer-menu-revert-function): Make the selected window's buffer the
Luc Teirlinck <teirllm@auburn.edu>
parents:
65733
diff
changeset
|
280 ;; temporarily the current buffer. Make sure that the |
82157c2afd44
(Buffer-menu-revert-function): Make the selected window's buffer the
Luc Teirlinck <teirllm@auburn.edu>
parents:
65733
diff
changeset
|
281 ;; interactively current buffer is correctly identified with a `.' |
82157c2afd44
(Buffer-menu-revert-function): Make the selected window's buffer the
Luc Teirlinck <teirllm@auburn.edu>
parents:
65733
diff
changeset
|
282 ;; by `list-buffers-noselect'. |
82157c2afd44
(Buffer-menu-revert-function): Make the selected window's buffer the
Luc Teirlinck <teirllm@auburn.edu>
parents:
65733
diff
changeset
|
283 (with-current-buffer (window-buffer) |
82157c2afd44
(Buffer-menu-revert-function): Make the selected window's buffer the
Luc Teirlinck <teirllm@auburn.edu>
parents:
65733
diff
changeset
|
284 (list-buffers-noselect Buffer-menu-files-only)) |
62703
a078b317d07c
(Buffer-menu-revert-function): Improve handling of point after reverting.
Luc Teirlinck <teirllm@auburn.edu>
parents:
62634
diff
changeset
|
285 (if oline |
a078b317d07c
(Buffer-menu-revert-function): Improve handling of point after reverting.
Luc Teirlinck <teirllm@auburn.edu>
parents:
62634
diff
changeset
|
286 (while (setq prop (next-single-property-change prop 'buffer)) |
a078b317d07c
(Buffer-menu-revert-function): Improve handling of point after reverting.
Luc Teirlinck <teirllm@auburn.edu>
parents:
62634
diff
changeset
|
287 (when (eq (get-text-property prop 'buffer) oline) |
a078b317d07c
(Buffer-menu-revert-function): Improve handling of point after reverting.
Luc Teirlinck <teirllm@auburn.edu>
parents:
62634
diff
changeset
|
288 (goto-char prop) |
a078b317d07c
(Buffer-menu-revert-function): Improve handling of point after reverting.
Luc Teirlinck <teirllm@auburn.edu>
parents:
62634
diff
changeset
|
289 (move-to-column ocol))) |
a078b317d07c
(Buffer-menu-revert-function): Improve handling of point after reverting.
Luc Teirlinck <teirllm@auburn.edu>
parents:
62634
diff
changeset
|
290 (goto-char (if eobp (point-max) opoint))))) |
54594
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
291 |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
292 (defun Buffer-menu-toggle-files-only (arg) |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
293 "Toggle whether the current buffer-menu displays only file buffers. |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
294 With a positive ARG display only file buffers. With zero or |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
295 negative ARG, display other buffers as well." |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
296 (interactive "P") |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
297 (setq Buffer-menu-files-only |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
298 (cond ((not arg) (not Buffer-menu-files-only)) |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
299 ((> (prefix-numeric-value arg) 0) t))) |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
300 (revert-buffer)) |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
301 |
194 | 302 |
303 (defun Buffer-menu-buffer (error-if-non-existent-p) | |
304 "Return buffer described by this line of buffer menu." | |
11215
896932ac8ced
(list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents:
10765
diff
changeset
|
305 (let* ((where (save-excursion |
896932ac8ced
(list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents:
10765
diff
changeset
|
306 (beginning-of-line) |
896932ac8ced
(list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents:
10765
diff
changeset
|
307 (+ (point) Buffer-menu-buffer-column))) |
30828
26dae0a7f527
(list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents:
30824
diff
changeset
|
308 (name (and (not (eobp)) (get-text-property where 'buffer-name))) |
26dae0a7f527
(list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents:
30824
diff
changeset
|
309 (buf (and (not (eobp)) (get-text-property where 'buffer)))) |
11215
896932ac8ced
(list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents:
10765
diff
changeset
|
310 (if name |
896932ac8ced
(list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents:
10765
diff
changeset
|
311 (or (get-buffer name) |
30828
26dae0a7f527
(list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents:
30824
diff
changeset
|
312 (and buf (buffer-name buf) buf) |
11215
896932ac8ced
(list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents:
10765
diff
changeset
|
313 (if error-if-non-existent-p |
896932ac8ced
(list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents:
10765
diff
changeset
|
314 (error "No buffer named `%s'" name) |
896932ac8ced
(list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents:
10765
diff
changeset
|
315 nil)) |
30828
26dae0a7f527
(list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents:
30824
diff
changeset
|
316 (or (and buf (buffer-name buf) buf) |
50033
cd78fe221607
(Buffer-menu-mode-map): Add docstring.
John Paul Wallington <jpw@pobox.com>
parents:
49155
diff
changeset
|
317 (if error-if-non-existent-p |
cd78fe221607
(Buffer-menu-mode-map): Add docstring.
John Paul Wallington <jpw@pobox.com>
parents:
49155
diff
changeset
|
318 (error "No buffer on this line") |
30828
26dae0a7f527
(list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents:
30824
diff
changeset
|
319 nil))))) |
194 | 320 |
756 | 321 (defun buffer-menu (&optional arg) |
194 | 322 "Make a menu of buffers so you can save, delete or select them. |
323 With argument, show only buffers that are visiting files. | |
324 Type ? after invocation to get help on commands available. | |
40622
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
325 Type q to remove the buffer menu from the display. |
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
326 |
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
327 The first column shows `>' for a buffer you have |
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
328 marked to be displayed, `D' for one you have marked for |
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
329 deletion, and `.' for the current buffer. |
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
330 |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
331 The C column has a `.' for the buffer from which you came. |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
332 The R column has a `%' if the buffer is read-only. |
40622
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
333 The M column has a `*' if it is modified, |
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
334 or `S' if you have marked it for saving. |
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
335 After this come the buffer name, its size in characters, |
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
336 its major mode, and the visited file name (if any)." |
194 | 337 (interactive "P") |
2736
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
338 ;;; (setq Buffer-menu-window-config (current-window-configuration)) |
10592
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
339 (switch-to-buffer (list-buffers-noselect arg)) |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
340 (message |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
341 "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %%; q to quit; ? for help.")) |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
342 |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
343 (defun buffer-menu-other-window (&optional arg) |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
344 "Display a list of buffers in another window. |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
345 With the buffer list buffer, you can save, delete or select the buffers. |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
346 With argument, show only buffers that are visiting files. |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
347 Type ? after invocation to get help on commands available. |
40622
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
348 Type q to remove the buffer menu from the display. |
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
349 For more information, see the function `buffer-menu'." |
10592
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
350 (interactive "P") |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
351 ;;; (setq Buffer-menu-window-config (current-window-configuration)) |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
352 (switch-to-buffer-other-window (list-buffers-noselect arg)) |
194 | 353 (message |
2736
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
354 "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %%; q to quit; ? for help.")) |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
355 |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
356 (defun Buffer-menu-no-header () |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
357 (beginning-of-line) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
358 (if (or Buffer-menu-use-header-line |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
359 (not (eq (char-after) ?C))) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
360 t |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
361 (ding) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
362 (forward-line 1) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
363 nil)) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
364 |
194 | 365 (defun Buffer-menu-mark () |
366 "Mark buffer on this line for being displayed by \\<Buffer-menu-mode-map>\\[Buffer-menu-select] command." | |
367 (interactive) | |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
368 (when (Buffer-menu-no-header) |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
369 (let ((inhibit-read-only t)) |
194 | 370 (delete-char 1) |
371 (insert ?>) | |
372 (forward-line 1)))) | |
373 | |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
374 (defun Buffer-menu-unmark (&optional backup) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
375 "Cancel all requested operations on buffer on this line and move down. |
64529
8b0db2e8ccd3
(Buffer-menu-unmark): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
376 Optional prefix arg means move up." |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
377 (interactive "P") |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
378 (when (Buffer-menu-no-header) |
194 | 379 (let* ((buf (Buffer-menu-buffer t)) |
380 (mod (buffer-modified-p buf)) | |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
381 (readonly (with-current-buffer buf buffer-read-only)) |
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
382 (inhibit-read-only t)) |
194 | 383 (delete-char 3) |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
384 (insert (if readonly (if mod " %*" " % ") (if mod " *" " "))))) |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
385 (forward-line (if backup -1 1))) |
194 | 386 |
387 (defun Buffer-menu-backup-unmark () | |
388 "Move up and cancel all requested operations on buffer on line above." | |
389 (interactive) | |
390 (forward-line -1) | |
391 (Buffer-menu-unmark) | |
392 (forward-line -1)) | |
393 | |
9063
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
394 (defun Buffer-menu-delete (&optional arg) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
395 "Mark buffer on this line to be deleted by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command. |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
396 Prefix arg is how many buffers to delete. |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
397 Negative arg means delete backwards." |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
398 (interactive "p") |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
399 (when (Buffer-menu-no-header) |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
400 (let ((inhibit-read-only t)) |
9063
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
401 (if (or (null arg) (= arg 0)) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
402 (setq arg 1)) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
403 (while (> arg 0) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
404 (delete-char 1) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
405 (insert ?D) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
406 (forward-line 1) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
407 (setq arg (1- arg))) |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
408 (while (and (< arg 0) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
409 (Buffer-menu-no-header)) |
9063
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
410 (delete-char 1) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
411 (insert ?D) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
412 (forward-line -1) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
413 (setq arg (1+ arg)))))) |
194 | 414 |
9063
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
415 (defun Buffer-menu-delete-backwards (&optional arg) |
194 | 416 "Mark buffer on this line to be deleted by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command |
9063
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
417 and then move up one line. Prefix arg means move that many lines." |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
418 (interactive "p") |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
419 (Buffer-menu-delete (- (or arg 1)))) |
194 | 420 |
421 (defun Buffer-menu-save () | |
422 "Mark buffer on this line to be saved by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command." | |
423 (interactive) | |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
424 (when (Buffer-menu-no-header) |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
425 (let ((inhibit-read-only t)) |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
426 (forward-char 2) |
194 | 427 (delete-char 1) |
428 (insert ?S) | |
429 (forward-line 1)))) | |
430 | |
8196
89db3662bcec
(Buffer-menu-not-modified): Make `Buffer-menu-not-modified' handle an
Richard M. Stallman <rms@gnu.org>
parents:
8161
diff
changeset
|
431 (defun Buffer-menu-not-modified (&optional arg) |
194 | 432 "Mark buffer on this line as unmodified (no changes to save)." |
8196
89db3662bcec
(Buffer-menu-not-modified): Make `Buffer-menu-not-modified' handle an
Richard M. Stallman <rms@gnu.org>
parents:
8161
diff
changeset
|
433 (interactive "P") |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
434 (with-current-buffer (Buffer-menu-buffer t) |
8196
89db3662bcec
(Buffer-menu-not-modified): Make `Buffer-menu-not-modified' handle an
Richard M. Stallman <rms@gnu.org>
parents:
8161
diff
changeset
|
435 (set-buffer-modified-p arg)) |
194 | 436 (save-excursion |
437 (beginning-of-line) | |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
438 (forward-char 2) |
64529
8b0db2e8ccd3
(Buffer-menu-unmark): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
439 (if (= (char-after) (if arg ?\s ?*)) |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
440 (let ((inhibit-read-only t)) |
194 | 441 (delete-char 1) |
64529
8b0db2e8ccd3
(Buffer-menu-unmark): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
442 (insert (if arg ?* ?\s)))))) |
194 | 443 |
57555
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
444 (defun Buffer-menu-beginning () |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
445 (goto-char (point-min)) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
446 (unless Buffer-menu-use-header-line |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
447 (forward-line))) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
448 |
194 | 449 (defun Buffer-menu-execute () |
450 "Save and/or delete buffers marked with \\<Buffer-menu-mode-map>\\[Buffer-menu-save] or \\<Buffer-menu-mode-map>\\[Buffer-menu-delete] commands." | |
451 (interactive) | |
452 (save-excursion | |
57555
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
453 (Buffer-menu-beginning) |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
454 (while (re-search-forward "^..S" nil t) |
194 | 455 (let ((modp nil)) |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
456 (with-current-buffer (Buffer-menu-buffer t) |
194 | 457 (save-buffer) |
458 (setq modp (buffer-modified-p))) | |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
459 (let ((inhibit-read-only t)) |
194 | 460 (delete-char -1) |
64529
8b0db2e8ccd3
(Buffer-menu-unmark): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
461 (insert (if modp ?* ?\s)))))) |
194 | 462 (save-excursion |
57555
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
463 (Buffer-menu-beginning) |
194 | 464 (let ((buff-menu-buffer (current-buffer)) |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
465 (inhibit-read-only t)) |
49050
8b38bac9826a
(Buffer-menu-execute): Fix for effect of header
Dave Love <fx@gnu.org>
parents:
49046
diff
changeset
|
466 (while (re-search-forward "^D" nil t) |
194 | 467 (forward-char -1) |
468 (let ((buf (Buffer-menu-buffer nil))) | |
469 (or (eq buf nil) | |
470 (eq buf buff-menu-buffer) | |
30828
26dae0a7f527
(list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents:
30824
diff
changeset
|
471 (save-excursion (kill-buffer buf))) |
26dae0a7f527
(list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents:
30824
diff
changeset
|
472 (if (and buf (buffer-name buf)) |
194 | 473 (progn (delete-char 1) |
64529
8b0db2e8ccd3
(Buffer-menu-unmark): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
474 (insert ?\s)) |
194 | 475 (delete-region (point) (progn (forward-line 1) (point))) |
49050
8b38bac9826a
(Buffer-menu-execute): Fix for effect of header
Dave Love <fx@gnu.org>
parents:
49046
diff
changeset
|
476 (unless (bobp) |
8b38bac9826a
(Buffer-menu-execute): Fix for effect of header
Dave Love <fx@gnu.org>
parents:
49046
diff
changeset
|
477 (forward-char -1)))))))) |
194 | 478 |
479 (defun Buffer-menu-select () | |
480 "Select this line's buffer; also display buffers marked with `>'. | |
10592
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
481 You can mark buffers with the \\<Buffer-menu-mode-map>\\[Buffer-menu-mark] command. |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
482 This command deletes and replaces all the previously existing windows |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
483 in the selected frame." |
194 | 484 (interactive) |
485 (let ((buff (Buffer-menu-buffer t)) | |
30851
f9233f642b88
* buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents:
30828
diff
changeset
|
486 (menu (current-buffer)) |
194 | 487 (others ()) |
488 tem) | |
57555
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
489 (Buffer-menu-beginning) |
49155
e8a430c172dc
(Buffer-menu-select): Fix for effect of header line.
Andreas Schwab <schwab@suse.de>
parents:
49050
diff
changeset
|
490 (while (re-search-forward "^>" nil t) |
194 | 491 (setq tem (Buffer-menu-buffer t)) |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
492 (let ((inhibit-read-only t)) |
194 | 493 (delete-char -1) |
64529
8b0db2e8ccd3
(Buffer-menu-unmark): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
494 (insert ?\s)) |
194 | 495 (or (eq tem buff) (memq tem others) (setq others (cons tem others)))) |
496 (setq others (nreverse others) | |
777 | 497 tem (/ (1- (frame-height)) (1+ (length others)))) |
194 | 498 (delete-other-windows) |
499 (switch-to-buffer buff) | |
500 (or (eq menu buff) | |
501 (bury-buffer menu)) | |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
502 (if (equal (length others) 0) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
503 (progn |
2736
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
504 ;;; ;; Restore previous window configuration before displaying |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
505 ;;; ;; selected buffers. |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
506 ;;; (if Buffer-menu-window-config |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
507 ;;; (progn |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
508 ;;; (set-window-configuration Buffer-menu-window-config) |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
509 ;;; (setq Buffer-menu-window-config nil))) |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
510 (switch-to-buffer buff)) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
511 (while others |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
512 (split-window nil tem) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
513 (other-window 1) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
514 (switch-to-buffer (car others)) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
515 (setq others (cdr others))) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
516 (other-window 1) ;back to the beginning! |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
517 ))) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
518 |
96954
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
519 (defun Buffer-menu-marked-buffers () |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
520 "Return a list of buffers marked with the \\<Buffer-menu-mode-map>\\[Buffer-menu-mark] command." |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
521 (let (buffers) |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
522 (Buffer-menu-beginning) |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
523 (while (re-search-forward "^>" nil t) |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
524 (setq buffers (cons (Buffer-menu-buffer t) buffers))) |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
525 (nreverse buffers))) |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
526 |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
527 (defun Buffer-menu-isearch-buffers () |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
528 "Search for a string through all marked buffers using Isearch." |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
529 (interactive) |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
530 (multi-isearch-buffers (Buffer-menu-marked-buffers))) |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
531 |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
532 (defun Buffer-menu-isearch-buffers-regexp () |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
533 "Search for a regexp through all marked buffers using Isearch." |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
534 (interactive) |
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
535 (multi-isearch-buffers-regexp (Buffer-menu-marked-buffers))) |
10592
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
536 |
194 | 537 |
538 (defun Buffer-menu-visit-tags-table () | |
539 "Visit the tags table in the buffer on this line. See `visit-tags-table'." | |
540 (interactive) | |
541 (let ((file (buffer-file-name (Buffer-menu-buffer t)))) | |
542 (if file | |
543 (visit-tags-table file) | |
544 (error "Specified buffer has no file")))) | |
545 | |
546 (defun Buffer-menu-1-window () | |
777 | 547 "Select this line's buffer, alone, in full frame." |
194 | 548 (interactive) |
549 (switch-to-buffer (Buffer-menu-buffer t)) | |
550 (bury-buffer (other-buffer)) | |
551 (delete-other-windows)) | |
552 | |
6609
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
553 (defun Buffer-menu-mouse-select (event) |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
554 "Select the buffer whose line you click on." |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
555 (interactive "e") |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
556 (let (buffer) |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
557 (with-current-buffer (window-buffer (posn-window (event-end event))) |
6609
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
558 (save-excursion |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
559 (goto-char (posn-point (event-end event))) |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
560 (setq buffer (Buffer-menu-buffer t)))) |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
561 (select-window (posn-window (event-end event))) |
7659
ed3bbbdd9ef5
(Buffer-menu-mouse-select): Handle dedicated window.
Richard M. Stallman <rms@gnu.org>
parents:
7298
diff
changeset
|
562 (if (and (window-dedicated-p (selected-window)) |
ed3bbbdd9ef5
(Buffer-menu-mouse-select): Handle dedicated window.
Richard M. Stallman <rms@gnu.org>
parents:
7298
diff
changeset
|
563 (eq (selected-window) (frame-root-window))) |
ed3bbbdd9ef5
(Buffer-menu-mouse-select): Handle dedicated window.
Richard M. Stallman <rms@gnu.org>
parents:
7298
diff
changeset
|
564 (switch-to-buffer-other-frame buffer) |
ed3bbbdd9ef5
(Buffer-menu-mouse-select): Handle dedicated window.
Richard M. Stallman <rms@gnu.org>
parents:
7298
diff
changeset
|
565 (switch-to-buffer buffer)))) |
6609
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
566 |
194 | 567 (defun Buffer-menu-this-window () |
568 "Select this line's buffer in this window." | |
569 (interactive) | |
570 (switch-to-buffer (Buffer-menu-buffer t))) | |
571 | |
572 (defun Buffer-menu-other-window () | |
573 "Select this line's buffer in other window, leaving buffer menu visible." | |
574 (interactive) | |
575 (switch-to-buffer-other-window (Buffer-menu-buffer t))) | |
576 | |
735 | 577 (defun Buffer-menu-switch-other-window () |
578 "Make the other window select this line's buffer. | |
579 The current window remains selected." | |
580 (interactive) | |
58955
58f1100f0a9e
(Buffer-menu-switch-other-window): Bind pop-up-windows to t.
Juri Linkov <juri@jurta.org>
parents:
58954
diff
changeset
|
581 (let ((pop-up-windows t) |
58f1100f0a9e
(Buffer-menu-switch-other-window): Bind pop-up-windows to t.
Juri Linkov <juri@jurta.org>
parents:
58954
diff
changeset
|
582 same-window-buffer-names |
58f1100f0a9e
(Buffer-menu-switch-other-window): Bind pop-up-windows to t.
Juri Linkov <juri@jurta.org>
parents:
58954
diff
changeset
|
583 same-window-regexps) |
58f1100f0a9e
(Buffer-menu-switch-other-window): Bind pop-up-windows to t.
Juri Linkov <juri@jurta.org>
parents:
58954
diff
changeset
|
584 (display-buffer (Buffer-menu-buffer t)))) |
735 | 585 |
194 | 586 (defun Buffer-menu-2-window () |
587 "Select this line's buffer, with previous buffer in second window." | |
588 (interactive) | |
589 (let ((buff (Buffer-menu-buffer t)) | |
590 (menu (current-buffer)) | |
58955
58f1100f0a9e
(Buffer-menu-switch-other-window): Bind pop-up-windows to t.
Juri Linkov <juri@jurta.org>
parents:
58954
diff
changeset
|
591 (pop-up-windows t) |
58f1100f0a9e
(Buffer-menu-switch-other-window): Bind pop-up-windows to t.
Juri Linkov <juri@jurta.org>
parents:
58954
diff
changeset
|
592 same-window-buffer-names |
58f1100f0a9e
(Buffer-menu-switch-other-window): Bind pop-up-windows to t.
Juri Linkov <juri@jurta.org>
parents:
58954
diff
changeset
|
593 same-window-regexps) |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
594 (delete-other-windows) |
194 | 595 (switch-to-buffer (other-buffer)) |
596 (pop-to-buffer buff) | |
597 (bury-buffer menu))) | |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
194
diff
changeset
|
598 |
2378
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
599 (defun Buffer-menu-toggle-read-only () |
6084
d42c85701055
(Buffer-menu-toggle-read-only): Change toggle-read-only to
Karl Heuer <kwzh@gnu.org>
parents:
3591
diff
changeset
|
600 "Toggle read-only status of buffer on this line, perhaps via version control." |
2378
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
601 (interactive) |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
602 (let (char) |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
603 (with-current-buffer (Buffer-menu-buffer t) |
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
604 (toggle-read-only) |
64529
8b0db2e8ccd3
(Buffer-menu-unmark): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
605 (setq char (if buffer-read-only ?% ?\s))) |
2378
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
606 (save-excursion |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
607 (beginning-of-line) |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
608 (forward-char 1) |
2378
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
609 (if (/= (following-char) char) |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
610 (let ((inhibit-read-only t)) |
2378
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
611 (delete-char 1) |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
612 (insert char)))))) |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
613 |
18278
4f78346eb734
(Buffer-menu-bury): New command.
Richard M. Stallman <rms@gnu.org>
parents:
16401
diff
changeset
|
614 (defun Buffer-menu-bury () |
4f78346eb734
(Buffer-menu-bury): New command.
Richard M. Stallman <rms@gnu.org>
parents:
16401
diff
changeset
|
615 "Bury the buffer listed on this line." |
4f78346eb734
(Buffer-menu-bury): New command.
Richard M. Stallman <rms@gnu.org>
parents:
16401
diff
changeset
|
616 (interactive) |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
617 (when (Buffer-menu-no-header) |
18280
f693db11df45
(Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18278
diff
changeset
|
618 (save-excursion |
f693db11df45
(Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18278
diff
changeset
|
619 (beginning-of-line) |
f693db11df45
(Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18278
diff
changeset
|
620 (bury-buffer (Buffer-menu-buffer t)) |
f693db11df45
(Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18278
diff
changeset
|
621 (let ((line (buffer-substring (point) (progn (forward-line 1) (point)))) |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
622 (inhibit-read-only t)) |
18280
f693db11df45
(Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18278
diff
changeset
|
623 (delete-region (point) (progn (forward-line -1) (point))) |
f693db11df45
(Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18278
diff
changeset
|
624 (goto-char (point-max)) |
f693db11df45
(Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18278
diff
changeset
|
625 (insert line)) |
f693db11df45
(Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18278
diff
changeset
|
626 (message "Buried buffer moved to the end")))) |
25166
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
627 |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
628 |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
629 (defun Buffer-menu-view () |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
630 "View this line's buffer in View mode." |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
631 (interactive) |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
632 (view-buffer (Buffer-menu-buffer t))) |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
633 |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
634 |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
635 (defun Buffer-menu-view-other-window () |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
636 "View this line's buffer in View mode in another window." |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
637 (interactive) |
e8ec0085ff7b
(Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents:
21093
diff
changeset
|
638 (view-buffer-other-window (Buffer-menu-buffer t))) |
10419
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
639 |
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
640 |
105595
aa17a8adf478
(list-buffers, ctl-x-map): Mark the entry points with ;;;###autoload cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101214
diff
changeset
|
641 ;;;###autoload |
10419
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
642 (define-key ctl-x-map "\C-b" 'list-buffers) |
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
643 |
105595
aa17a8adf478
(list-buffers, ctl-x-map): Mark the entry points with ;;;###autoload cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101214
diff
changeset
|
644 ;;;###autoload |
10419
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
645 (defun list-buffers (&optional files-only) |
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
646 "Display a list of names of existing buffers. |
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
647 The list is displayed in a buffer named `*Buffer List*'. |
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
648 Note that buffers with names starting with spaces are omitted. |
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
649 Non-null optional arg FILES-ONLY means mention only file buffers. |
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
650 |
40622
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
651 For more information, see the function `buffer-menu'." |
10419
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
652 (interactive "P") |
10592
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
653 (display-buffer (list-buffers-noselect files-only))) |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
654 |
99755
8474e0f67804
(Buffer-menu-short-ellipsis): Partly undo last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99749
diff
changeset
|
655 (defconst Buffer-menu-short-ellipsis |
8474e0f67804
(Buffer-menu-short-ellipsis): Partly undo last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99749
diff
changeset
|
656 ;; This file is preloaded, so we can't use char-displayable-p here |
8474e0f67804
(Buffer-menu-short-ellipsis): Partly undo last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99749
diff
changeset
|
657 ;; because we don't know yet what display we're going to connect to. |
8474e0f67804
(Buffer-menu-short-ellipsis): Partly undo last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99749
diff
changeset
|
658 ":" ;; (if (char-displayable-p ?…) "…" ":") |
8474e0f67804
(Buffer-menu-short-ellipsis): Partly undo last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99749
diff
changeset
|
659 ) |
99749
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
660 |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
661 (defun Buffer-menu-buffer+size (name size &optional name-props size-props) |
99749
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
662 (if (> (+ (string-width name) (string-width size) 2) |
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
663 Buffer-menu-buffer+size-width) |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
664 (setq name |
99749
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
665 (let ((tail |
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
666 (if (string-match "<[0-9]+>$" name) |
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
667 (match-string 0 name) |
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
668 ""))) |
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
669 (concat (truncate-string-to-width |
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
670 name |
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
671 (- Buffer-menu-buffer+size-width |
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
672 (max (string-width size) 3) |
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
673 (string-width tail) |
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
674 2)) |
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
675 Buffer-menu-short-ellipsis |
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
676 tail))) |
49046
d6e1c5f7f468
(Buffer-menu-buffer+size): Don't clobber buffer name.
Andreas Schwab <schwab@suse.de>
parents:
48889
diff
changeset
|
677 ;; Don't put properties on (buffer-name). |
d6e1c5f7f468
(Buffer-menu-buffer+size): Don't clobber buffer name.
Andreas Schwab <schwab@suse.de>
parents:
48889
diff
changeset
|
678 (setq name (copy-sequence name))) |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
679 (add-text-properties 0 (length name) name-props name) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
680 (add-text-properties 0 (length size) size-props size) |
105887
c17b71571661
* buff-menu.el (Buffer-menu-buffer+size): Use display property to
Chong Yidong <cyd@stupidchicken.com>
parents:
105836
diff
changeset
|
681 (let ((name+space-width (- Buffer-menu-buffer+size-width |
c17b71571661
* buff-menu.el (Buffer-menu-buffer+size): Use display property to
Chong Yidong <cyd@stupidchicken.com>
parents:
105836
diff
changeset
|
682 (string-width size)))) |
c17b71571661
* buff-menu.el (Buffer-menu-buffer+size): Use display property to
Chong Yidong <cyd@stupidchicken.com>
parents:
105836
diff
changeset
|
683 (concat name |
c17b71571661
* buff-menu.el (Buffer-menu-buffer+size): Use display property to
Chong Yidong <cyd@stupidchicken.com>
parents:
105836
diff
changeset
|
684 (propertize (make-string (- name+space-width (string-width name)) |
c17b71571661
* buff-menu.el (Buffer-menu-buffer+size): Use display property to
Chong Yidong <cyd@stupidchicken.com>
parents:
105836
diff
changeset
|
685 ?\s) |
c17b71571661
* buff-menu.el (Buffer-menu-buffer+size): Use display property to
Chong Yidong <cyd@stupidchicken.com>
parents:
105836
diff
changeset
|
686 'display `(space :align-to ,(+ 4 name+space-width))) |
c17b71571661
* buff-menu.el (Buffer-menu-buffer+size): Use display property to
Chong Yidong <cyd@stupidchicken.com>
parents:
105836
diff
changeset
|
687 size))) |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
688 |
54580
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
689 (defun Buffer-menu-sort (column) |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
690 "Sort the buffer menu by COLUMN." |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
691 (interactive "P") |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
692 (when column |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
693 (setq column (prefix-numeric-value column)) |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
694 (if (< column 2) (setq column 2)) |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
695 (if (> column 5) (setq column 5))) |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
696 (setq Buffer-menu-sort-column column) |
96276
5f58c2a66de7
* buff-menu.el: Use with-current-buffer and inhibit-read-only.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
697 (let ((inhibit-read-only t) l buf m1 m2) |
57555
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
698 (save-excursion |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
699 (Buffer-menu-beginning) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
700 (while (not (eobp)) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
701 (when (buffer-live-p (setq buf (get-text-property (+ (point) 4) 'buffer))) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
702 (setq m1 (char-after) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
703 m1 (if (memq m1 '(?> ?D)) m1) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
704 m2 (char-after (+ (point) 2)) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
705 m2 (if (eq m2 ?S) m2)) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
706 (if (or m1 m2) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
707 (push (list buf m1 m2) l))) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
708 (forward-line))) |
101213
6de6a0cbf0c3
(Buffer-menu-sort): Use revert-buffer, not Buffer-menu-revert.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101208
diff
changeset
|
709 (revert-buffer) |
57555
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
710 (save-excursion |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
711 (Buffer-menu-beginning) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
712 (while (not (eobp)) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
713 (when (setq buf (assq (get-text-property (+ (point) 4) 'buffer) l)) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
714 (setq m1 (cadr buf) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
715 m2 (cadr (cdr buf))) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
716 (when m1 |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
717 (delete-char 1) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
718 (insert m1) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
719 (backward-char 1)) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
720 (when m2 |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
721 (forward-char 2) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
722 (delete-char 1) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
723 (insert m2))) |
716fe8f547c3
(Buffer-menu-revert-function): Emulate save-excursion.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57030
diff
changeset
|
724 (forward-line))))) |
54580
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
725 |
65355
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
726 (defun Buffer-menu-sort-by-column (&optional e) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
727 "Sort the buffer menu by the column clicked on." |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
728 (interactive (list last-input-event)) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
729 (if e (mouse-select-window e)) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
730 (let* ((pos (event-start e)) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
731 (obj (posn-object pos)) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
732 (col (if obj |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
733 (get-text-property (cdr obj) 'column (car obj)) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
734 (get-text-property (posn-point pos) 'column)))) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
735 (Buffer-menu-sort col))) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
736 |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
737 (defvar Buffer-menu-sort-button-map |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
738 (let ((map (make-sparse-keymap))) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
739 ;; This keymap handles both nil and non-nil values for |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
740 ;; Buffer-menu-use-header-line. |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
741 (define-key map [header-line mouse-1] 'Buffer-menu-sort-by-column) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
742 (define-key map [header-line mouse-2] 'Buffer-menu-sort-by-column) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
743 (define-key map [mouse-2] 'Buffer-menu-sort-by-column) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
744 (define-key map [follow-link] 'mouse-face) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
745 (define-key map "\C-m" 'Buffer-menu-sort-by-column) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
746 map) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
747 "Local keymap for Buffer menu sort buttons.") |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
748 |
54580
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
749 (defun Buffer-menu-make-sort-button (name column) |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
750 (if (equal column Buffer-menu-sort-column) (setq column nil)) |
65355
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
751 (propertize name |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
752 'column column |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
753 'help-echo (concat |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
754 (if Buffer-menu-use-header-line |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
755 "mouse-1, mouse-2: sort by " |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
756 "mouse-2, RET: sort by ") |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
757 (if column (downcase name) "visited order")) |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
758 'mouse-face 'highlight |
d96b22b8de33
*** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents:
65352
diff
changeset
|
759 'keymap Buffer-menu-sort-button-map)) |
54580
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
760 |
58276
935277968aef
(list-buffers-noselect): New arg BUFFER-LIST.
Richard M. Stallman <rms@gnu.org>
parents:
57920
diff
changeset
|
761 (defun list-buffers-noselect (&optional files-only buffer-list) |
10592
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
762 "Create and return a buffer with a list of names of existing buffers. |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
763 The buffer is named `*Buffer List*'. |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
764 Note that buffers with names starting with spaces are omitted. |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
765 Non-null optional arg FILES-ONLY means mention only file buffers. |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
766 |
58276
935277968aef
(list-buffers-noselect): New arg BUFFER-LIST.
Richard M. Stallman <rms@gnu.org>
parents:
57920
diff
changeset
|
767 If BUFFER-LIST is non-nil, it should be a list of buffers; |
935277968aef
(list-buffers-noselect): New arg BUFFER-LIST.
Richard M. Stallman <rms@gnu.org>
parents:
57920
diff
changeset
|
768 it means list those buffers and no others. |
935277968aef
(list-buffers-noselect): New arg BUFFER-LIST.
Richard M. Stallman <rms@gnu.org>
parents:
57920
diff
changeset
|
769 |
40622
d2bfc00496d7
(buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
40489
diff
changeset
|
770 For more information, see the function `buffer-menu'." |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
771 (let* ((old-buffer (current-buffer)) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
772 (standard-output standard-output) |
64529
8b0db2e8ccd3
(Buffer-menu-unmark): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
773 (mode-end (make-string (- Buffer-menu-mode-width 2) ?\s)) |
58425
f0b9b97606f9
(list-buffers-noselect): Use fixed-pitch only in the header-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58352
diff
changeset
|
774 (header (concat "CRM " |
54580
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
775 (Buffer-menu-buffer+size |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
776 (Buffer-menu-make-sort-button "Buffer" 2) |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
777 (Buffer-menu-make-sort-button "Size" 3)) |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
778 " " |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
779 (Buffer-menu-make-sort-button "Mode" 4) mode-end |
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
780 (Buffer-menu-make-sort-button "File" 5) "\n")) |
58299
40fc4ca7acc0
(list-buffers-noselect): Massage to fit in 80 columns.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58276
diff
changeset
|
781 list desired-point) |
50172
48610ee0507d
(list-buffers-noselect): Use the display property
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50033
diff
changeset
|
782 (when Buffer-menu-use-header-line |
54580
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
783 (let ((pos 0)) |
69024
fef6008cad43
(list-buffers-noselect): Turn also "\n" into a strech spec so it doesn't display
Juanma Barranquero <lekktu@gmail.com>
parents:
68651
diff
changeset
|
784 ;; Turn whitespace chars in the header into stretch specs so |
fef6008cad43
(list-buffers-noselect): Turn also "\n" into a strech spec so it doesn't display
Juanma Barranquero <lekktu@gmail.com>
parents:
68651
diff
changeset
|
785 ;; they work regardless of the header-line face. |
fef6008cad43
(list-buffers-noselect): Turn also "\n" into a strech spec so it doesn't display
Juanma Barranquero <lekktu@gmail.com>
parents:
68651
diff
changeset
|
786 (while (string-match "[ \t\n]+" header pos) |
50172
48610ee0507d
(list-buffers-noselect): Use the display property
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50033
diff
changeset
|
787 (setq pos (match-end 0)) |
48610ee0507d
(list-buffers-noselect): Use the display property
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50033
diff
changeset
|
788 (put-text-property (match-beginning 0) pos 'display |
58425
f0b9b97606f9
(list-buffers-noselect): Use fixed-pitch only in the header-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58352
diff
changeset
|
789 ;; Assume fixed-size chars in the buffer. |
58352
e14d75675a15
(list-buffers-noselect): Eliminate space at the start of HEADER.
Richard M. Stallman <rms@gnu.org>
parents:
58299
diff
changeset
|
790 (list 'space :align-to pos) |
58425
f0b9b97606f9
(list-buffers-noselect): Use fixed-pitch only in the header-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58352
diff
changeset
|
791 header))) |
f0b9b97606f9
(list-buffers-noselect): Use fixed-pitch only in the header-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58352
diff
changeset
|
792 ;; Try to better align the one-char headers. |
f0b9b97606f9
(list-buffers-noselect): Use fixed-pitch only in the header-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58352
diff
changeset
|
793 (put-text-property 0 3 'face 'fixed-pitch header) |
f0b9b97606f9
(list-buffers-noselect): Use fixed-pitch only in the header-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58352
diff
changeset
|
794 ;; Add a "dummy" leading space to align the beginning of the header |
f0b9b97606f9
(list-buffers-noselect): Use fixed-pitch only in the header-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58352
diff
changeset
|
795 ;; line with the beginning of the text (rather than with the left |
76023
70e00d4c1216
(list-buffers-noselect): Use explicit unicode code rather than the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75347
diff
changeset
|
796 ;; scrollbar or the left fringe). --Stef |
58425
f0b9b97606f9
(list-buffers-noselect): Use fixed-pitch only in the header-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58352
diff
changeset
|
797 (setq header (concat (propertize " " 'display '(space :align-to 0)) |
58954
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
798 header))) |
54580
f9e5bd96c71c
(Buffer-menu-sort, Buffer-menu-make-sort-button): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
799 (with-current-buffer (get-buffer-create "*Buffer List*") |
10592
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
800 (setq buffer-read-only nil) |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
801 (erase-buffer) |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
802 (setq standard-output (current-buffer)) |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
803 (unless Buffer-menu-use-header-line |
76023
70e00d4c1216
(list-buffers-noselect): Use explicit unicode code rather than the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75347
diff
changeset
|
804 ;; Use U+2014 (EM DASH) to underline if possible, else use ASCII |
70e00d4c1216
(list-buffers-noselect): Use explicit unicode code rather than the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75347
diff
changeset
|
805 ;; (i.e. U+002D, HYPHEN-MINUS). |
70e00d4c1216
(list-buffers-noselect): Use explicit unicode code rather than the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75347
diff
changeset
|
806 (let ((underline (if (char-displayable-p ?\u2014) ?\u2014 ?-))) |
58425
f0b9b97606f9
(list-buffers-noselect): Use fixed-pitch only in the header-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58352
diff
changeset
|
807 (insert header |
f0b9b97606f9
(list-buffers-noselect): Use fixed-pitch only in the header-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58352
diff
changeset
|
808 (apply 'string |
f0b9b97606f9
(list-buffers-noselect): Use fixed-pitch only in the header-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58352
diff
changeset
|
809 (mapcar (lambda (c) |
64529
8b0db2e8ccd3
(Buffer-menu-unmark): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
810 (if (memq c '(?\n ?\s)) c underline)) |
58425
f0b9b97606f9
(list-buffers-noselect): Use fixed-pitch only in the header-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58352
diff
changeset
|
811 header))))) |
58954
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
812 ;; Collect info for every buffer we're interested in. |
67327
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
813 (dolist (buffer (or buffer-list |
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
814 (buffer-list |
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
815 (when Buffer-menu-use-frame-buffer-list |
8e9343dc7c39
(Buffer-menu-use-frame-buffer-list): New user option.
Luc Teirlinck <teirllm@auburn.edu>
parents:
67177
diff
changeset
|
816 (selected-frame))))) |
58954
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
817 (with-current-buffer buffer |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
818 (let ((name (buffer-name)) |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
819 (file buffer-file-name)) |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
820 (unless (and (not buffer-list) |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
821 (or |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
822 ;; Don't mention internal buffers. |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
823 (and (string= (substring name 0 1) " ") (null file)) |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
824 ;; Maybe don't mention buffers without files. |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
825 (and files-only (not file)) |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
826 (string= name "*Buffer List*"))) |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
827 ;; Otherwise output info. |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
828 (let ((mode (concat (format-mode-line mode-name nil nil buffer) |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
829 (if mode-line-process |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
830 (format-mode-line mode-line-process |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
831 nil nil buffer)))) |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
832 (bits (string |
64529
8b0db2e8ccd3
(Buffer-menu-unmark): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
833 (if (eq buffer old-buffer) ?. ?\s) |
58954
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
834 ;; Handle readonly status. The output buffer |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
835 ;; is special cased to appear readonly; it is |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
836 ;; actually made so at a later date. |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
837 (if (or (eq buffer standard-output) |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
838 buffer-read-only) |
64529
8b0db2e8ccd3
(Buffer-menu-unmark): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
839 ?% ?\s) |
58954
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
840 ;; Identify modified buffers. |
64529
8b0db2e8ccd3
(Buffer-menu-unmark): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
841 (if (buffer-modified-p) ?* ?\s) |
58954
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
842 ;; Space separator. |
64529
8b0db2e8ccd3
(Buffer-menu-unmark): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
843 ?\s))) |
58954
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
844 (unless file |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
845 ;; No visited file. Check local value of |
70967
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
846 ;; list-buffers-directory and, for Info buffers, |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
847 ;; Info-current-file. |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
848 (cond ((and (boundp 'list-buffers-directory) |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
849 list-buffers-directory) |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
850 (setq file list-buffers-directory)) |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
851 ((eq major-mode 'Info-mode) |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
852 (setq file Info-current-file) |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
853 (cond |
71516
a04fe4434fba
(list-buffers-noselect): Compare Info file
Juri Linkov <juri@jurta.org>
parents:
70967
diff
changeset
|
854 ((equal file "dir") |
70967
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
855 (setq file "*Info Directory*")) |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
856 ((eq file 'apropos) |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
857 (setq file "*Info Apropos*")) |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
858 ((eq file 'history) |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
859 (setq file "*Info History*")) |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
860 ((eq file 'toc) |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
861 (setq file "*Info TOC*")) |
b4e6091c2346
(list-buffers-noselect): For Info buffers, use Info-current-file as the
Eli Zaretskii <eliz@gnu.org>
parents:
69024
diff
changeset
|
862 ((not (stringp file)) ;; avoid errors |
72289
40a24db2adc4
(list-buffers-noselect): For Info buffers, use "(file)node" instead of the
Eli Zaretskii <eliz@gnu.org>
parents:
71516
diff
changeset
|
863 (setq file nil)) |
40a24db2adc4
(list-buffers-noselect): For Info buffers, use "(file)node" instead of the
Eli Zaretskii <eliz@gnu.org>
parents:
71516
diff
changeset
|
864 (t |
40a24db2adc4
(list-buffers-noselect): For Info buffers, use "(file)node" instead of the
Eli Zaretskii <eliz@gnu.org>
parents:
71516
diff
changeset
|
865 (setq file (concat "(" |
40a24db2adc4
(list-buffers-noselect): For Info buffers, use "(file)node" instead of the
Eli Zaretskii <eliz@gnu.org>
parents:
71516
diff
changeset
|
866 (file-name-nondirectory file) |
96954
ad71105ebd5b
(Buffer-menu-marked-buffers)
Juri Linkov <juri@jurta.org>
parents:
96276
diff
changeset
|
867 ") " |
72289
40a24db2adc4
(list-buffers-noselect): For Info buffers, use "(file)node" instead of the
Eli Zaretskii <eliz@gnu.org>
parents:
71516
diff
changeset
|
868 Info-current-node))))))) |
58954
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
869 (push (list buffer bits name (buffer-size) mode file) |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
870 list)))))) |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
871 ;; Preserve the original buffer-list ordering, just in case. |
bb8424d9ff97
(list-buffers-noselect): Collect internal info
Juri Linkov <juri@jurta.org>
parents:
58461
diff
changeset
|
872 (setq list (nreverse list)) |
58299
40fc4ca7acc0
(list-buffers-noselect): Massage to fit in 80 columns.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58276
diff
changeset
|
873 ;; Place the buffers's info in the output buffer, sorted if necessary. |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
874 (dolist (buffer |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
875 (if Buffer-menu-sort-column |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
876 (sort list |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
877 (if (eq Buffer-menu-sort-column 3) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
878 (lambda (a b) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
879 (< (nth Buffer-menu-sort-column a) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
880 (nth Buffer-menu-sort-column b))) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
881 (lambda (a b) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
882 (string< (nth Buffer-menu-sort-column a) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
883 (nth Buffer-menu-sort-column b))))) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
884 list)) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
885 (if (eq (car buffer) old-buffer) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
886 (setq desired-point (point))) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
887 (insert (cadr buffer) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
888 ;; Put the buffer name into a text property |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
889 ;; so we don't have to extract it from the text. |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
890 ;; This way we avoid problems with unusual buffer names. |
92953
21d63c870839
(list-buffers-noselect): Display buffer name in
Nick Roberts <nickrob@snap.net.nz>
parents:
87649
diff
changeset
|
891 (let ((name (nth 2 buffer)) |
21d63c870839
(list-buffers-noselect): Display buffer name in
Nick Roberts <nickrob@snap.net.nz>
parents:
87649
diff
changeset
|
892 (size (int-to-string (nth 3 buffer)))) |
105887
c17b71571661
* buff-menu.el (Buffer-menu-buffer+size): Use display property to
Chong Yidong <cyd@stupidchicken.com>
parents:
105836
diff
changeset
|
893 (Buffer-menu-buffer+size name size |
92953
21d63c870839
(list-buffers-noselect): Display buffer name in
Nick Roberts <nickrob@snap.net.nz>
parents:
87649
diff
changeset
|
894 `(buffer-name ,name |
21d63c870839
(list-buffers-noselect): Display buffer name in
Nick Roberts <nickrob@snap.net.nz>
parents:
87649
diff
changeset
|
895 buffer ,(car buffer) |
21d63c870839
(list-buffers-noselect): Display buffer name in
Nick Roberts <nickrob@snap.net.nz>
parents:
87649
diff
changeset
|
896 font-lock-face buffer-menu-buffer |
21d63c870839
(list-buffers-noselect): Display buffer name in
Nick Roberts <nickrob@snap.net.nz>
parents:
87649
diff
changeset
|
897 mouse-face highlight |
100171 | 898 help-echo |
92953
21d63c870839
(list-buffers-noselect): Display buffer name in
Nick Roberts <nickrob@snap.net.nz>
parents:
87649
diff
changeset
|
899 ,(if (>= (length name) |
21d63c870839
(list-buffers-noselect): Display buffer name in
Nick Roberts <nickrob@snap.net.nz>
parents:
87649
diff
changeset
|
900 (- Buffer-menu-buffer+size-width |
21d63c870839
(list-buffers-noselect): Display buffer name in
Nick Roberts <nickrob@snap.net.nz>
parents:
87649
diff
changeset
|
901 (max (length size) 3) |
21d63c870839
(list-buffers-noselect): Display buffer name in
Nick Roberts <nickrob@snap.net.nz>
parents:
87649
diff
changeset
|
902 2)) |
21d63c870839
(list-buffers-noselect): Display buffer name in
Nick Roberts <nickrob@snap.net.nz>
parents:
87649
diff
changeset
|
903 name |
21d63c870839
(list-buffers-noselect): Display buffer name in
Nick Roberts <nickrob@snap.net.nz>
parents:
87649
diff
changeset
|
904 "mouse-2: select this buffer")))) |
99748
cea0d38a2587
(Buffer-menu-buffer+size, list-buffers-noselect):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
97960
diff
changeset
|
905 " " |
cea0d38a2587
(Buffer-menu-buffer+size, list-buffers-noselect):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
97960
diff
changeset
|
906 (if (> (string-width (nth 4 buffer)) Buffer-menu-mode-width) |
cea0d38a2587
(Buffer-menu-buffer+size, list-buffers-noselect):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
97960
diff
changeset
|
907 (truncate-string-to-width (nth 4 buffer) |
99749
b491431b74c8
(Buffer-menu-short-ellipsis): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99748
diff
changeset
|
908 Buffer-menu-mode-width) |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
909 (nth 4 buffer))) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
910 (when (nth 5 buffer) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
911 (indent-to (+ Buffer-menu-buffer-column Buffer-menu-buffer+size-width |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
912 Buffer-menu-mode-width 4) 1) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
913 (princ (abbreviate-file-name (nth 5 buffer)))) |
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
914 (princ "\n")) |
10419
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
915 (Buffer-menu-mode) |
48864
02944b0aaecd
(Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents:
40622
diff
changeset
|
916 (when Buffer-menu-use-header-line |
50172
48610ee0507d
(list-buffers-noselect): Use the display property
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50033
diff
changeset
|
917 (setq header-line-format header)) |
10592
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
918 ;; DESIRED-POINT doesn't have to be set; it is not when the |
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
919 ;; current buffer is not displayed for some reason. |
10419
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
920 (and desired-point |
10592
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
921 (goto-char desired-point)) |
54594
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
922 (setq Buffer-menu-files-only files-only) |
c07fb48cb0e2
(Buffer-menu-revert-function): Make it suitable for
Luc Teirlinck <teirllm@auburn.edu>
parents:
54580
diff
changeset
|
923 (set-buffer-modified-p nil) |
10592
bbb68f0d31c6
(list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10421
diff
changeset
|
924 (current-buffer)))) |
10419
cb6f68d16210
(list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10269
diff
changeset
|
925 |
58299
40fc4ca7acc0
(list-buffers-noselect): Massage to fit in 80 columns.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58276
diff
changeset
|
926 ;; arch-tag: e7dfcfc9-6cb2-46e4-bf55-8ef1936d83c6 |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
194
diff
changeset
|
927 ;;; buff-menu.el ends here |