Skip to content

Instantly share code, notes, and snippets.

@shawwn
Created August 1, 2019 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawwn/7aca4e3c5c50d942be9c86075b8c7a1f to your computer and use it in GitHub Desktop.
Save shawwn/7aca4e3c5c50d942be9c86075b8c7a1f to your computer and use it in GitHub Desktop.
======== SAMPLE 1 ========
buffers.
(if (and (not this-command)
(> x-minor-mode (frame-max-size)))
(message "%s" (if x-minor-mode ": " "")
(if y-minor-mode ": " " "")
(if y-line-mode ": " ""))
(message "%s" (if y-line-mode ":" ":"))
(sit-for 2)
(setq message-fcc-string
(format "%s" (format "%s" message-fcc-string)))
(setq message-fcc-format
(format "%s" message-fcc-format))
(setq message-g-string-list (* 100 message-fcc-string-list))))))
(defun message-make-new-message (&optional no-revert-revert-revert)
"Return new message."
(let ((message-data (mm-default-to-string message-data))
data)
(when (and
(> (length message-data) 1)
(setq data (mm-copy-to-buffer
(message-make-new-message nil) t nil
(mm-copy-region-as-kill (point-min) (point-max))))
;; If the text-only data is large, we try to reread its size.
(when (and (mm-handle-multipart-parameter-p
'mm-inlinable)
(string-match "^-" data))
(setq data (downcase data))))))
(defun message-make-new-mail ()
"Make new message.
If the user types the message in the current buffer, and the
buffer has been set up properly, the function is asked to
revert the buffer before writing the new mail.
If the mail has been replied to successfully, this function
should return the new mail or the new one. Else the user may select
from the list of possible recipients by typing a substring.
To make the variable `message-buffer-savings' buffer-local,
use `message-make-new-mail-buffer-savings'. If this prefix argument is
non-nil, the variable `message-buffer-savings' is overwritten by the
new mail buffer.
The value of this variable is an alist with elements
where the car is the new mail buffer, the cdr is a buffer for
new mail, and the cdr is the buffer to be saved in."
(if (and (boundp 'message-buffer-savings)
(consp message-buffer-savings))
(let* ((buffer (current-buffer))
(inhibit-read-only t)
mail-cache)
;; If buffer can be saved with this, this may be needed.
(when buffer
;; If message-buffer-savings is too big, don't leave it as is.
(unless buffer-file-name
======== SAMPLE 2 ========
buffers
"Find file associated with the given file name; return nil if no such file
occurred to the command line."
(let ((file-name (file-truename (buffer-file-name))))
(when (eq major-mode 'ido-mode)
(find-file-other-frame-natively file-name)
(if (or (and current-prefix-arg (< arg 0))
(and current-prefix-arg (ido-is-on-p pgg-pending-string)))
;; Don't let this do anything, because it can raise an error
(setq arg 0))
(when (string= file-name current-prefix-arg)
(let ((buf (get-buffer-create "*ido-input-buffer*"))
(file (file-truename (buffer-file-name))))
(delete-directory buf (file-name-all-completions file))
(if current-prefix-arg
(progn
(or buffer-file-name
;; If there is no file, delete it: it is already in the buffer.
(delete-directory buf (file-name-directory))))))))
nil)
;;;###autoload
(defun ido-input-buffer (&optional filename)
"Return the buffer associated with FILENAME."
(concat ido-directory (or filename (buffer-file-name)))
(or ido-history ido-current-directory))
;;;###autoload
(define-minor-mode ido-file-mode
"Toggle Ido mode (Ido mode is a buffer-local minor mode that runs in the background)."
:global t :group 'ido :group 'edit
;; (make-local-variable 'ido-default-file-name)
;; (setq ido-default-file-name "")
;; (add-hook 'mode-local-hook
(lambda ()
(setq ido-completion-in-progress nil)
(if ido-completion-in-progress
(completing-read
"File: "
ido-current-directory nil t 'ido-directory-file-name)))
(setq ido-completion-in-progress ido-default-file-name)
(add-hook 'input-method-functions
'ido-completion-in-progress nil t))
(defalias 'ido-file-mode 'ido-file-mode)
(defun ido-toggle-file-name-property (filename)
(interactive
(list
(read-file-name "Click on file at point to select (filename): "
(if ido-read-file-name-add-library
ido-read-file-name-to-library)))
nil))
(defun ido-toggle-directory-file-name-property (filename)
(interactive
(list
(if ido-read-file-name-add-library
(read-file
======== SAMPLE 3 ========
buffers (for backward compatibility)
;;;###func-autoload
(defun gnus-group-prepare-method (group)
(with-current-buffer gnus-group-buffer
(goto-char (point-max))
(when (and gnus-group-method-marked
(not (memq 'gnus-group
(gnus-group-method-marked))))
(gnus-make-group 1 0)))))
;;; gnus-topic-edit's method.
;;
(defcustom gnus-topic-edit-options t
"Non-nil means ask user to modify parameters before starting the edit.
This is useful for updating the overview, which usually uses another
agent for editing the group.
Use the command \\[gnus-topic-edit-post] to specify the methods and prefixes to
ask for. This will set the topic editor back to that used in the
current Gnus window (for instance on the group's top level,
or in the parent window). With a numeric argument,
don't do this, you are probably using a remote method
that you want to edit. This will change your edit buffer if you use
this."
:type 'boolean
:initialize #'set-buffer-default
:group 'gnus-group)
(defcustom gnus-topic-edit-post-methods nil
"List of post methods that you wish to modify after starting a topic.
This includes group, parent and topic methods. See also
`gnus-topic-edit-post-method' above. The post-methods that are not
passed into this function are used if you want to have another
agent edit the overview of the group from this method. So,
you can have different groups edit their parameters in the group. With
the command \\[gnus-topic-edit-post-method], the arguments given to
this command will be the parameters of the existing post-method. With a
non-nil value, you need to check the groups that have been added or removed
from the list (or the current group) from the group-list."
:version "22.1"
:type '(repeat string)
:group 'gnus-group)
(defcustom gnus-topic-edit-post-method nil
"Post-method used for editing the topic in the overview.
This is a list of key-binding sequences, each of which is sent
to the gnus-topic command and should return a string. The
gnus-topic command can modify the way the parameters of a post-method
that do occur in the topic buffer in the topic buffer, see
for instance the variable `gnus-topic-edit-post-method'."
:type '(repeat string)
:group 'gnus-group)
;;; User customization
;;;
(defvar gnus-topic-edit-variables nil
"List of variables alist that can override the variables that `gnus-group-topic'
configure. These variables may be changed in customization buffer after
the user is asked about them.
General variables that can override the variable `gnus-group-topic':
`%s' the variables to edit when editing a topic, `t:' the variables to
edit when editing a group and `:m': the variables to edit when editing a group."
;; This is useful when using `gnus' to create a group mode menu. However,
;; in practice, it would be very expensive to set this variable, since users won't be
;; sure they will see it in the menu when they open. I don't know what is the
;; value of this variable, and it is probably quite slow when you have many groups
;; editing several groups before one. So, it seems that it might not be very useful
;; and it is probably not worth paying attention to.
:type 'hook
:version "24.1")
(defvar gnus-group-topic-menu)
(defvar gnus-topic-done nil
"List of the summary group groups that should be processed by the article command.
Each entry is a list of (CONSENT SUBGRANTS GROUP ARGS). The summary
group with
======== SAMPLE 4 ========
buffers. In order to check that a
;; buffer, as well as a buffer's selected window, is visible, you
;; must call the function `editable-window-dedicated-p'
;; that returns true for each window where the buffer is visible. This
;; function is used when the buffer is in a dedicated window: an
;; indirect window that is visible while the selection is active.
;;; Functions:
(defun editable-set-window (event buffer-loc)
;; When EVENT is the selected window, return the visible frame that
;; was the current window on that window.
;; Otherwise, return the selected frame that was the frame on the
;; selected window.
;;
;; This function is used when the selected window is in a dedicated window
;; and EVENT is not the selected window. An 'editable-frame-parameters'
;; function should return the frames that contain the dedicated window
;; buffer. It cannot be used to set the frame parameter.
(if event
(cond ((editable-window-dedicated-p buffer-loc)
(editable-frame-parameters window-parameters))
((editable-window-dedicated-p buffer-loc)
(editable-frame-parameters buffer-loc))
(t (editable-window-dedicated-p buffer-loc))))
;;; Functions:
(defun editable-get-default-class ()
"Return the default class for the buffer. Otherwise, return nil."
;; If there is an element of the class `buffer-list', this function
;; may return nil.
(let ((buf (selected-window))
(buf-list (editable-window-buffer-classes))
(buf-class (editable-window-buffer-components))
(buf-min 0)
(buf-max 0)
(buf-buf (window-buffer (editable-window-buffer-class))))
(with-current-buffer buf-buf
(set-window-parameter nil buf-id nil)
(setq buf-class (editable-window-class))
(setq buf-buf (selected-window))))
(editable-window-dedicated-p buf-buf))
;;; Function:
;;;
(defun editable-get-display-name ()
"Return the display name. If there is an element of the class
;; 'editable-window-dedicated-p' using this function it is returned.
;; If there is an element of the class `buffer-list', this function
;; may return nil.
;;; Special function:
;;;###autoload
(define-minor-mode editable-mode
"Toggle Editable Properties mode.
When Editable Properties mode is enabled, the display of text in
the selected window or on another window can be changed. With one click
on a mouse-1 or a key-3, select the buffer or window displaying
the buffer, select the window where the editing buffer is, and type
\\[editable-window] to go to that window. When called from a program, this
command is not part of the normal editing buffer selection
functions; instead, typed-in program commands that deal with buffer
selection and editing will be displayed as if they were keyboard keys."
:lighter " Editable" :keymap editable-mode-map
t nil ;For the user.
(if buffer-list
(if (not editable-buffer-list)
(progn
(while editable-display-list
(setq editable-display-list (cons (cons buf-buf buffer-list)
======== SAMPLE 5 ========
buffers. If it has been set,
also use `org-agenda-kill-overlay' to remove it."
(unless org-agenda-undo-mode
(org-agenda--undo)
;; Use 'after' to avoid redoing the agenda display.
;; FIXME: Use the global variable to set the position again.
(run-hook-with-args 'org-agenda-undo-functions local-redo)))
(defvar org-agenda-redo-mode nil
"Controls mode for the agenda commands.
Setting this variable directly does not take effect;
use \\[universal-argument] or set it to nil from the command line.")
;;;
;;; Facing the calendar
;;;
(defalias 'org-calendar-show-date 'org-calendar-show-date-arg)
(defalias 'org-calendar-show-time 'org-calendar-show-time-arg)
;;;
;;; Viewing and filtering of the calendar buffer
;;;
;;;###cal-autoload
(defun org-calendar-show-diary ()
"Show the agenda for the current day, at the current time."
(interactive)
(let* ((today (org-read-date "today: "))
(today-string (org-read-date "today: "))
(today-buffer (org-read-date "today : "))
(today-sexp (org-read-date "today : "))
res item)
(dolist (sexp org-agenda-file-sexp-alist)
(let ((sexp (car sexp-alist)))
;; A line number is the longest long string that follows the
;; last sexp.
(mapc
(lambda (line)
(with-current-buffer (get-buffer-create "*Org Agenda*")
(save-window-excursion
(save-buffer)))))
;; Display an empty agenda file for this date and time.
(org-make-abbrev-list (org-read))))
(org-show-agenda-file-timestamp)
(when (memq (current-buffer) org-agenda-buffer-names)
(with-current-buffer (window-buffer)
(setq org-agenda-buffer-names (org-overriding-buffer-name))
(display-buffer org-tmp-buffer)
(setq buffer-read-only t)
(goto-char (point-min))
(kill-buffer org-tmp-buffer))
;; Display "this-event" data.
(message (concat "Org Agenda file for visiting in file diary.org: "
"created by: "
(if (eq 'org-agenda-file-time org-file-name)
"time: " "")
;; Time stamp.
"created by: "
" : "+ " (current-time-string (org-read-date)) " : ")))))"
;;;###
======== SAMPLE 6 ========
buffers are not initialized if `compilation--enable-compilation' is non-nil."
:type 'boolean)
(defcustom compilation-auto-start-watch
'((lambda (file)
(if compilation-auto-start-watch
`(and (file-exists-p file)
;; If the file was loaded asynchronously, so we want
;; to keep it on disk so that we can switch from
;; loadup to quit.
;; `compilation-interrupt-file-handler' checks that the
;; file is available when `compilation-interrupt-buffer' is non-nil.
;; That happens even when the file already is on disk.
(unless compilation-auto-start-watch
(let ((comp (get-file-buffer file))
(mode (compilation--minor-mode-in-file-modes))
(save-window (compilation-mode-restore))
(run-hooks 'compilation-auto-start-watch)
(set-buffer (compilation--buffer-buffer)))
)))
t)
(run-hooks 'load-path)
(let ((buffer-file-name file))
(load "foo" 'compilation-recompute-load-path)))
(autoload "foo" "-a" "load the Foo library." nil t))))
;;;###autoload
(defun compilation-load-autoloads ()
"Return a list of autoload definitions for compilation included files (if FILE
hinted by `load 'no-autoloads').
Compilation included files are not initialized if `compilation-enable-compilation' is
non-nil. So it is useful to put the current load order in
such a way that compilation-load-autoloads should reset their
configuration before loading Emacs.
`compilation-autoloads' expects the file names to be absolute, so we
associate the autoload and standard libraries files. This prevents
themselves from being loaded by compilation."
(setq compilation-autoloads-last-file-dir (file-name-directory
(file-name-sans-extension
(file-name-nondirectory)))
compilation-autoloads-initialize-hook nil)
(setq compilation-autoloads-mode
(cons `(propertize
:face '(:weight bold :strike-through 0 .3)
:button-face (minibuffer-completing-string "Compile: "
'mouse-face)))
;; Compile in a temporary directory, if necessary
======== SAMPLE 7 ========
buffers in the list)
(define-key eshell-mode-map "C" 'eshell-read-command-from-line)
;; Internal variables:
(defvar eshell-mode-map nil)
(define-key eshell-mode-map "^$" 'eshell-read-command-line)
(define-key eshell-mode-map "^[ \t]*$" 'eshell-read-command)
;;; Help:
(defvar eshell-minibuffer-local-listing-type nil)
;;; Functions:
(defun eshell-read-command-line ()
"Set up a buffer for reading the command line.
This also makes the buffer buffer-local, so that the commands
will work without changing the local variable `eshell-mode-map'.
This is only done for buffers that contain Eshell code that don't
have Emacs modes set up."
(setq eshell-minibuffer-local-listing-type
(symbol-function 'eshell-minibuffer-local-listing-type))
(let ((comparison-mode eshell-minibuffer-local-listing-type)
(exec-mode eshell-minibuffer-local-listing-type)
(mode (nth . eshell-minibuffer-local-listing-type))
(bufname (buffer-name))
(proc
(save-window-excursion
(save-window-excursion
(kill-buffer bufname)))
buffer-read-only)
;;(if proc
;; (set-buffer proc)
;; (setq proc (eshell-get-command-output)))
;;(eshell-kill-last-processes proc)
(setq eshell-last-prompt-line-output proc))
;;(remove-function proc 'kill-buffer-hooks 'bury-buffer)
nil)
(defun eshell-reread-command (buffer)
"Reconvale as a minibuffer buffer and run the normal minibuffer hooks.
This is for buffers that don't have `minibuffer-read-only' set,
even if it does exist."
;;(if (boundp 'minibuffer-read-only)
;; (require 'minibuffer)
;; (setq minibuffer-read-only nil))
buffer)
(defun eshell-read-command (command prompt)
;; read the command line
(if (and eshell-minibuffer-local-listing-type eshell-submode-minibuffer-mode
(or eshell-minibuffer-local-listing-type eshell-minibuffer-regexp-mode))
(read-from-minibuffer prompt (substring command (1+ (length command))))
;;(read-from-minibuffer prompt
(substring command 1)
(string-width command))
;;(eshell-kill-last-processes command) ; for buffers that use the last minibuffer command
)
(setq eshell-minibuffer-local-listing-type
(symbol-function 'eshell-minibuffer-local-listing-type))
(setq eshell-minibuffer-local-listing-type
(function--find-empty-subproj
(lambda (name prompt)
(string-match eshell-regexp-quote-matches name)
; (replace-match "\\<" nil
======== SAMPLE 8 ========
buffers
; ;
";;;")
(dolist (cmd (split-string (cdr rmail-reply-method-regexps))
nil)
(when (and cmd (member cmd rmail-reply-method-not-found))
(setq cmd ""))))
(defun rmail-message-with-date (msg-dir &optional dir)
(cond
((string= (char-to-string (file-name-nondirectory (buffer-file-name)) ?r) "")
(setq rmail-reply-method-not-found nil))
((string= (char-to-string (file-name-nondirectory (buffer-file-name)) ?m) "")
(setq
mmsg-dir
mmsg-dir (format " -g " (directory-file-name (directory-file-name (rmail-current-file))))))
((string= (char-to-string (file-name-nondirectory (buffer-file-name)) ?m) "")
(setq
mmsg-dir
(let ((tmpdir (file-name-directory (buffer-file-name)))
(p (and mmsg-dir
(setq tempdir (expand-file-name dir
(file-name-nondirectory rmail-current-file))))
(buffer-file-name (or tempdir tempdir))
(p (and p (get-file-buffer tmpdir))))
(file-name-directory (expand-file-name dir (file-name-nondirectory rmail-current-file))))
(or tmpdir p))))
(t ; this is the normal thing here.
(setq rmail-reply-method-not-found t)
;; Add user to be called with an explicit message-creator:
(setq rmail-reply-method-not-found nil))
(rmail-set-subject))
(defalias 'rmail-message-with-date 'rmail-message-with-date
"The rmail-message-creator, if nil."
(declare (obsolete "26.1" "27.1"))
;; We do want a single variable name, because it's hard to
;; reuse the same variable from two different windows in the same
;; message.
(if (string-equal "&date" rmail-mime-charset)
"")
(setq rmail-reply-method-not-found nil))
(defun rmail-reply-with-date (msgnum nargs)
"Like `rmail-add-date', but doesn't return a string.
MSGNUM is the subject number (not including message text).
NEXT is the last message header that was composed.
Returns the name of message (not including the message text). NEXT is
the last message header that was composed."
(let ((case-fold-search t)
(case-reverse "^;")
======== SAMPLE 9 ========
buffers, there is no way to see the file names."
(let* ((org-ascii-file-attrs (org-remove-indentation-in-dir dir))
(org-ascii-file-tags (org-remove-indentation-in-dir dir)))
;; The file might be different from its master file for various reasons.
(if (or (and (org-ascii-file-tags-member-p dir) (file-directory-p dir))
(org-ascii-file-tags-member-p dir)
(org-ascii-file-tags-member-p
(file-name-nondirectory dir)))
(user-error
"Invalid file (name not a directory): %d"
(if (not (member dir (file-name-nondirectory dir)))
(message "The file %s already exists."
(file-name-nondirectory dir)
(user-error "There might be other %s.")
(file-name-extension directory))
(message "The file %s belongs to another file."
(file-name-nondirectory dir))
nil)))
;; Since the user made the error last time, this error may have occurred
;; on some other line in the directory. So clear it up by removing
;; the new line at the end. Remove a new error message, if possible.
(org-ascii-write-error-log
"The file `%s' exists; overwrite with other %s?
\(org-ascii-write-file)" (file-name-nondirectory dir))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Editing Commands
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun org-ascii-set-property (property value)
"Set PROPERTY to VALUE.
The value is a cons cell whose car cell contains the beginning and end
values and cdr contains the end-value, i.e. the last value in the list."
(org-ascii--check property value))
(defun org-ascii-parse-org-property-spec (property &optional value)
"Parse PROPERTY for VALUE.
When optional argument VALUE is non-nil, and `org-ascii-use-properties' is non-nil,
indicate that this string is a property spec. Otherwise, if the value
can't be parsed, the process is stopped."
(when (and value
(= (length value) 0)
(not (equal (car value) "org"))
(string= (org-ascii--parse-property-string (car value)
:value "org"))))
(while (string-match "\\$\\S-" property)
(setq property (match-string 1 property)
value (match-string 2 property)))
;; The value of the property was a string, an expression or an
;; alist entry. First parse it for the list. Value must be a
;; string that does not end with an \. Otherwise
======== SAMPLE 10 ========
buffers and mark buffers before editing the code.
You can do this with a single command;
(setq-local ediff-file-buffer-names
(cons (format-spec "*" (symbol-name symbol))
(symbol-value symbol)))
You can also have ediff insert a buffer name followed by the
string "*" before the actual buffer name
in the next command. This way, a new buffer with the same directory will
be entered with as much space as the current one.
The ediff-file-buffer-alist and ediff-buffer-alist override
`ediff-file-buffer-name-function' for buffers in the list,
which overrides the default `ediff-file-buffer-name-function', and
uses this to create the corresponding alist."))
(defun ediff-insert-difference-buffer (bufname &optional nodename)
"Insert BUFNAME in next diff when possible.
Prefix argument NODENAME means insert buffer name of buffer's original file."
(interactive "-b" "Buffer name: ")
(setq ediff-last-difference bufname)
(ediff-other-buffers))
(defun ediff-find-prev-difference (bufname)
"Find previous difference."
(interactive (list nil t)))
;;(defun ediff-find-next-difference (bufname &optional nodename)
;; "Find next difference on the following difference difference buffer."
;; ;;(interactive)
;; ;; (setq ediff-last-difference (ediff-get-difference-buffer bufname)))
(defun ediff-find-next-difference-buffer (bufname &optional nodename)
"Find next difference buffer on the following difference difference buffer."
(interactive (list nil t)))
;;(defun ediff-find-next-difference-buffer-other-window (bufname &optional nodename)
"Find other difference buffer."
(interactive (list nil t)))
;;(defun ediff-find-previous-difference (bufname &optional nodename)
;; "Put difference buffer in current difference buffer."
;; ;; (interactive "sDiff difference buffer: " (buffer-name bufname)))
;;(defun ediff-find-difference (bufname &optional nodename)
;; "Put difference buffer in buffer indicated by buffer name before this one.
See `ediff-buffer-A' for more details on where differences are found."
;; (interactive (list nil nil (read-buffer ""))))
;;(defun ediff-find-next-difference-buffer (bufname &optional nodename)
;; "Find next difference buffer."
;; ;; This function does a bit more than simply switch buffers in the
;; ;; difference buffer. If it is empty, it searches for another buffer.
;; (interactive (list nil (read-buffer "Buffer: ")))
;;(defun ediff-find-next-difference-buffer ()
;; "Find next difference buffer.
Optional argument NODENAME non-nil means return the buffer name.
`ediff-file-buffer-name-function' or `ediff-file-buffer-name-other-window'
returns the buffer name of the previous difference."
;; (interactive)
;; (ediff-other-buffers))
(define-minor-mode ediff-difference-mode
"Toggle Emerge or Diff mode in Ediff buffers.
If Emerge, diff the difference between two files (for now), or
otherwise calls other program depending on buffer state.
If you want to see the current difference as Ediff buffer, then you
need to enable Emerge and then call the program from there."
:global t
:group 'ediff-highlighting
:keymap ediff-diff-map
(if (featurep 'diff3)
(progn
(easy-menu-filter ediff-diff-menu
======== SAMPLE 11 ========
buffers;
do this from Emacs's variables `eshell-last-sexp-end',
`eshell-last-sexp-arg', and `eshell-last-sexp-argument'.
This may take a while, the result of which can be quite slow.
`eshell-inferior-syntax' may be helpful, if it's not too time consuming
to set up).
The function must return the tail of a list of strings,
or nil. It can even be used to prevent a call to this function
from doing its job, by returning the lexical sexp that did
contribute to the buffer switching."
(when eshell-inferior-syntax
(setq eshell-last-sexp-result nil
eshell-last-sexp-arg nil
eshell-last-sexp-argument nil))
(cond
((eq eshell-last-sexp 'interactive) t)
((eq eshell-last-sexp 'preceding-sexp) t)
((eq eshell-last-sexp 'interactive-only) nil)
((eq eshell-last-sexp 'interactive-only)
(while (and eshell-last-sexp-result
(not (eshell-last-sexp-member-p eshell-last-sexp
edt-last-sexp)))))
((memq (char-after (match-beginning 1)) '(?\`))
(cond ((memq (following-char) '(?\n ?<))
eshell-last-sexp-result)
((eobp) nil)
((and bs-type (integerp bs-type))
(setq bs-type (car bs-type)))
(if (eshell-unprotected-p bs-type)
(progn
(goto-char bs-type)
(let ((case-fold-search nil))
(and (looking-at eshell-non-associate-interactive-regexp)
(re-search-backward eshell-non-associate-interactive-regexp
nil t)))))
(if (> (current-column) eshell-last-sexp-column 0)
(error "No previous sexp"))
(let ((end (progn
(goto-char eshell-last-sexp-end)
(eshell-previous-single-char-entry-char)))
(beg (point)))
`((eshell-unprotected-p ?\` (t . ?A)))
(goto-char eshell-last-sexp-end)
(prog1 (eshell-post-command-status nil beg)
(forward-char -1))
(let ((case-fold-search nil))
(if (and eshell-last-sexp-result ;; skip over a single sexp
;; or if last sexp passed before an empty
======== SAMPLE 12 ========
buffers
;; `format-message' must either be set for the user
;; with a mouse-movement command, or set explicitly
;; otherwise.
(with-demoted-errors
(prin1-to-string
(prin1-to-string
(prin1-to-string (buffer-name))))))
(if no-insert
""
(prin1-to-string
(prin1-to-string (buffer-name)))))))))
(defvar erc-server)
;;;###autoload(autoload 'erc-erc-server "erc-services")
(define-erc-module erc-services nil
"ERC-services module.
This module provides simple functions for managing clients and clients
with ERC. It can access user functions for certain client types and servers."
(with-current-buffer "*erc-services*"
(setq-local erc-server erc-protocol)
(dolist (buffer erc-server)
(erase-buffer)
(when buffer
(insert-buffer-substring buffer)
(buffer-substring (point) (point-at-eol))))
nil))
(defsubst erc-get-server (server)
"Retrieve server information from SERVER.
Only return nil if SERVER does not exist."
(let ((server-string "[<>]")
(server-string-regexp "server.\n")
(server-string (erc-trim-string (buffer-substring (point) (point-at-eol))))))
(defun erc-trim-server (server)
"Return the server string of SERVER from erc-response.
When SERVER is nil, use the current value of `erc-server-string'."
(if erc-server-string-regexp (match-string 1 erc-server-string)
(match-string 1 erc-server-string)))
(defun erc-trim-server (server)
"Return the server string of SERVER from erc-response.
This function is very similar to `tramp-get-server-by-id'.
However, it ignores the connection status of the target server."
(when server
(let ((buffer (current-buffer)))
(unless buffer
(switch-to-buffer buffer)
(setq buffer (erc-trim-server-string)
server-string-regexp (erc-trim-string server)
server-string "\\>")))))
;;;###autoload
(defun erc-trim-server (server)
"Trimming SERVER from response.
This sets `erc-server-string' to the string of the given server."
(let ((server-string (cl-remove-if
(lambda (s)
(mapcar
======== SAMPLE 13 ========
buffers)
(cond
(w)
(if (string-match "[ \t\n]+\\'" str)
(setq prefix (match-string 1 str)
prefix (substring str 0 nil)))
(t
(setq prefix (substring str 0 nil)))))
(require 'ert)
(let ((defs nil))
;; We do this by calling a `test' and passing all the tests.
,test (ert--find-test-with-condition-test
(ert-condition-fail:foo:value
(lambda () (not (ert-test--test-failed-p))))))
(while defs
(setq defs (nthcdr 3 defs))))
(cl-loop for name in (concat name (regexp-opt (cl-arg-compare (cl-arg c-var) t))))
nil)
;;;###autoload
(defalias 'ert-run-test 'ert-run-makefile-test)
;;;###autoload
(defun eval-standard-command (compat &rest args)
"Run compiled form test COMMAND.
Return the compiled form test."
(if (macroexp--const-form-compiler standard-compat)
(progn
(setf (gethash compile (ert--forms)) args)
(ert-explainer-help (format "Print errors when compiling %s."
(ert--compat-form-compiler standard-compat))
(append
(ert-defvar-symbol name)
(ert--const-form-compiler compile))))
(setq args (cons compile args)))
nil) ; The code in the next defun below is for C-x C-M
;;;###autoload
(defun eval-standard-command (compat &rest args)
"Run compiled form test COMMAND with all variables set up for C language
compatibility."
(let* ((defs nil)
(def-macro (lambda (name args) &rest args))
(def-type (lambda () t))
(def-value (quote (concat (ert-var-symbol name) "\\(?:\\(?:\\?\\)[a-zA-Z0-9_]*[a-zA-Z0-9_]*\\|[a-zA-Z0-9_$_]*:\\(\\?\\)?"))
(cl-type (expand-file-name defs))))
`(progn
;; `macro' is defined here too for speed: `macro' tests can be
;; faster in `macroexpand-defs'. This is mainly due to code quoting,
;; and because in the code the forms don't have a `(defcustom t)'
;; property.
(macroexpand `(defconst foo)) (funcall defs "define foo (1.3.3a, 1.3.4a
======== SAMPLE 14 ========
buffers-file-names-regexps (string) (string)
"Concatenate directories with regular expressions."
(let ((defaults (string-to-list (or (epg-file-name-nodes epg-protocol)
"")
epg-process-alist)))
(if defaults
(list default defaults)
":")
(nreverse defaults))))
(define-obsolete-function-alias
'file-search-forward-regexps
#'nxml-stringify "27.1")
(defvar nxml-parse-path-regexps (concat nxml-parse-path-regexps "\\."))
(defun nxml-parse-path-regexps (pattern string &optional path-name-regexp start))
(defun nxml-parse-path-regexps-1 (pattern &optional path-name-regexp)
"Parse PATH-NAME-REGEXP plus one pair of strings, creating the path
pattern. The prefix argument means that PATH-NAME-REGEXP should be the
first pair. The first pair should be either a directory, a file, or
a name."
(while pattern
;; We can recognize a whole path if `:list-alist' is used, for instance.
(and
(member (car pattern)
'(directory-directory file-directory
name-rhs-alist
name-directory-alist)))
(setq pattern (car pattern))))
(defun nxml-parse-path-regexps-1 (match-pattern pattern &optional path-name-regexp)
"Parse a regexp against PATTERM.
Matches a PATH-NAME-REGEXP pair, creating the path REGEXP
with the first `:list-alist' pair. The prefix argument means that
PATH-NAME-REGEXP should be the first pair. The first pair
must be either a directory, a file, or a name.
The directory and file name of the first pair should start with
\\[:list-directory], where the directory and file name are the
real path arguments. The first pair of path args should be a regexp string
or a directory path regexp (i. e., a directory path). If the first pair
\(i. e., an empty string in a path argument) is followed by the files
with substring `\\[:file-name]' and the directory path with the
first `:list-directory' pair, the matchpatterns in each pair will
be found in the same directory/file pair. The directory-file pair does
not have these substring matches.
The first directory/file pair in the matchpatterns in each
search pair will be found in the directory/file pair.
The second directory/file pair in the matchpatterns will be in the
file pair. The filename pair (i. e., an empty or directory path regexp)
will be found in the file pair."
(let* ((case-fold-search (not (string-match regexp pattern)))
end1)
(unless path-name-regexp
(setq path-name-regexp
(mapconcat (lambda (name)
(concat (match-string 1 name) ":" path-name-regexp)
"
======== SAMPLE 15 ========
buffers (i.e. no more newlines)
(if (re-search-forward d1 end t)
nil
(match-beginning 0))))
(cond ((equal d1 d2) ;D1 > d1 and D2 > D3
(if (and (/= d3 d2) (not (eq (aref d3 0) ?\n)))
(setq d1 d2 0)
;; The D-Bus implementation of a D-Bus bus
;; implementation, D-Bus 1.2 works on all BUS and TABs.
nil)
;; A D-Bus implementation of D-Bus 2.0 works on all BUS and TABs.
(when (and dbus-ignore-busd-errors
dbus-ignore-case
dbus-ignore-case-last
(ignore-errors (find-file-name-handler
dbus-ignore-case-last))))
;; D-Bus implementation of D-Bus 2.0 works on all BUS and TABs.
(when dbus-ignore-busd-errors
;; If the D-Bus protocol fails, drop the "dud" from
;; dbus-ignore-case-last. FIXME the code below is not
;; compatible with D-Bus 2.0.
(if dbus-ignore-case-last
dbus-ignore-case-last
dbus-parse-errors)))
;; D-Bus protocol (2.0.31-3) works for all D-Bus protocols.
;; FIXME should we change the handling of the D-Bus
;; protocols (3.0.13 and later, for instance) to not require
;; D-Bus protocol information?
(with-output-to-temp-buffer errbuf (display-buffer errbuf)
(fundamental-mode))
(progn
(set-buffer errbuf)
======== SAMPLE 16 ========
buffers-buf-file-name)
(setq buffer-file-name ""))
(set-buffer-modified-p nil)
(setq current-prefix-arg nil))))
(push (list buffer-file-name) list)))
(defun erc-kill-filter-in-region (region buffer beg end)
"Kill the filter output for BEG to END.
Region is the buffer and region is ignored during removal."
(setq region (cons (format "*filtered-output %s*" region)
(encode-char (char-to-string buffer) char-width))))
;; -----------------------------------------------------------------------------
;;; User Configurable Variables
;; -----------------------------------------------------------------------------
(defcustom erc-filter-buffer-switches nil
"A list of strings to pass to `filter-buffer'."
:version "22.1" ;; No Gnus
:group 'erc-display
:type '(repeat regexp))
(defvar erc-filter-buffer-switches-from-mode 0)
(defvar erc-filter-buffer-function nil
"Function for which buffer selection is inhibited.
Used for `buffer-switch-alist', `filter-buffer' and
`buffer-saved-state', which specify a buffer to be saved and the
function used to do the filtering.")
(defun erc-filter-buffer-from-mode (buffer-source mode)
"Return the buffer in BUFFER-SOURCE selected by `filter-buffer'."
(or buffer-source
(and erc-buffer-saved-state
(let ((b (get-buffer buffer-source)))
(or (eq b 'buffer)
(setq buffer-source (buffer-local-value 'buffer-saved-state b))))))
;; Check buffer.el for compatibility with `buffer-saved-state'.
(and buffer-saved-state
(buffer-local-value 'buffer-saved-state buffer-saved-state))))
(defvar erc-buffer-saved-state 'always
"When `buffer-saved-state' is non-nil, do nothing until a new buffer is selected.
This is a buffer-var representing the state of the new buffer.
If nil, the new buffer always contains a fresh value.)
This variable is set when we remove a filter from an element of `erc-filter-buffer'.
The new buffer is restored with a fresh new value. If the buffer cannot
be selected, this variable will be removed from this list.
If `always', the filter will always be applied to this buffer. If the
buffer needs to be re-selected during uninteresting filter operations
we will consider it in this list and do nothing.
See also `erc-disable-buffers'."
:group 'erc-display
:type '(choice symbol function
function-keymap
function-interactive-p
(function :tag "Local variable"))
:version "23.1")
(defcustom erc-filter-buffer-switches-from-mode-less-p nil
"Indicates whether to be less selective when selecting a filter buffer.
This variable can be set to nil to inhibit the selection of the filtering
buffer or to the user option `buffer-saved-state', depending on the
selected variable's value."
:version "23.1" ;; No Gnus
:group 'erc-display
:type '(set (const buffer) (const all) (const current)))
(defun erc-filter-buffer-from-mode-less-p-on-mouse-action (buffer)
"For AUCTeX, switch BOB, select `buffer-saved-state'.
Otherwise for all buffers it tries to make sure the buffer still
does not have one of its filter switches."
(funcall (if (bufferp buffer) buffer
======== SAMPLE 17 ========
buffers buffer."
(cvs-status-message (format "status: %d%c" (ebrowse-status-string cvs-status)
(ebrowse-status-point (point-max))
(ebrowse-status-point (point-max))
(ebrowse-status-point (point-max))))
(setcdr org-status-mark-or-move
(delete (ebrowse-status-mark cvs-status)
(cl-pushnew org-status--marker org-status--marker
t)))
(delete-char -1)
(insert (ebrowse-status-mark-if-necessary cvs-status))
(setcdr org-status--marker (ebrowse-status-mark cvs-status))
(insert "\n"))
(ebrowse-merge)))
;; Create a new buffer.
(setq buf (current-buffer))
(set-buffer nntp-server-buffer)
(set-buffer buf) ; buffer for the output (ticked).
(set-buffer-modified-p nil)
;; Save the buffer to the cache.
(save-buffer (set-buffer) (set-buffer-modified-p nil))
(message nil)
(sit-for 0) ; if we're not done processing.
(when (called-interactively-p 'interactive)
(message "Buffer `%s' is empty, so we save it.")
(if cvs-kill-buffer
(message "Buffer %s is killed.")
(message "Buffer `%s' is killed.")
(message "Buffer `%s' is killed.")
(ebrowse-update-buffer)
(set-buffer buf)
(erase-buffer)))))
;; Display an info buffer for the output buffer.
(setq buf
(goto-char (point-min))
(prog1
(buffer-substring start end)
(message "%d output buffer %s"
======== SAMPLE 18 ========
buffers: " 1
(save-buffer)))
(t (error "Unsupported buffer `%s'" buf)))))
((stringp buf)
(if (not (buffer-name buf))
;; Use local variables and set our local variables.
(set-buffer buf)
)
(if (not (setq b (current-buffer)) buf))
(set-buffer b))))))
((memq buf '(nil (t (selected-window)))
(not (window-minibuffer-p))))
((memq buf '(* )) (set-buffer buf))
(t (error "Buffer %s does not exist" buf)))))
(buffer-disable-undo)
;; If the buffer was deleted,
;; and there's a new buffer,
;; delete-file-name, and delete-file-buffer.
(let ((buffer-name buf))
(unwind-protect
(progn
(delete-file buffer-name)
(apply 'delete-file buf)
(write-region "foo" nil nil buf))
(kill-buffer buffer-name)
(kill-buffer (get-buffer-create buf)))
;; If we don't have a buffer, it could be that the user typed
;; multiple spaces from the user's mark in the minibuffer.
(unless
(set-buffer buf) ;Don't delete it.
(when (stringp (car kill-ring))
(setf (car kill-ring) (list "^$")
(if (symbolp (cdr kill-ring))
(car (cdr kill-ring))
(car (cdr (last kill-ring))))))
(delete-file buf)
(kill-buffer (or buffer-file-name
(get-file-buffer buf)))
(and
(not (eq major-mode 'find-file-other-window)))
(user-error "The buffer must be in Emacs 26.1"))
(when (listp kill-ring)
(with-current-buffer buf
(insert kill-ring))
;; Make sure we don't get interrupted for such a long time.
(erase-buffer)
(dolist (buffer kill-ring))
(when (buffer-live-p buf)
(with-current-buffer buf
======== SAMPLE 19 ========
buffers will come from
`:window-list-end'.
You must call this with a single argument, not with a single
argument."
(interactive)
(or (window-hidden-p window)
(setq window (get-text-property (point) 'invisible)))
(if (not (eq window 'selected))
(setq winconf-selected-window-configuration
(window-combination-p
(next-single-property-change (point-max) 'invisible nil))))
(setq window-config (window-parameter window 'window-configuration))
(let* ((window-config-buf-name "*Window Configure"
(window-config-name (buffer-local-value 'window-config-buf-name
window-config)))
(window-config-bufbuf-namewinconf-name
(if (and window-config-buf-name window-config-buf-namewinconf-namewinconf
(or window-config-buf-name window-config-buf-namewinconf-buf
(and selected-window-configuration winconf-selected-window-configuration))))
(if (or window-config-buf-name window-config-buf-namewinconf-namewinconf)
(window-config-bufbuf-namewinconf-namewinconf
winconf-selected-window-configuration))
(if (window-parameter window 'select-window)
(window-config-bufbuf-namewinconf-name winconf-selected-window-configuration))))
(setq window-config-buf-name (window-parameter window 'window-config-buf-name)
window-config-buf-namewinconf-name (window-selected-window))
(pop-to-buffer window-config-buf-name)
(select-window window-config-buf-name)
(setq winconf-selected-window-alist
(assq window-config-buf-name winconf-selected-window-alist))
(set (make-local-variable 'window-conf-select-buffer)
'((max-mini-lines (window-minibuffer-window))
(minibuffer-frame-lines (window-minibuffer-window)))))
;;;###autoload
(defun display-next-buffer (proc buffer &optional window)
"Like `next-error', but show buffer BUFFER's current state instead.
This command might use some fancy special characters, so they won't work
with the current buffer. This command is for people used
by `display-buffer' (the default).
PROC is the buffer window showing BUFFER.
BUFFER is a buffer. Optional argument WINDOW is the
window to switch to.
Interactively, this command uses the following syntax:
(or (buffer-name buffer)
(display-buffer buffer window t))
If WINDOW or nil be non-nil, the process will be shown in another window.
When WINDOW is a process, or is a process, start-process and exit-process are
used. If WINDOW is nil, PROC becomes the process selected last time.
This function runs `display-buffer-custom-prop-hook'."
(if window
(progn
(when (< display-buffer
======== SAMPLE 20 ========
buffers to ": ".
;;; END defun
;;
(define-widget 'editable-list-space 'editable)
(defcustom editable-list-menu '(editable-list-entry)
"Menu for `editable-list-separator-function'.
To customize the menu, type `C-c C-i' (or, C-c C-i C-n, C-c C-c)."
:group 'editable
:version "24.4"
:type '(repeat (symbol)))
(defcustom editable-entry-map-list-min (mapcar (lambda (elt) (cons elt nil)))
"A list of Emacs Lisp commands and items to put in the minibuffer.
Keys must be strings. A key must take a single symbol and
be a symbol. A key with a nil value is like a "mouse ring key"
\(mouse ring) for functions, items, and variables. You must provide a key
defined by a valid function key without any other symbol than your
function name. When this is not your function function name, a
key, which appears in the minibuffer but is not a word-delimiter like a
variable name, and is not a keyword, is added to this list. When a
key is inserted into this list, the key you give the key to place
on the following pair is put into this list."
:version "24.1"
:type '(repeat (symbol)))
;;;###autoload
(defun editable-set-menu ()
"Set up a list of menu items in the minibuffer, in the current buffer.
The first item, if there is one (see `editable-list-menu' and
`editable-map-list'), is the buffer buffer (or buffer-or-list buffer with the
previous item), and the last item is the buffer that was last saved in.
This is similar to `set-menu', except the key you give the key to place is
not used in the minibuffer."
(interactive)
(use-local-map editable-menu-map))
;;;###autoload
(defun editable-toggle-entities ()
"Toggle whether the buffer A is to be inherited to the buffer B.
If called interactively, BUFFER is the buffer that is being
taken in and BUFFER if BUFFER is nil is either the buffer in
The Old or a buffer in the New Buffer, the buffer A is a buffer in
The Old or a buffer in the New Buffer."
(interactive)
(if (not editable-hist-buffers)
(setq editable-hist-buffers
(mapcar (lambda (elt)
(cons elt (selected-window))
(make-hash-table :size 20hash-file-size)
(lambda (sym &optional ignore-nil)
(if ignore-nil (set-buffer-modified-p nil)
(set-buffer-modified-p t)
(kill-buffer (current-buffer)))))))
(user-error "This was already run in the buffer set up")))
(defun editable-list-sort-toggle-entities ()
"Sort the selection in the buffer list. This is a copy of
`editable-list-menu', which is used for sorting the buffer list."
(interactive)
(set-buffer-entities nil)
(force-mode-line-update t)
(insert "Menu for `editable-list-separator-function': ")))
;;;###autoload
(defcustom editable-list-menu-menu
`("Editable List" . editable-list-separator-function)
"Menu for `editable
======== SAMPLE 21 ========
buffers--enable-printing) (current-buffer))
(if (= (window-point window) 6) (raise-frame frame) t)
;; Not supported by xterm
(set-window-dedicated-p (selected-frame) t)
;; Not supported by mouse
(let ((new-frame (window-frame window)))
(cond
((> (window-height window) 4)
;; A window with a different height than default, or zero if not.
(let ((height (float (float (nth 3 (last resize-window-size
(window-height window))))))
((= (window-width window) 5)
(set-window-new-pixel t height t))
(t
(set-window-new-pixel t nil height))))
(frame-edges
(set-window-edges window (selected-window))
nil new-frame)
(t
new-frame)))))
;; This is a fixed buffer that contains a window, and we have to have
;; sure we have all the pixels, because we can't use the same selection
;; that was used.
(with-current-buffer (window-buffer window)
(let ((n 2)
resize-window-size-internal)
(or
frame-width
(while (and (not resized) (not (window-dedicated-p window)))) ; avoid window dedicated
(setq height (+ height window-size-internal)
resize-window-size-internal t)
(or (window-dedicated-p window) (set-window-dedicated-p window t))))))
(defun frame-height-to-width (height width)
"Return the height of THUMB-LIST on WIDTH-LIST in WIDTH-LIST."
(frame-preserved-vscrolls 0)
(with-current-buffer (window-buffer window)
(if (not (window-minibuffer-p window))
height
(window-pixel-height window)
(frame-char-height))))
(defun buffer-auto-center (&optional mouse)
"Center point of region by adjusting the width of selected frame.
Optional argument MOVE non-nil means use frame's current width;
or nil if MOVE starts before the selected window.
If MOVE has the prefix `left', the point moves over left edges of
the selected frame."
(interactive "P")
(save-window-excursion
;; Go to start of region if we don't move past the selected window.
(let* ((window (or mouse (selected-window)))
(pos (window-text-pixel-width (point-min) (point-max)))
(width (mod (window-max-pixel-width window)
;; Not visible, but the following two variables are
;; used when we can't use a dedicated window:
(window-width window))))
(if (eq (window-point window) pos)
(set-window-point window pos)
(set-window-buffer window nil)
======== SAMPLE 22 ========
buffers (
)))
(defconst js--generic-keybindings-alist
'(("end" "<tab:set-left-element-only-p=\"1\">")
("begin" "<tab:set-right-element-only-p=\"1\"")
("end" "<tab:set-right-element-only-p \"2\"")
("end" "<tab:set-right-element-only-p \"3\"")
("eol" "")
("eop" "")
("eop" "")
("begin" " "<tst:end>")
("end" "")
("begin" (documentation 'document)
:style toggle :selected (not (assq :prefer-old-style
(list :ascent
'center
:mouse-face 'highlight)))
:keys "\\C-c\C-d")\n"
("frown" (downcase (downcase (or first n))))
("head" (upcase first n)
:style toggle :selected (not (assq :ascent nfln-head-width
(list :ascent first n))))
("paw" (upcase first n)
:style toggle :selected (and (eq nfln-head-width
======== SAMPLE 23 ========
buffers-menu
;; Make the menu bar, or at least the submenu of the menu,
;; a window instead of a mouse-face.
(menu-bar-buffer-buffer-name)
(list (concat "*New Buffer Buffer" name (buffer-name))))
"List of buffers to display in the menu bar buffers menu.")
(defcustom menu-bar-menu-buffers
'(("Toggle" (menu-bar-display t)
("Search" (menu-bar-search t)
("File" (customize-file)
("Directory" (customize-directory))
("Source Selection" (customize-selected-window)
("File" (customize-selected-window)
("Source Selection All Files" (customize-selected-window)
("Directory" (customize-directory)))
("Search" (menu-bar-search)
("Directory All" (customize-selected-window)
("Directory Files" (customize-selected-window))
("Directory Files All" (customize-selected-window))
("Filter" (customize-filter)
("Filter All" (customize-selected-window)
("Directory" (customize-directory)))
("Save All" (customize-save-all)
("Save All" (customize-save-all)
("Directory" (customize-directory))
("Filter" (customize-filter)
("Filter" (customize-filter)
("Filter Files" (customize-save-files))
("Filter Files All" (customize-save-all)
("Filter" (customize-filter)
("Filter Files All All" (customize-save-all)
("Filter" (customize-save-all)
("Filter on" (customize-filter-on)
("Filter all" (customize-filter-all)
("Filter on" (customize-filter-all)
["Filter on All" (customize-filter-all)
:help "Filter on all" (customize-filter-all)))
:keys "m u "]
:value ("" menu-bar-menu-buffers)])
"\C-o\C-d"
"----"
menu-bar-buffer
;; Make a header or button.
(insert "File"))
"\Oe\C-e\C-d "
"----"
menu-bar-menu-buffers-done
"\C-d\C-z"
======== SAMPLE 24 ========
buffers if `sprintf' is specified.
;;
;; If `sprintf' is specified, \"\" will be replaced by \"%\".
;; The format string is given by the \"\".
(defsubst smerge-formatify-smerge-tag (tag &optional buffer)
(with-current-buffer (if buffer (current-buffer) (current-buffer)))
(if buffer
(save-excursion
(goto-char (point-min))
(if (featurep 'xemacs) (forward-line 1)
(unless (looking-at (concat "\\s \\(?:\\(" smerge-command-marker "\\)\\)")
(error "No template set or function name"))
(error "There are no template set or function name"))))
(cond
;; We must call the function so the function will call us
;; within the next smerge-buffer.
((save-excursion
(let ((beg (point-at-bol))
(end (save-excursion (search-backward "|")
(setq beg (point-at-bol)
end (point)))))
(if (and buffer (fboundp 'pascal-mode-minor-mode))
;; In Pascal mode, call an Emacs function after inserting
;; a marker (not a list entry) before the "\\(?7+\\|?7\\+\
" since there is nothing that distinguishes an " \" + " and "\\(?7+\ "
\"\\(?7+\\|?6\\)\"").
(save-excursion
(beginning-of-line 2)
(looking-at-p (if (> (point) beg) "\\(?7+\\)[")
(forward-char 1)))
;; In Pascal-mode, a \" + " and "\\(?7+\") is required to indicate an entry that
;; isn't an entry to a " \\(?7+ ", " %".
(save-excursion
(forward-char 1))))))
(pascal-formatify-tag beg end tag buffer))
(defsubst smerge-unquote-any (tag &optional buffer)
"Make \"\" as a comment and ignore `//' and `#'"
;; `;', we call `unquote' above. But, since we need `unquote',
;; (as in quote) we do use `ignore', so we will use `unquote' here.
;;
;; For this example, we have to use `case-fold-search' here since `case-fold-search'
;; causes `case-fold-replace' to be applied on the first string of tag
;; as a substatement rather than a part of the rest of tag.
(remove-hook 'pre-command-hook #'smerge-tag-pre-command t)
(remove-hook 'mode-line-process-functions #'smerge-tag-mode-hook nil t)
(remove-hook 'post-command-hook #'smerge-tag-post-command-hook t)
;; `ignore' has to be a function. For each tag that isn
======== SAMPLE 25 ========
buffers
(t :toplevel))))
;; This was a bug in the previous
;; version and I added it here:
(insert "\n")
(setq sbufs (cons fbufs sbufs)))
(goto-char pos)
(set-buffer tbufs)
(switch-to-buffer tbufs)
;; I am using an older code and should
;; use font-lock to bind this here too!
(font-lock-add-text
:fontify fbufs
font-lock-defaults)))))))))))))
(setq buffer (get-buffer-create sbuf))
(kill-buffer sbuf))
(defun font-lock-add-text
(list string newlist &optional silent-for-whitespace)
"Add string NEWLIST as comment with face STRING.
When SILENT-FOR-WHITESCAPS is non-nil, only check for whitespace
before adding the string.
If STRING is not a comment, it is not added."
(set-buffer-modified-p nil)
(let ((bufs (list newlist string newlist))
p buf sbufs buf1 buf2 sbuf1 buf2 buf3 p buf3 sp buf4 buf3 buf5)
(while (and buf1 (memq buf buf2))
;; This is to avoid losing all that 's' and 'sp'
;; before adding the string.
(setq buf (pop buf1))
(setq buf1 (car buf1) (cdr buf1) buf1 buf "")
(while (setq buf (pop buf1))
(setq buf2 (car buf2))
(setq buf1 buf2 buf2))
;; This is to make sure any additional whitespace is just after the
;; comment.
(if (memq buf buf1) (setq buf buf1))
(setq buf1 buf2 buf2 buf1 buf2 buf2 buf3 buf3 buf1 buf2 buf3 buf3 buf4 buf4 buf5 buf5 buf6 buf6 buf6 buf7 buf7 buf7 buf8 buf8 buf7 buf9 buf8 buf9 buf9 buf9 buf0 buf0 buf0 buf1 buf1 buf0 buf2 buf3 buf2 buf3 buf2 buf3 buf2 buf0 buf2 buf1 buf
======== SAMPLE 26 ========
buffers in that case. Also there can be one or more
;; `todo-filter-files' buffers in the current frame, if it's a buffer
;; and its name begins with t, in which case, `todo-filter-files-mode'
;; will do the right thing.
;; In case the file doesn't exist, that buffer's description will be
;; added to this buffer's listing.
;;; Variables:
(defcustom todo-buffer-file-name nil
"Name of the current buffer to point to as its standard file name.
If nil, use name of that file, or a different name if a buffer
has a specific header. The buffer name is normally used by
all subdirectories.
If non-nil, point runs `todo-mode-hook-revert'."
:type '(choice file
(const :tag "Not a directory" nil)
(other :tag "Use (non-nil)" nil)
(other user-function :tag "No longer defined" t)
(const :tag "No longer defined" nil)
(other function)))
:version "27.1" ;; No Gnus
:group 'todo)
(defcustom todo-buffer-file-name-function 'todo-get-lisp-file-name
"Function used to handle a file name in a filter or tags buffer."
:type 'function
:version "25.1"
:group 'todo)
(defcustom todo-buffer-filter 'todo-get-lisp-do-buffer-filter
"Method to return a todo-related buffer.
If nil, use method of current buffer."
:type '(choice (const :tag "Try all")
(const :tag "Try all in one buffer" t)
(other :tag "All buffer (default)" nil)
(other function)))
(defun todo-files-directory (&optional dir-switches)
"Find the directory for the current buffer's files on DIR-SWITCHES, or nil."
(if dir-switches
(concat (if dir-switches (substring dir-switches 0 (length dir-switches))
(or dir-switches "")))
(file-local-name (if dir-switches
(concat (concat ".*" ".*\\.")
" todo-do-directory" "")
"?\\(.*" ".*\\).")))
(defcustom todo-todo-file-attrs-list (purecopy
"
"
"
"
"
======== SAMPLE 27 ========
buffers
(todo-item-text)
(todo-backward-item-end 0))
(todo-forward-item-end 0))))
(defun todo-item-beginning-regexp ()
;; FIXME: Should be faster and more concise than deleting, but it
;; makes it hard to change the default in case of a request for a
;; new line. Is it better here? --Stef
(if (equal todo-item-beginning-regexp "^\\s-*")
(let* ((to-beginning (match-beginning 0))
(end (and todo-point (match-end 0)))
(marker (or (and (= end to-beginning)
(save-excursion
(backward-char)
(looking-at todo-item-begin-regexp)
t)))
(next (or todo-item-beginning
(save-excursion
(forward-line -1)
(looking-at todo-item-end-regexp))))
(to (and todo-buffer
(or (= todo-buffer to-end)
(and (= end todo-buffer) ; Don't move forward if we're done.
(= (preceding-char) ?\?)))
(and (= todo-beginning-end 0)
(looking-at todo-category-regexp))))
(end (match-end 0))))
;; Skip forward and backwards.
(if (and (= todo-beginning-end
todo-end)
(< todo-beginning-region before-change-fun))
(forward-line -1))
;; Move to beginning of line, and forward to the end of it to reach end-
;; or start a new file.
(if (eq (point) (point-max))
(setq from (- todo-end-of-item-indent))
(beginning-of-line) ; Go forward from item.
(forward-line -1)
(forward-char (if (search-forward "\n\n" nil t)
======== SAMPLE 28 ========
buffers and the text
;; after the ";;" and after the ";;" before the ";;" and before the ";;" and before the
;; ";;" and after the ";;", whatever the meaning of those
;; words. These are special symbols whose functions are not bound by
;; the special mode.
(let ((symbols (symbol-function symbol))
(case-symmetric (symbolp function)))
(while (and symbols (not (member function symbols)))
(setq symbols (symbol-function symbol))
(unless (memq value symbol)
(setq values (funcall value symbol)))
(setq symbols (append lists (list symbols)))
(push (cons value values) symbols)
(setq symbol nil)
(while values
(insert (format "(setq values (setq %s (setq %s (setq %s (setq %s (setq %s (setq %s (setq %s (setq %s
(setq %s (setq %s (setq %s (setq %s
set
"("
")"))))
"\n"))
"\n")))
(buffer-local-value
value
(or (symbol-function symbol) t))
(or (buffer-local-value
value
value
(or (symbol-function symbol) t))
======== SAMPLE 29 ========
buffers
(set-buffer-file-coding-system
coding-system
filename-coding-system)))))))
(set-visited-file-modtime filename)
(set-file-modes filename file-modes)
)
"==============================================================================' The standard coding system for browsing files.")
(defun file-name-all-completions (file)
"Return a list of all completions (single quote char or char in
multiple quotes) for FILE in a sorted order."
(let ((buffer (find-file-noselect file 'nomessage)))
(dolist (buf files)
(dolist buffer (buffer-list
(find-file-noselect buf 'nomessage 'name)))
(if (not buffer)
nil
(set-buffer buffer)))))
(defun file-path-compile (file)
"Like `file-name-compile' but return a list of the files in FILE
with paths for directories that are not part of directories."
(let ((buffer (find-file-noselect file t)))
(if buffer
(mapc (lambda (file-name-extension)
;; The extension is not supported - use the `file' thing-can-be-compr'.
(format-mode-line file-name-extension))
(format-name-mode-line buffer))))
file)
(defun file-name-parse (filename &optional directory)
(let ((case-fold-search (if directory buffer-file-name-history
(list name buffer-file-name-history)
(symbol-function (lambda (x) (car x))
(car x))))
(unless (file-exists-p filename)
(error "%s does not exist in %s" filename filename))
(if directory
(with-current-buffer buffer
(let ((filename (file-name-directory filename)))
;; There may be more than one directory in the file.
(setq filename (directory-file-name filename))
(let ((default-directory (file-name-directory filename)))
(and (file-directory-p filename)
(setq directory (file-name-directory filename))
(find-file-noselect default-directory)))))
;; If there are more than one directory and we had used
;; filename, make a new one and use that directory instead to avoid
;; using multiple namespaces when a filename is specified.
(unless directory
(set-file-modes filename (expand-file-name filename directory))
(error "%s does not exist in %s in %s" filename filename))
======== SAMPLE 30 ========
buffers (instead of the ":foo"))
(if (math-negp a)
(progn
(setq a (math-neg a))
(if (Math-integerp a)
(setq a (math-neg a))
(setq a (math-neg a)))
(if (eq (car-safe a) 'error)
(math-reject-arg a 'numberp))))
(calcFunc-logand (ediff-get-width))
(if (or (and (math-negp a) (math-negp b))
(not (eq (car-safe b) 'vec))
(math-lessp (ediff-get-width) 1))
1
(< (ediff-get-width) 3)))
(if (eq (car-safe b) 'vec)
(if (equal a x)
(math-zerop a)
(math-sub a x)
(if (eq (car-safe b) 'vec)
(math-div a 3)
(math-reject-arg b 'numberp))))
(if (Math-lessp a x)
(if (math-lessp b x)
(if (eq (car-safe b) 'vec)
(math-zerop b)
(let ((e x))
(if (Math-negp e)
(setq e (math-neg e)
b (math-min b b n))
(if (eq (car-safe e) 'vec)
(if (Math-lessp a x)
(setq b (math-min b e)
e (math-neg e)
x 0)
(setq b (math-neg b e)))
(or (not (Math-zerop b))
(math-reject-arg b 'numberp))
(math-reject-arg b "Attempt to div by zero"))
nil)
======== SAMPLE 31 ========
buffers from current line.
See Info node `(Emacs)Command Line Commands'."
(interactive (list (completing-read
"Output buffer's command line: "
(Info-read-string "Command line command: ")))
(string (if (stringp info) (car info) nil))
:regexp "")
(Info-current-buffer nil))
(Info-delete-command-line 'backtrace "de")
(revert-buffer)
(set (make-local-variable 'comment-start)
(if (memq (char-after) '(?w "w")
(not Info-w32-natively "w"))
(error "The comment should not be in the Info buffer")))
(if Info-w32-natively
(error "Error in `natively'")
))
(defun Info-find-file (filename &optional old-dirs)
"Find a file in Info file FILENAME.
Return the list of files whose names are contained in that file."
(if (file-directory-p filename)
(let ((coding-system-for-read nil)
(coding-system-for-write nil) ; For Info-read-string.
(coding-system-for-write nil) ; For Info-read-string.
)
(let ((coding-system-for-write nil)
(coding-system-for-read-multiple nil)
(coding-system-for-read-no-log-conversion nil)
(locate-file-coding-system
filename (or old-dirs "C: ")))))
;; Check if we can access the remote files.
(if (not (Info-find-file (Info-current-buffer)))
;; We can access the Info file.
(let ((coding-system-for-read Info-filename-coding-system)
(file-coding-system Info-file-coding-system)
(coding-system-for-write (or old-dirs "C")
(or file-coding-system-frobbed
'no-conversion))))
;; If we use the current buffer, check for Info-type in other
;; buffers.
(set-buffer old-buffer)
(setq buffer-read-only nil)
(erase-buffer)
(goto-char (point-max))
(insert "Info file: " filename)))
(setq Info-buffer "*Info*")
)
(defun Info-find-file-internal (filename &optional old-dir
======== SAMPLE 32 ========
buffers.
;;;###autoload
(defun org-list-all-entries (sort &optional files)
"Get all entries in REGS according to sort sort order.
Return all entries in this list, including the first one that
has a `files' entry."
(if files
(let ((count (apply #'+
(lambda (key value-list)
(unless (equal "" toplead)
(equal "" toplead))))))
(while (and files (< count (car files))))
count
(setq count (car files)
files (cdr files))
count))))
;;;###autoload
(defun org-list-in-references (sort &optional keys)
"Get all entries in REGS according to sort sort order.
Set in the function `org-list-get-references'.
With optional argument KEYS, get all entries that match `org-list-get-references'."
(let ((alist (apply #'+ (mapcar #'identity keys)))
key)
(dolist (entry (list (list toplead nil
(unless (or keys (equal "" toplead))
(and (equal "a" toplead)
(equal "" toplead))))
(or keys (setcdr keys nil))))
(when (and keys (member entry alist))
(push entry alist))))
(setq keys (sort keys)))
;;;###autoload
(defun org-list-all-entries ()
"Get all entries in the reference alist according to the element
point-at-a-time and search alist for matching reference.
With optional argument ARG, search alist for matching item and
default or item. This is useful if the search alist is empty.
For example:
\(org-list-get-references
:begin{item} :end{item}
will search for all entries that match `org-list-get-references'."
(let ((alist (org-list-all-references)))
(mapc #'car alist))))
(defun org-list-get-references (type &rest names)
"Return the names of all entries in the reference alist (a subset of
the list)."
(and names
(mapcar (lambda (element)
(org-list-get-references element type)) (cdr names)))
(mapcar #'car org-list-all-references))
(defun org-list-find-all-references (list type &optional predicate)
"Find all matching references for LIST of type TYPE in LIST.
Optional argument PREDICATE is for a specific predicate."
(let ((refs (list (org-list-all-references)))
(ref-list
(mapcar
(lambda (element)
(org-list-get-references (nth 1 element) type)) element)))
======== SAMPLE 33 ========
buffers (instead of using the new default
(save-excursion
(goto-char (point-min))
(while (< (point-max) (match-end 0))
(unless (re-search-forward "//" nil t)
(replace-match (match-string 1) nil t t)))))
;; Restore the old syntax table, but it is not needed at the moment since
;; the old version is a bit of a mess (e.g. newfont does not look
;; like any other font). Maybe this is the way to go?
(forward-comment -1) ; comment is allowed to ignore
(back-to-indentation)
(skip-chars-forward " ")
;; Check that comments with the same level and same indent are delimited by
;; whitespace if they have more than one parent (Bug #13476).
(setq indent (string-match "[@?#%?\n\t`\t[]*]*" regexp ntokens))
(unless (eq indent 'space)
(error "Indentation beyond (point-min) or (-point-max)"))
(beginning-of-line)
(indent-to indent)
;; Skip forward over leading whitespace in the middle of a line.
(if (zerop (% indent 1))
(let ((nextp (point))
(limit (point-max))
(line (current-indentation))
start)
(while (< (point) limit)
(unless (or (looking-at "\\s(\\*#\\s-*$")
(save-excursion (re-search-forward "\\*" nil t)))
(goto-char limit)
(unless (looking-at "[ \t]*#\\s-*$") ; not an explicit line comment?
(goto-char (match-end 0)))))))
(defun org-remove-indentation (beg end &optional no-backspace)
"Remove indentation from the line for the current paragraph.
Calls be either from back-to-indentation or from `beginning-of-line'."
(let (point)
(save-excursion
;; Back up over a whole line to end of first newline
(end-of-line)
(while (and (not (org-at-heading-p))
(< (point) beg))
(if (or no-backspace (and (org-at-heading-p) (not (bobp)))
(bobp)
(> (point) end))
(progn
(backward-comment (- (point-max) beg)))
(setq point (match-end 0)))
(setq point (next-single-char-property-change
point 'indentation t))
(when (or (equal indent '(3))
(<= (point-max) end))
(user-error
"Don't know how to indent an arbitrary blank line"))
(setq point (next-single-char-property-change point
======== SAMPLE 34 ========
buffers
(org-element-lineage-tags
element info))
:options '((:type string)
(:all)
(:post-blank)
(:post-affiliated)
(:post-affiliated-p))
:conversion-table
(let ((table (make-char-table :max-count 'org-element-table-extra)))
(when table
(concat (make-string org-element-tabify-string ?\x00d4) "\n"))
(pcase (org-element-interpret-data table)
(`nil . (forward-char))
(`(,level . ,(org-element-property :todo-level info)))
(`todo . (or (org-element-property :todo-type info)) ""))
(org-element-table-map table 'element-display))
(org-element-interpret-data info (org-element-interpret-data table)))
(defvar org-clock-current-clock) ; dynamically scoped with
; context-line-function
"Clock definition.")
(defun org-clock-current-datetime-to-inherit (datetime &optional time-limit)
"Convert TIME-LIMIT into a datetime element.
TIME-LIMIT is a time format in seconds for the time element.
DOCTYPE is the location of the datatype to convert."
;; Convert the value of a data element into a time spec in today's
;; 24 hour time frame. This way, as a result, it will have the right
;; timestamp for days between 1 or 5 at a time.
;;
;; Note the special handling of time-enumerating symbols
;; which can have time-samp functions on days in an interval.
(let* ((datetime (org-date-to-seconds time-limit))
(date (org-element-property :datetimedatetime datetime))
(times (when (string-match time-enumerating datetime)
(match-string 1 datetime)))
(time-limit (with-current-buffer (get-buffer-time (org-buffer-file-name
(org-element-lineage datetime))
(buffer-string))))
(setq datetime (format (when (string-match time-enumerating datetime) time-limit
time-limit))
time-limit (buffer-local-value 'time-limit datetime))
(cond
((= time-limit 0)
(setq datetime (org-datetime-to-samp-date time-limit)))
((> z (org-element-element-property :contents-begin tag))
(setq z (org-element-property :contents-end tag))
(setq z (org-element-property :begin tag)))
((< z (org-element-element-property :contents-end tag))
======== SAMPLE 35 ========
buffers (if any). Otherwise,
;; all entries should be located on `org-entry-end-marker-locally'.
(defvar org-entry-end-marker-locally nil
"The entry-end marker location from which the region was entered.
This marks the current buffer as a specific entry.
The value of this property can be:
`default-entry' Ignore this entry;
Ignore, if non-nil, all entries in this region.
`default-entry' Ignore this entry, otherwise the
entry in this region will not be visited in
future sessions.
`interactive' If this is nil, display the current buffer.
An optional fourth arg, a cons of the current buffer and its
parameter, defaults to `org-entry-start', forces the buffer to be on the
left side of `org-entry-end' and the last entry on the right. If
the other args, a nonempty first form, force buffer to end before selecting an
entry or entry group."
:group 'org-link-follow
:tag "Edit"
)
(defcustom org-entry-end-marker-local #'string-to-char
"Default marker locations from which to visit a region.
The value should be a buffer-local property whose value is the
buffer position of the last entry in this region. Org does not
need to know the marker location in this buffer, for
example, we mark the buffer empty (because the buffer was last modified")
and use the local value as its default value to determine the
end of a buffer window."
:group 'org-link-follow
:type '(choice (const :tag "Default Buffer" string)
(const :tag "Buffer" nil))
)
(defcustom org-entry-local '(:after . +)
"Local key/value pairs of the current buffer.
The value should be a buffer-local value, or a value set to nil."
:group 'org-link-follow
:type '(choice (const :tag "All" :inherit ignore)
(const :tag "No" :inherit ignore))
)
(defcustom org-entry-local-key nil
"Default to the entry key, the same as the :local keyword of Org mode."
:group 'org-link-follow
:type '(choice (const :tag "Local Key" :local " :value " nil))
)
;;; Internal variables
;;; Internal functions
(defun org-entry-open (key value)
"Open entry of the text key given by KEY in the region at point.
Return a string that indicates the position of the opening paren."
(open-region
(save-excursion
(goto-char (point-min))
(or (re-search-forward "^[<{$@]" nil t)
(re-search-forward "^\\(?:" nil t)))))
(defun org-entry-close (key value)
"Close entry of the text key given by KEY in the region at point.
Return a string that indicates the position of the closing paren."
(with-current-buffer (get-buffer-create "*org-entry-close*)"
(erase-buffer)
(buffer-substring (point-min) (+ (point-min) 100.0)))
(let ((open-paren-pos
(cl-remove-if
(lambda (lst)
(if (looking-at "\\(:+
======== SAMPLE 36 ========
buffers are
used as an interactive hook, and the buffer list is made by
compiling sub files and then calling `run-hooks' on all sub
files that use them. A buffer is loaded in this way if either
the file we're inserting or the buffer list is modified."
(interactive
(list current-prefix-arg
;; Make buffer list only when `inhibit-frames' is non-nil
(kill-buffer buffer-list)
;; If buffer's not in an element, this works as well as it could
;; for us.
(if inhibit-frames
;; For non-interactive operation, the buffer now belongs to that
;; list first.
(let ((buffer-read-only nil))
;; If buffer's file was not in the buffer list last command,
;; we should unset buffer-list to its last element.
(if (consp buffer-list)
(setcdr buffer-list nil)
;; The buffer list might have changed or was modified in this
;; case.
(setcar buffer-list buffer-list))))
;; Try it. When the next buffer is shown, this will only happen
;; once for every command: It's as easy as returning
;; the buffer list's contents to this function.
(with-current-buffer buffer-list
;; FIXME: The buffer list might be deleted after the next call:
;; https://lists.gnu.org/r/help-gnu/2016-02/msg04071.html
(when buffer-list
(if inhibit-frames
(pop buffer-list)
(with-current-buffer buffer-list))))))
(interactive)
(if inhibit-frames
(progn
(setq buffer-list (delete buffer-list inhibit-frames))
(error "Buffer %s is not in buffer list" buffer-list))
(let ((list (delete buffer-list inhibit-frames))
found)
;; If the buffer list was not in the buffer list, we now set (nth 0 list) and it's
;; now (nth 1 list).
(if (and (consp list) (> (length list) 0)) ;; just set nth and nth as first elements of list to first
(progn
(setcdr list (1+ (cdr list)))
;; See if there is a list of the same element.
(if (cdr list)
(setCdr-last (nthcdr n (length list)))))
;; If this buffer list's buffer is killed.
(if (car list)
(puthash (car list) t list)
(let ((entry (if (cdr list) (car (nthc
======== SAMPLE 37 ========
buffers to a line that will be displayed when the
;; current buffer is changed. The lines must not begin or end in front
;; of the current buffer and point before the new line. This is useful
;; for `display-buffer-adjust-window' and
;; (some) Emacs versions, where a new line may be displayed
;; during a region of text. A buffer that has no beginning or end in
;; these respects will be displayed.
;; If, when the new line is displayed a second time, the new buffer is
;; put back where it was put in the initial buffer, before we change it.
;; If the buffer is modified and cannot be used again, the modification time on
;; the new buffer is 30 minutes.
;; I'd also like to recommend using `sit-for', which will make the buffer
;; not be read-only. If you set this before Emacs 27, you should do
;; no harm if you set it before Emacs 27, and don't give a signal that
;; when the buffer gets read-only it will become read-only when you turn it.
;; Bug reporting is not allowed in this version, I'm thinking of ways to
;; reduce the number of lines to a single blank-separated argument in the
;; buffers
(defvar revert-buffer-function-name "function"
"Function name bound to the buffer buffer name.
See `run-hook-with-args-until-failure'.")
(make-variable-buffer-local 'revert-buffer-function-name)
(defun revert-buffer (&optional arg)
"Recursively kill last modified last ROUTE command."
(interactive "P")
(let ((arg (prefix-numeric-value arg)))
(if (eq (event-modifiers-get arg 'revert-mode) 'toggle)
(error "`revert-mode' cannot be nil in Transient Mark mode")
(setq revert-buffer-function-name (if (equal arg 1)
"revert-"
"revert-")))
(run-hooks 'revert-buffer-hook)
(revert-buffer arg)
t))
(defun revert-buffer-interval (arg &optional arg)
"Interactively read a number of seconds from the last modified buffer in
the mode at point and run any hooks specified by ARG.
Interactively, a number of seconds means reset any hook. If it
is greater than zero or negative, run a buffer-local hook -- the hook
that was run last time, and not the one that was run this time. As
part of the hook, run `after-change-functions'. The default hook `after-change-functions',
for example, should be equivalent to `run-hooks'. To get all the hook
functions running on a single command, set `revert-buffer-function-name'. Note that
in all buffers, a command called `revert-buffer' does always leave the new
buffer buffer-locally. In this case, run the buffer-local hooks in
or buffer-local hooks on the current line and do what you would
do otherwise."
(interactive "P")
(revert-buffer (selected-window) arg t))
;;;
;;; Menu management
;;;
(defun revert-buffer-menu-from-history (arg &optional new-history-command)
"Regenerate the menu line with ARGLISTI for the next time the buffer is changed.
This command applies `revert-buffer-menu-from-history' to all lines that have ARGLISTI
and, if present, the menus at point for that line.
This function should only be used with `before-change-functions', which use
`revert-buffer-menu-from-history' to rebuild the menus for the buffer
changed."
(interactive
(when (or (not (get-buffer-window buffer-or-name))
(not (= (window-start) (window-width)))
======== SAMPLE 38 ========
buffers or buffer editing."
(interactive (list last-nonmenu-event))
(let* ((menu-char (symbol-name (menu-bar-item-from-menu)))
;; We have to insert the menu here;
;; if we don't there's no prefix argument.
(menu-beg (buffer-substring (point) (point-max)))
(menu-end (buffer-substring-no-properties
(match-end arg) (match-end 4))))
(if (and (string-match "\n" menu-char)
(eq menu-end (setq menu-beg (match-end 1)))
(file-name-absolute-p file-name-locals-or-string))
(progn
(beginning-of-line)
(set-mark (point))
(let* ((menu-beg (string-equal
(substring menu-beg (match-beginning 1))
(length (buffer-substring-no-properties
(1- (point))))
(length
(match-beginning 1)
(point))
(point-max))
(case-fold-search nil))
(menu-end (buffer-substring-no-properties
(match-beginning 2) (match-end 2)))))
menu-end menu-beg menu-end-or-eol
(while arg
(funcall (menu-bar-function-keyword (pop arg))
(or (car (memq menu-end menu-end-or-eol))
(car (assq (car arg) menu-beg))
t))
(setq menu-end (cdr arg))))
(message "Loading Buffer...")
(sit-for 0)
(setq menu-end-or-eol (or menu-beg menu-end-or-eol)))
(dolist (key '(("beginning-of-line" "beginning-of-buffer" "exit-minibuffer")))
(setq last-nonmenu-event last-nonmenu-event-command-event))
(let ((item (car (if (eq arg 1) 'recenter 'forward)))
item)
(setq last-nonmenu-event-command-event (if (eq arg 1) 'quit 'exit-minibuffer
======== SAMPLE 39 ========
buffers-mode."
(setq window-minibuffer-window-height (- (window-minibuffer-width window)
2)))
(defun smerge-resolve ()
"Resolve the conflict."
(interactive)
(or smerge-resolve
(error "Nothing to resolve"))
(smerge-resolve)
(if (boundp 'smerge-buffer-name) smerge-buffer-name
(set-buffer-major-mode smerge-buffer-name)))
(defun smerge-apply-resolution-buffer ()
"Return the current buffer for resolution."
(with-current-buffer smerge-buffer
(goto-char (point-max))
(error "Cannot resolve changes from previous buffer"))))
;; This takes care of the normal handling of
(defun smerge-merge-buffer ()
"Return the current buffer for merge of buffers.
The buffer name is whatever Emacs might choose to recognize -
if it is a directory, e.g. with %a directory and that Emacs would want
to merge that directory, then merge that file. If the last
buffer is a directory, it's ok to use the directory to represent the file
in the buffer name; if it's a buffer associated with a process, it's ok
to use the buffer name associated with the process."
(let ((case-fold-search
'string-match-p (concat "^" (regexp-quote (buffer-file-name))))))
(or
(error "Cannot merge - *Smerge* (error (buffer name)"))
;; Don't check all systems that use a special buffer name *so*
;; that we don't fail the merge.
(buffer-name (buffer-name))
;; We use a buffer name because that is the preferred default for
;; merging because it is the best match for the process name.
;; Otherwise, we look for a process buffer first.
buffer-name)))
(defun smerge-revert-buf (name &optional files)
"Recompute the current buffer name change of NAME (a string).
Normally that means the name of the current buffer. But if FILES,
if non-nil, is non-nil, we also try to revert FILES, and if they are
nil, it is to remove from the list of buffers of the specified buffers."
(interactive
(let ((name (and (buffer-file-name)
(buffer-name)
(or files default-directory)))
(alist file-alist)
(buf-name (or name smerge-revert-buffer-name))
;; Return the changed buffer name based on the buffer name.
(name (buffer-name))
;; Return a list of them:
;;
;; * NAME = (\"[^[:alnum:]]+\" \"[^[:alnum:]]+\" \"+\" \"-\" \"[-+]\" \")
;;
(buf (if (buffer-modified-p)
(buffer-name) buffer))
'nil))
;; The function `buf-name' returns the name of the buffer if it wasn't
;; changed, nil otherwise.
(if (string= (buffer-name) "*Smerge*")
(list buf)
'buffer)
;; Otherwise,
======== SAMPLE 40 ========
buffers for other things,
;; (see below). If you define or customize an attribute whose value is
;; a string, Emacs will then choose a character from that string to
;; encode into the character. If the element itself is not a string then
;; that character will also be processed in-place.
;; A few functions to turn the `word' feature on are `encode-char' and
;; `encode-char-with-special-character'.
;;
;; For the character which has a set, call `encode-char-mode' to enable
;; converting it to a symbol.
;;; Code:
(defcustom word-fontify-buffer-function #'word-fontify-buffer
"Function to fontify a buffer.
This should be a function to be called with the buffer name as argument.
The value is non-nil if this font-lock function finds the symbol
of the character and looks for the value that describes that symbol.
This function looks in the string buffer `buffer-name'.
The value is nil if this font-lock function should find a suitable
symbol for the buffer `buffer-name'.
This function is a non-bound variable, it can also accept arguments of a
different value."
:type `(choice
,(lambda (variable value)
(or (memq (setq value (read-variable (car default-value)
nil nil))
default-value t))
(list (if (memq variable '(read-variable read-eval-form))
(intern
(concat (nth 0 value) "/"
(string-match regexp value))))))
:value-create 'word-fontify-buffer
:set (lambda (symbol value)
(prog1
(setq buffer-name buffer-name)
(goto-char (point-min))
(search-forward "\n\n" nil t)
(buffer-substring
(point-min) (1+ (point-max)))))))
(define-obsolete-variable-alias
'word-fontify-buffer-symbol
'word-fontify-buffer "23.1")
(defun message-add-or-remove-help-at-point (&optional message)
"Return the help on MAILING the character at point.
Optional second argument MSG, if nonzero, is just toggled and if it is non-zero, it
is not displayed.
Return nil if that help was not shown.
Returns 0 if any help was not displayed, 1 nil if the help
appears at the end of the buffer (if the buffer is narrowed by one of
those help windows), or 2 t (if the current buffer is in a help buffer)
to return text to return as a string."
(save-excursion
(if message
(goto-char (min (point-max) (point-max)))
(let ((buffer (mail-header-buffer)))
(set-buffer buffer)
(while (and (not (null (buffer-modified-p))))
(set-buffer-modified-p nil))
(goto-char (point-max))))
(if message-no-help
(setq message
(buffer-
======== SAMPLE 41 ========
buffers
(insert "(setq calc-graph-info-undefined-handles t))")))
(when (consp (car math-simplify-info))
(condition-case nil
(setq calc-graph-info-undefined-handles
(cons (cons (car math-simplify-info)
calc-graph-info-undefined-handles))
math-simplify-info)))
(while (and math-simplify-info
(setq calc-graph-fancy-variable-table
(memq (car math-simplify-info)
(list (cons (car math-simplify-info)
(car-safe (cadr (cadr math-simplify-info)))))
calc-graph-fancy-variable-table))
(if (and calc-graph-fancy-overlays
(stringp (car math-simplify-info)))
(setq calc-graph-fancy-variable-table
(cons calc-graph-fancy-overlays
(cons (car math-simplify-info)
calc-graph-fancy-variable-table)))
(if calc-graph-fancy-overlays
(setcdr calc-graph-fancy-overlays
(reverse (cdr math-simplify-info)))))
;; Set out each entry to the variable table in order to
;; use as a constant after calc-graph-fancy-variable-table is
(let ((var-var calc-graph-fancy-variable-table)
accum accum-vec)
;; Save everything in calc-graph-fancy-variable-table to an accumulator or
;; a vector.
(while var-var
(setq accum-vec
(if (math-negp (car accum-vec))
======== SAMPLE 42 ========
buffers
(define-key map [?\S-\ ] 'ebrowse-electric-prefix-mode)
(define-key map [?\C-\s ?\F] 'ebrowse-electric-prefix-mode)
(define-key map "\C-\x7" 'ebrowse-electric-prefix-mode)
(define-key map "\C-\xB" 'ebrowse-electric-prefix-mode)
(define-key map "\C-\x\^(?\em>" nil t)
(define-key map "\C-\x\^(?\e>" nil t))
(define-key map "\C-\xe[r\C-d\f`]*" 'ebrowse-electric-prefix-mode)
map)
"Keymap for EBrowse mode.")
(defvar erc-ebrowse-font-lock-keywords
(eval-when-compile
(list
"^[\u04a-\u04b+\u058-\u059]*\\([-+]?[0-9]+\\):"
'("\\(\\w\\|\\s_\\)+char\\|\u0021\\):\\(.*\\)" . tabulated-list-key)
"[[:upper:]]+\\(\\(?:\\\\?\\|\\sw\\)+\\)\\s-*$"
["?\\(0-9\\|\\s(:\\sw\\|\\s_\\)+:\\):" . erc-list))
["0-9\\.\\.\\.\\.$?\\(\".*\\|[\u0-9\\.]*\\|\\s-*:\\s-*\\)$"
erc-list 1 font-lock-string-face)
"\\(^[\u04a-\u04b+\u058-\u059 ]*\\(/[^\u0-9a-z]+:\\),\\([-+]?[0-9]+\\)\\s-*$")))
(erc-set-font-lock-defaults
(list
"\\(\\(\\sw\\|\\s_\\)+\\(?:-\\)?\\(?:-\\)?\\(?:-\\)?\\)?\\(?:-\\)?\\s-*\\(\\([0-9]+\\)\\)?: [^\u0-9a-z]*)" t)
;; The following is not required, but makes a lot prettier
;; to show that some keycaps are not bound:
"^[-+]?[0-9]+\\(?:-\\)?(?:-\\)?[0-9]+?"
;; The corresponding regexp is not needed, because it is too hard to
;; find the pattern again in this file:
(eval-when-compile
(list
"^[^\u04a-\u04b+\u053][[[:upper]\\.\\w:]"
'(".*\\):\\([1-9]+\\)\\(\\$[0-9]\\{4\\}-[0-9]+\\)?"))
;; See "\\([0-9]+\\) [0-9]+@" for more.
("\\1-[\u0-9a-z0-9][0-9a-z0-3][0-9a-z0-5]\\([1-9]\\)"
1 font-lock-string-face)
;; The font-lock is used if the pattern matches a sequence of regexps (for
;; example, "[1-9].*[1-9]").
("\\1-[\u04b-\u04b+\u059]\\([1-9]\\|1-([0-9]+@%*\\)\\):"
1 font-lock-string-face)
"\\1
======== SAMPLE 43 ========
buffers:
;;
(defcustom tramp-shell-mode-line '(1)
"How many lines are displayed (line mode)."
:type '(choice (const :tag "0" 1)
(integer :tag "1")))
;;(setq system-type (if (stringp locale-type)
;; (intern-soft (symbol-name locale-type)))
;; 'unknown))
(defcustom tramp-shell-print-buffer-function nil
"Function to use for printing temporary files."
:type '(choice (const nil) (function
(lambda (file)
(with-current-buffer
(tramp-p v) (tramp-get-connection-buffer v))
(display-buffer-in-preview 'full file)))
(choice :format "%v"
(const nil) (integer :tag "1")))
:version "23.1" ;; No Gnus
:group 'tramp)
(make-obsolete-variable 'tramp-shell-print-buffer-function
'tramp-shell-print-buffer-string "25.1")
(defcustom tramp-shell-kill-buffer nil
"Shell buffer to be killed at end of process.
If nil, the buffer will be set to the end of the process buffer."
:type '(choice (const :tag "never" nil)
(function :tag "other"))
:group 'tramp)
(defcustom tramp-shell-kill-process-buffer nil
"Shell buffer to be killed at end of process.
If nil, the buffer will be removed from the kill ring."
:type '(choice (const :tag "never" nil)
(function :tag "other"))
:group 'tramp)
(defcustom tramp-shell-kill-process-buffer (pop-to-buffer-same-window buffer-or-state-C killhash)
"Shell buffer to be killed at end of process.
If nil, the buffer will be killed the same `kill-ring-kill' command executed
before this buffer was created, which is executed with the buffer in
kill buffer (or the `kill-ring').
This command runs in `kill-ring' after the buffer started running
and after `process-mark', and after killing the buffer killed
before this command was invoked."
:type '(choice (const :tag "never" nil)
(function :tag "other"))
:group 'tramp)
(defcustom tramp-shell-kill-shell nil
"A shell buffer to be killed upon exiting the shell.
This buffer will be set to the end of the process buffer,
and the command `kill-ring-kill' is invoked before this buffer was
created, which is executed with the buffer in kill buffer (or the
`kill-ring'), and after killing the buffer killed upon
`exit'."
:version "23.1" ;; No Gnus
:type '(choice (const :tag "unlimited" nil)
(const :tag "run long" (string))
(const :tag "while" (boolean)))
:group 'tramp)
;;; User Functions:
;; =========================================================================
(defsubst tramp-accept
======== SAMPLE 44 ========
buffers, or maybe you have some code that can use some of this functionality
;; if you have it. In that case, use `org-table--markup-header' instead!
(org-table--overlay-buffer (org-table-cell-span-begin)
'face 'org-table-cell-markup-header org-table-span-end))
(defun org-table--add-span-beginning-beginning ()
"Add the span beginning beginning when point is at the beginning of a cell.
A cell ends when one of the span markers is reached near end. When point is at the
beginning of a cell it adds the span end prefix to the line in the center."
(interactive)
(unless (bolp)
(error "Not in another table"))
(unless (bobp)
(error "Not in a cell"))
(insert-char -6 char)
(move-beginning-of-line)
(unless (org-at-item-end-p)
(insert "(")
(org-move-marker (org-table-item-begin) (- (point) 6))
(org-table-insert-row)))
(when (eq last-command 'org-table-edit)
(let ((inhibit-read-only t))
(org-table-edit-item-end)))
(when (eq last-command 'org-table-edit-begin)
(org-table-edit-item-end)))
(defun org-table-cell-span-end (&optional col)
"Cell span marker.
When COL is nil, use the span starting from point."
(let* ((span (org-table-span))
(range (org-table-get-range 'span col))
(width (org-table-get-span-width col)))
(when (< span width)
(let ((column (if (and (/= width 0) (> col width))
(1+ (- col)))
(1- column)))
(cond ((memq span '(1+ (- (count-char-range (min (- width column)
(+ 0.3 width)))
(orgstring-nw-p orgtbl-width-regexp))
1)
(org-table-convert-string-for-truncation span col col-type))
(insert-char (min (- width column) range))
(insert span)
(setq span (orgp-point-char ?\s (- width column)))
;; (org-table-convert-string-for-truncation span 1 column columns)
(setq span (org-table-convert-string-for-truncation span col col-type))
(insert (substring span (min column max length) -1))
(insert (substring span (max column max length)))))
(delete-char 1))))
(defun org-table-cell-span-prefix (&optional name type noerror)
"Return a prefix for
======== SAMPLE 45 ========
buffers in a buffer whose
major mode is Emacs 19."
(with-current-buffer buf
(setq-local mode-line-buffer-identification
(make-string (buffer-size)
?*))
;; If buffer is large, we need to use extra padding.
(when (numberp mode-line-buffer-identification)
(buffer-setup-internal
"Buffer" size
;; The "SIZE" variable tells us whether the buffer is
;; larger than the number of elements (i.e., the size of the
;; "BEG" or "END" lines).
(min (+ width (current-column))) size) "\f")))
(byte-compile-log-edit "Buffer %s to buffer" major-mode)
;; The variables byte-compile-current-handles (not used by
;; byte-compile-log-edit) define the local variable of the same mode.
(when byte-compile-current-handles
(setq byte-compile-current-handles
(bindat-get-const c-symbol-types
'byte-compile-symbol-types--set-symbol-values-from-types-table)))
(defvar byte-compile-last-symbol-symbol nil
"Whether last symbol was typed.")
(defvar byte-compile-symbol-symbol nil
"Whether last symbol was typed.")
(defvar byte-compile-symbol-type nil
"If non-nil then type of symbol is typed.")
(defun byte-compile-symbol-symbol (symbols)
"Return symbol name of symbol SYMBOL.
If there is not a symbol, return nil."
(not (and symbols (symbolp symbols)
(fboundp symbols) (symbolp (car symbols))))
(defun byte-compile-get-symbol-type-function (&optional symbols)
"Return the function to insert symbol SYMBOL into the buffer.
SYMBOL is a symbol. The function should know one of the symbols
to insert.
If SYMBOL and the current buffer are in the same buffer, this
function will return the symbol. If SYMBOL is nil, then the
symbol-info of the current buffer will be returned."
(and (boundp symbols) (symbolp symbols)
(with-current-buffer (symbol-value symbols)
(get symbol (symbol-value symbols))))
(byte-compile-log-edit "Symbol types: %s"
major-mode)
(defvar byte-compile-last-symbol-symbol-fun (or flags
(and (car flags)
(stringp flags)
(symbolp flags)))
"Function function of the symbol type symbol called by the last
symbol called and is not set to nil.
The last symbol called may have changed the variable that was
used in the previous call to this function. If a symbol type
is not set to the symbol type then the old variable symbol and the
new symbol type symbols are set. This function is used to set the
old and the new symbols as the first thing that will be called in
the second call
======== SAMPLE 46 ========
buffers in this buffer do not get input."
(condition-case error-buffer-name
(pop-to-buffer (marker-buffer orig-buffer))
(error (pop-to-buffer orig-buffer))))
(defun dired-revert-buffer (buf &optional event)
"Hook function to be called in case `dired-do-dir-remaining' did not go away."
;; Use (dired-do-dir-remaining ...), which dired-do-dir-remaining does.
(or buf (setq buf (window-buffer (selected-window)))
(error "File did not go away")))
;;;---------------------------------------------------------------------
;;; Mode specific commands
;;
;;;---------------------------------------------------------------------
(defun dired-mode-line (file dir-modifier)
"Display mode line in other window, display the file(s) in the first line.
Files and buffers in `dired-mode-map' are displayed.
The mode line is shown in the buffer specified by the input and
output file buffers, if any. Otherwise, it is not shown. (You can also
use the Dired tool bar and the mouse to move the mode line through
the commands on this map."
;; It's used by dired-switch-buffer-visualizations in dired-mode-popup.
(interactive "fFile: ")
(cond
;; A buffer is shown in the first line, but we can't switch to it.
((dired-mode-line file dir-modifier))
;; A buffer is shown but it is not in the mode line.
(t
(let ((buf-buf (dired-get-filename file nil t)))
(with-current-buffer buf-buf
(dired-toggle-buffer t)))))
(defun dired-switch-to-buffer ()
"Switch to the Dired buffer in buffer `dired-mode-map'. See also `dired-mode-line'."
(interactive)
;; Return nil?
(dired-toggle-buffer))
(defun dired-show-dirs-only ()
"Show all dired files in current directory."
(interactive)
(save-restriction
(widen)
(dired-do-dir-remaining
(dired-do-dir-remaining (dired-current-directory)
(read-directory-name "Directory Dired: "
(file-name-as-directory file))
(dired-current-directory) nil 'dired-mode-line)))
(defun dired-display-dirs-buffer ()
"Display the dired buffer in buffer `dired-mode-map' in dired-mode buffer.
See only dired."
(interactive)
(read-from-minibuffer
"Dired buffer: "
(completing-read "Dired buffer: "
(append dired-dir (dired-current-directory) nil 'dired-dir-remaining))))
;;;---------------------------------------------------------------------
;;; Display directory buffer
;;
(defun dired-display-this-buffer ()
"Dired buffer display in other window."
(interactive)
(when (buffer-modified-p)
(set-buffer dired-current-directory))
(when (use-dired-p)
(let ((buffer-read-only nil))
(when (> (dired-current-directory) (dired-buffer-name))
(dired-make-dir-buffer))
(dired-insert-directory-separator)))
(switch-to-buffer buffer-name)
(display-buffer buffer nil
======== SAMPLE 47 ========
buffers and other stuff is.
(defun verilog-auto-load-function ()
"Make auto-load function of function definition."
(interactive)
(verilog-mode 1)
(add-hook 'after-change-functions
'verilog-auto-load-hook nil t))
(defun verilog-auto-load-function ()
"Make auto-load function of function definition."
(interactive)
(verilog-mode 1)
(define-key function-key-map "\C-m" 'verilog-auto-load-other-module))
(defun verilog-auto-load-header ()
"Make auto-load header of function definition."
(interactive)
(let ((header (save-buffer-state
(make-hash-table :test 'equal)
(make-hash-table :size 2)))
(header (list "Major mode keywords"
(verilog-symbol-keyword-or-method-p header)
))))
(set-buffer-modified-p t)
(goto-char (point-min))
(let ((header (verilog-auto-load-header)))
(if (buffer-string-equal header '("") header)
header (verilog-auto-load-headers header)))
(set-buffer-modified-p t))))
(defun verilog-auto-load-declaration (&optional arg-values)
"Make a list of arguments for a Verilog-declaration,
with variable DEFAULT_ATTRIBUTES. The first VALUE that appears
in the list is the default value. If ARG-VALUES is t, the current
value is used.
If `verilog-auto-save-interactive' is non-nil, save the *Global* buffer
in `auto-save-file-name-for-unload-hook'. If ARG is a hash,
the hash has the same form as in `verilog-mode-hashmap'."
(interactive "P")
(set (make-local-variable 'verilog-auto-save-file-name-for-unload-hook)
(if (eq major-mode 'verilog-mode) 'auto-save-file-name-in-unload-hook))
(if arg-values
;; Make current VALUE be saved instead of running `auto-save-file-name-for-unload'.
(progn
(setq auto-save-file-name-for-unload-hook nil)
(auto-save-file-name-for-mod-hook))))
(defun verilog-auto-load-eval (arg)
"Make use of `eval', instead of `verilog-eval-region'.
When `eval' fails, return nil instead of returning nil. See also
`eval-interactive'."
(interactive "P")
(when (or executing-kbd-macro last-command-event)
(unless verilog-auto-save-interactive
(emerge-mode 1))
(let ((inhibit-read-only t)
(beg (point)))
(save-buffer
(verilog-do-auto-save arg beg (current-buffer))))
(if verilog-auto-load-interactive
(progn
(save-window-excursion
(verilog-end-of-argument)
======== SAMPLE 48 ========
buffers
,(get-buffer-create "*Parsing Buffer*"))
(defun pascal-parse-buffer ()
"Parse buffer and parse it.
Argument (buffer contents).
Returns a list of buffer contents."
(list nil))
(defun pascal-beginning-of-defun (&optional n)
"Move point N up until the next start of a \\[defun].
This stops at a \\[defun] that is inside a paren. If there is some
subexpression inside a \\[defun] then
`n' will jump to the beginning of it without moving point.
If N is 0 then \\[defun] will start without any preceding \\[defun].
See `pascal-end-of-defun' for detailed information on this command."
(interactive)
(let ((beginning-pt (point)))
(or (equal n (point))
(set-mark (1- (point)))
(point-max)))))
(defun pascal-beginning-of-defun (&optional n)
"Move point N up until the next start of a \\[defun].
This stops at a \\[defun] that is inside a paren, or at the start of
a \\[defun].
If N is 0 then \\[defun] won't start."
(defun pascal-end-of-defun (&optional n)
"Move point N up until the next end of a \\[defun].
If N is 0 then \\[defun] will stop at a \\[end]
pascal
\\[\\[\\]\\(\\(\\sw\\|\\s_\\)+\\)]"
(interactive "^P")
(let ((end-pt (point))
(beg-pt (1- (point)))
;; Move point backwards in time.
(beg-pt (if (looking-at pascal-declaration-end)
(1- (point))
(if pascal-end-of-defun
(progn (end-of-line) end-pt)
(point)))))
(unless (eq n 0)
(pascal-point))
(unless (string= "{" (buffer-name))
(setq pascal-last-statement-end nil)
(setq pascal-last-statement-end
(buffer-substring-no-properties
(point) (match-end 0))))
;; Move point back to the beginning of the last defun.
(while (not (string-equal (buffer-substring-no-properties
(1- (point)) (if (nth i n) 0 1)) (1- (point))))
(if (< (point) end-pt)
(progn
(forward-char - 1)
(end-of-line)
(looking-at "\n")))))
(or (< n 0)
(progn
(backward-char (if (equal (nth n n) "\\") (1- n) ?\s)))
;; Move point in the same direction as the previous point.
(if (< n (- (nth n n)))
(forward-char (- n))))
(catch 'exit
;; Look for any open spaces we might find during
======== SAMPLE 49 ========
buffers (which are not included here),
you might want to do away with this (with a few minor changes)
function to just return the value from Cursor->Read function."
(let ((fn (cl--generic-function-fn 'read)))
(if (and fn (stringp (car fn)))
(setcar fn :read)
;; Find the function definition (first arg to call, if non-nil).
;; Otherwise, call the function via its return value.
(condition-case err
(cond ((not value) :value)
((not t) :help-function) :text)
))
;;(message "Cursor->Read: `%S'" fn)
))
(defun cl--check-function-defcustom ()
"Check variables which may be used (not yet defined).
The variable `cl-check-function' is called to check whether a variable is defined in
the function spec, but may not be defined in the current CL session.
If the function is defined, the `cl' key is used to invoke it."
(cl--check-function-defcustom-list
(let ((cl-check-function `(:type ,(symbol-function
(lambda ,(symbol-function
(lambda ,name t)))))))
(check-var ,(symbol-function
(lambda (variable)
(list :variable (if (cl-constp ,var)
`(:constructor-constructor
',var))
(if (cl-constp
(list cl-default-formatter
,variable))
(if (cl-listp ,variable)
(list var))
(if cl-var
(if cl-var
======== SAMPLE 50 ========
buffers" (ibuffer-show-buffer "--"))
(goto-char (point-max))))
(defvar ibuffer-filter-buffer-with-ancestor nil
"What filter buffer to filter by Ancestor-history (not really needed).")
(ibuffer-set-filter-buffer-default buffer ibuffer-filter-buffer-with-ancestor)
(defvar ibuffer-filter-buffer-with-ancestor-filter-function nil
"Function used to filter by Ancestor-history (not really needed).")
(defvar ibuffer-filtering-char-table nil
"Ancestor filter char table.
It must set a regular table in the Ibuffer buffer instead of using
`ibuffer-filter-buffer-with-ancestor-filter-function'.")
(ibuffer-set-filtering-char-table-default ibuffer-filter-buffer-with-ancestor-filter-function)
(defvar ibuffer-filter-char ""
"Char used to indicate a filtering char to use.")
;;
;; Filters used by `ibuffer-show-buffer'
;; We use :filter to display the list of filter buffer names.
;;
;; The `ibuffer-filter-buffer-with-ancestor' is used because it works like
;; :filter-buffer-with-ancestor
;; : it returns the name of the buffer (from the filter filter) to use in
;; that buffer. It also uses :filter-buffer-get-default for the value
;; of :find-file used by the current buffer's `:filter' function.
;; A filtering buffer is one that has a history of matches for one
;; of the filters. You can find the history of a filter (or a filter-buffer
;; like :filter-buffer-history) using the `ibuffer-filter-buffer' variable.
(defvar ibuffer-filter-buffer-history
;; This is the one used to filter by Ancestor-history.
;; First it is used to get :filter-buffer-used.
(let ((filter-buf (current-buffer)))
(unless filter-buf (ibuffer-with-buffer ibuffer-filter-buffer-with-ancestor))
(setq filter-buf (get (current-buffer) filter-buf))
(unless (equal (buffer-name filtered-buf) (ibuffer-filter-buffer-name filter-buf)))
(with-current-buffer filter-buf
(funcall (get (current-buffer) filter-buf)
:filter-buffer-get-default)
(setq filtered-buf (get (current-buffer) filter-buf)))
(if filter-buf
(setq filter-buf filter-buf))
(put ibuffer-filter-buffer-history 'filters filtered-buf)
;; Don't put :filter-buffer-history in ibuffer-last-completed-filter-buffer
buffer-name)
;; Add this to the functions buffer-name and ibuffer-filter-buffer-history
(setq ibuffer-filter-buffer-history (append filtered-buf filters-buf))))
;;;
;;; Define function
;;
(defun ibuffer-filter-buffer-set (buffer buf-name buffer-buffer buf-name)
(with-current-buffer buffer
(apply 'put-buffer buf-name)
(setq buffer-buffer buffer-name)))
;; The function `ibuffer-set-filter-buffer-default'.
;;
(defun ibuffer-set-filter-buffer-default (ibuffer name buffer-name)
(prog1 (buffer-name buffer-buffer)
(if name
(if buffer-name
(error "No more buffers"))
(setq buffer-name (ibuffer-default-filename)))
(setq buffer (ibuffer-buffer-name (ibuffer-current-buffer)))))
;; The function `ibuffer-get-buffer-at-point'.
(defun ibuffer-goto-buffer (buffer-or-name &optional
======== SAMPLE 51 ========
buffers.
;;; Bugs
;;; Code:
(defvaralias 'lisp-compile-error 'lisp-error)
(defvar lisp-compile-print nil
"This is the error form when calling Lisp.
This is the output form of a Lisp program, a Lisp expression.
The print forms in this list will be replaced by Lisp forms when
the caller calls Lisp when it is not running in the buffer.
To be recognized as such an input form, a Lisp expression must come
from a source code source line containing a byte-code
element \(the expression symbol being the Lisp expression symbol) for
the string \(e.g. \"var = \" in string \" to be printed in the
output buffer \(the code symbol to be printed in the window in the
output buffer \(the buffer to be restored to when the process
is started by the Lisp process).
You can suppress this list of symbols at Emacs initialization or
defer initialization if a Lisp expression is not yet defined.
The function `read-eval' will then take `lisp' as an input argument,
and try to make sure it always returns a Lisp expression to be printed in the
output buffer.")
(defvar lisp-compile-error-print-history nil
"History file used when `lisp-compile-error' runs.
This is a list of symbols and functions to call to avoid reordering of buffers.")
(make-obsolete-variable 'lisp-compile-error-print-history
"use `read-eval' instead.")
(defmacro lisp-compile-find-file (keyword str &optional dir errorbuf temp-dir)
"Find the function called by the Lisp program to process a string in temp-dir.
See `lisp-compile-get-error' and `lisp-compile-print' for their documentation.")
(defmacro lisp-compile-print (file)
(let ((print-escape-newlines t)
(print-escape-counting t))
(set-print-coding-system #'eww-coding-system)
(setq print-escape-newlines nil)
(setq print-escape-counting t))
(if (stringp fn)
(setq fn (eval fn)))
(while
(lisp-xfer--check-macro-with-function fn)
(or errorbuf
(setq temp-dir (expand-file-name
"lisp-xfer-" fn lisp-compile-error-print-history))
(setq errorbuf (get-buffer-create "*debug-log-log*")))
(setq temp-dir (expand-file-name fn temp-dir))
(let* (;; (compiler-name
(or dir
(read-file-name
(format "Lisp mode %s: %s"
(file-name-nondirectory
(file-name-nondirectory
(expand-file-name
(file-name-nondirectory fn)
:file "\\`")
:execname "ls"
======== SAMPLE 52 ========
buffers nil
(progn
(goto-char (setq buf-pos (line-beginning-position)))
(insert "\n")))
(insert "\n")) t)
((looking-at "\\<end\\>")
(if (buffer-name buf-pos) (match-string 1))
(goto-char (point-max))
(error "Cannot find end of buffer")
(set-marker (make-marker) buf-pos))))
(goto-char cur-buf)
(set-marker (make-marker) cur-buf nil)))))
(defun elisp--buffer-read-write (beg end &optional buf-name-file)
"Like `read-with-current-buffer' except with BUF-NAME-FILE instead."
(set-marker beg t)
;; If buffer needs write-file-insert is nil, just don't insert it.
(goto-char beg)
(let ((string-to-encode "\t "))
(insert-file-contents
string-to-encode nil buf-name-file
(let ((buf-name-coding-system (if buffer-file-coding-system
buffer-file-coding-system
(process-coding-system process))))
;; (`read-from-minibuffer' is probably ok, but it isn't documented)
(set-marker beg t)
(buffer-string)))))
;; The following hack only works if a process has a non-nil
;; property (the buffer or file being requested). We don't use this in this
;; hack, but would like to say that the code should only accept text from a process
;; which is a buffer and not a file that has either a coding system `read', a
;; buffer or some other buffer.
(defun elisp--buffer-read (beg end &optional buf-name-coding-system)
"Like `read-buffer' except with BUF-NAME-CODING-SYSTEM.
The buffer-coding-system is a cons cell, (PRED . VALUE) for the
buffer, which conses to VALUE (or nil if BUF-NAME-CODING-SYSTEM
is set). The buffer should be read before calling this function,
and should be the first process in the list that has one.
If BUF-NAME-CODING-SYSTEM is set, that is used to read PRED and value
before reading VALUE. Otherwise, the value is used.
BUF-NAME-CODING-SYSTEM is of the form `buffer-file-coding-system'.
Value is t if BUF-NAME-CODING-SYSTEM is nil;
nil otherwise, nil otherwise, and value nil otherwise."
(let ((process-connection-type (process-status proc)))
(and process-connection-type
(or buf-name-coding-system
(string-match "\\([a-zA-Z0-9
======== SAMPLE 53 ========
buffers
(set-window-buffer (display-buffer eshell-last-args-buffer) (display-buffer eshell-last-args-buffer))))
;; If we are in a buffer, clear, and display it, and get all the args
;; back.
(if (and window-system (boundp 'EShell-get-output-buffer-function))
(if (stringp x)
(set-window-system w32-output-buffer-function)
(with-current-buffer (get-buffer eshell-last-args-buffer)
(set-window-buffer (display-buffer eshell-last-args-buffer t)))
(set-window-start (minibuffer-window) 0 (point-min))
(set-window-point (minibuffer-window) 0 (point-max))
(eshell-display-output nil)
(eshell-show-output nil))
(message "EVERYTHING is gone!"))))
(put 'eshell-switch 'risky-local-variable t)
(defun eshell-switch-output ()
"Switch to a shell buffer."
(interactive)
(or eshell-default-output-buffer
(with-current-buffer eshell-output-buffer
(set-window-buffer current-window-buffer)
(switch-to-buffer eshell-default-output-buffer))))
(defun eshell-process-args ()
"Return a list of shell command arguments when processing a buffer.
In order for a shell command to be given in a command argument list, it
must also be available by the process buffer. You may pass in a command
argument list in your own code to process `eshell-process-list', to
process a command in another buffer, or to a process buffer in
another frame."
(let* ((processes (list "ESHELL")
(processes-list nil))
(processes-1 (catch 'exit
(pop processes)
(eshell-mark-processes processes)))))
;;;###autoload
(defun eshell-process-mark-backward ()
"Process markers to mark a string backward from point.
Move point to one or more of those markers and move backward one character."
(interactive)
(set-marker eshell-last-input-marker (1- (point))))
;;;###autoload
(defun eshell-process-mark-forward ()
"Process markers to mark forward a string from point.
Move point to one or more of those markers and move forward one character.
A typical usage is to mark a statement in a buffer and then return it.
The command `eshell-mark-forward' is the general command. It operates on
each buffer in a series of loops which see whether the buffer with point
after point is in a list or string. Thus, for example, the buffer
\(\\[dired-search] \\[dired-forward-re] \\[dired-mark-file] \\[dired-backward-re]
\\[dired-is-linked] [\\[dired-mark-file] RET] )\) is in
a list and its buffer is marked (this variable has effect in both
the buffer and the buffer with point at its EOF):
* With the buffer marked, move to the beginning of the next \(...)
marked buffer (in another window, use the same window for the point)
from which the next line was taken and the buffer marked.
When a Lisp function does not care about this variable, it is
passed a signal ARGS. The signal is ignored and returns the next (...)
message.
The output buffer displayed by the Lisp function is made visible
for the user
======== SAMPLE 54 ========
buffers that are being used by `org-link-get-file-prolog' to return
text matching some of the buffers."
(let ((proc (get-buffer-process (car buffer-posp-info) t)))
(org-with-remote-undo
proc
(kill-buffer proc)))
(defun org-inlinetask-add-files-and-buffers (pos-name pos)
"Create a special buffer where we keep a list of all files in POS-NAME.
POS-NAME must be in Org mode if this is a member of `org-entry-files'."
(set-buffer (get-buffer-create pos-name))
;; FIXME: Use org-info-headings for the info structure itself, and use the *type*
;; property instead instead of the `:tree' property.
(plist-get org-entry-info :tree)
(let ((entry-alist (org-entry-file-plist
(plist-get entry-info :tree))))
(unless (member entry-alist entry-alist)
(message "New entry alist created"))
;; Remove duplicates.
(setq entry-alist (delete entry-alist entry-alist))
(dolist (file (org-entry-files-and-buffers))
(dolist (entry (funcall entry-alist file))
;; Remove duplicates and remove the new entry.
(delete-dups (org-entry-files-and-buffers
entry (append (org-entry-files-and-buffers)
(copy-sequence (org-entry-files-and-buffers)))))))
;; (dolist (entry-alts (org-entry-files-and-buffers))
;; (let ((entry-alts-n (plist-get entry-alts :type)))
;; (and entry-alts-n (let ((entry (pop entry-alist)))
;; (and entry entry)
;; (progn
;; (push entry entry-alist)
;; (dolist (entry-alist entry-alist)
;; (let ((entry (org-entry-get-entry
entry-alist (plist-delete entry-alist
:group)))
(when (member entry-alist entry-alist)
(push entry entry-alts-n))))
(cl-incf file-name))
entry-alist)))
;; Add this line if no one has moved yet, because of the fact
;; that the entry has got some sort of 'archive' property
;; and we need to update it
(unless entry
(insert (org-entry-get-member (car entry) "archive") :type "archive"))
;;
======== SAMPLE 55 ========
buffers "".
(goto-char (point-min))
(gnus-summary-set-mode-line)
(while (re-search-forward
(concat "\\(?1:[ \t]+\\):" gnus-subtree-header
"\\([ \t]+\\):\\([0-9]\\{2,3\\}\\)"
regexp t)
nil t)
(match-string 1)))))
(defun gnus-summary-make-heading-hook (string start end)
;; FIXME: Why not return the start of the article in the header?
;; The problem that the header has no header field.
;; It should go somewhere in the header. There is no position to hide it in.
;; But we don't want to add the header.
nil)
(defun gnus-summary-mark-article-subject-hook (prefix start end regexp regexp)
"Makes the Subject-Body-Algorithm section of the article visible."
(or gnus-use-mark-article
(setq gnus-use-mark-article
(replace-regexp-in-string
"Subject-Body-Algorithm" ":" gnus-summary-mark-article-header))))
(defun gnus-summary-goto-article (name)
;; Return the heading of the article. If the article is NOT HERE,
;; return nil.
(gnus-summary-goto-line name t))
(defun gnus-summary-goto-article-from-mark (&optional num)
;; When there is no article in the article buffer, it follows the message.
(gnus-summary-goto-line num gnus-killed-articles))
(defun gnus-summary-goto-article (&optional num pt arg)
(with-current-buffer gnus-original-article-buffer
(if (eobp) (progn (beginning-of-line) (point)) (point-max))))
(defun gnus-summary-goto-article-backward (&optional n)
;; Get the point in the article and go to the article in the buffer.
;; NB: this runs gnus-summary-mark-article as well, but even if no
;; article is found, go back to the current page and look for the
;; current article. If no article is found before the point, return N.
;; (with-current-buffer gnus-original-article-buffer
(if (numberp n) 1 0)))
(defun gnus-summary-goto-article-beginning (&optional num)
;; Find the beginning of the article and go to the article. If N is a positive
;; number, go backward that number (if Gnus isn't reading it). If omitted (or
;; if the current article is not displayed in the article buffer), go
;; forward. This is done by looking for the header
;; of the specified article and then using the marker found in article list
;; beginning.
(save-match-data
(cond
((equal num 0) (forward-page)) ;Go forward page by N.
((and prefix (not gnus-use-mark-article)) (forward-page)) ;Go forward page by N.
(t (point-marker))))
(defun gnus-summary-goto-subject (&optional num)
"Go to the Subject in the article.
With prefix ARG, look for the beginning of the subject or to the
first character of message number. If NUM is zero, go forward this many lines."
(save-match-data
(cond
((numberp num) (forward-page)) ;Go up page by N if found,
======== SAMPLE 56 ========
buffers.
(if (and (buffer-file-name)
(not (eq major-mode 'buffer-file-mode))
(not (string-match (car (copy-file-contents buffer-file-name))
directory))))
(let ((directory (file-name-directory todo-default-directory)))
(if directory
;; Only file contents that are local.
(unless (file-directory-p directory)
;; Expand directory and update list.
(setq todo-directory-files
(cons directory (current-buffer)))
(setq todo-directory-files nil))
(setq todo-files
(if todo-update-files
(or directory
(and (car (cdr (assoc directory
todo-files-directory-alist)))
(car (cdr (cdr todo-files-alist)))))
(not (assoc directory todo-files-directory-alist)))
(error "To Do")))
(setq todo-files-alist
(cons (nreverse todo-files-alist) todo-files-alist)))
;; List directory. Merge it, plus the current list.
(progn
(setq todo-directory-list
(nreverse
(list buffer-file-name
(file-name-nondirectory directory))))
(if (equal todo-list directory)
(setq todo-list (cons map-list (car (cdr (cdr map-list))))))
(setq todo-list (cdr todo-list)))
0)))
(t
======== SAMPLE 57 ========
buffers
;; from the command history for other groups. This
;; can then be used for other groups that may be browsing."
;;
;; `(define-obsolete-function-alias 'gnus-browse-group-get-new-news
;; "Unknown command: %s" "Unknown command: %s"
;; ,@(cons
;; '("C-h" 0 ; default for older Emacs
;; "\\([\t\n\\w+]") "\\1"
;; (lambda (arg1 arg2 ,arg3 ,arg4 ...)
;; ;; FIXME: Shouldn't this be taken to be a regexp match?
;; (eval (intern (concat (match-string 1 arg1) ":")))
;; (eval `(c-new-window (split-window ",*"))))
;; `(progn
;; (setq (setq list (cons arglist c-list)) nil))))
;; I really like the idea of some of the code but I can't seem to find any
;; documentation on how to use it. I'm looking for someone who knows
;; what I mean. -- jb
(defun c-in-no-mode-line (_)
;; Not a user option: We have to tell the browser to do these things
;; for us (this is like trying to tell an IRC client to load one of the
;; buffers with it).
;; This can be better with "*pop-to-buffer* at buffer" in the buffer
;; name (but, since we're on the buffer name, not in the mode: buffer:
;; we may not be able to use that function to show the buffer name
;; as a buffer). This is not really a user option: it doesn't
;; require the user to have set buffer-name to the shell's buffer
;; name, which is not actually the default, but still a bug.
;; (add-hook 'call-process-region-functions
;; #'c-pop-to-buffer-obey-shell-completion-mode nil t)
;; This is not really user option: it does not need to be set explicitly
;; by the buffer name. We could actually make it an alias (and have
;; it be an "if" rather than "set" function, but that would have to
;; be done with c-promote since it's already called by the shell, not
;; by the shell or the other buffer that invoked the filter) but that
;; would be a good workaround for the bug (and not that bad),
;; which it is that it doesn't, either. -- stu
"Like `let*'? `c-in-no-mode-line' is not defined in Emacs.el."
;; (c-line-obey-mode)
)
;; Used by "kill-buffer-query-functions", "kill-buffer-query"
;; which is in c-mode.el.
(defun c-kill-buffer-query-functions (&optional buffer)
"Return t if it finds the value of BUFFER and should abort."
(interactive)
(when buffer
(setq buffer (or buffer (current-buffer)))
;; If the user does not want to abort the kill, just return nil,
;; and throw away the error.
(setq buffer (get-buffer buffer)))
nil
(let* ((buffer-list (c-pop-to-buffer buffer 'in-mode))
(buf-list (c-pop-to-buffer buffer 'in-mode)) ; only buffer listed in buf-list
(buf-prompt nil)
======== SAMPLE 58 ========
buffers
"If t, also show a warning message if you are not careful,
otherwise show a warning (if you know who) unless you are the
one not. With `g' or `j' type M-x hide-log 1. See also the
variable `highlight-log-highlighting'."
(setq-local highlight-log-overlay nil)
(setq-local highlight-log-auto-exit-timer 'hide-log)
(setq-local todo-global-level ;; This is the name of one of the hooks
:local t
:doc "If on, turn it on.
This value controls the mode of the buffer visiting the file.
If nil, never turn on the mode. If it is on, turn it on
and make it invisible again.
If any non-nil additional hook variable `highlight-log-hook' appears,
adding it to this hook forces the hook to be active. This hook can be used
for further customization:
(add-hook \\='mode-line-process-functions \\='highlight-log-highlighting-hook
#'highlight-log-mode-line-update)))
;;;###autoload
(defmacro defcustom-customize-faceup (faceup symbol &optional facefile)
"Define FACEUP as an Emacs compatibility faceup.
This means that such faces should contain the following symbols:
:set The function used to update default-file, if any.
:set The function used to update default-file, non-nil argument.
:set-parent The function, if provided when you set the value of
symbol via the `faceup-parent'.
:set-parent-parent The function, if provided when you set the value of
`default-default-faceup'.
:set-previous-parent The function, if provided by the function symbol
or the parent symbol.
:set-parent-parent The function, if provided by the function symbol
If the buffer has some other value, it must be a list of symbols.
It can also be a variable symbol that should, if non-nil, be
ignored as being a local variable in this buffer. If that happens,
the local variables `default-file', `default-faceup' and
`buffer-faceup-mode' will get overridden in the faceup buffer.
To add a value to these variables, use `defcustom-faceup-to-set'.
For example, to show the value of these variables:
:set (default-faceup-default-faceup)
Then to add a value to `file-file-name', this can be done by using +: prefix;
or using `defcustom-faceup (my-faceup) (get my-faceup a b c)'. The former may be done
included when the variable is loaded, or in the global `faceup-faceup-key'
variables in your .emacs if you put it in (global-set-key `C-c C-b')."
(let ((default-file (symbol-value 'default-file)))
`(setq,
(customize-faceup ',faceup-default-faceup
(lambda (symbol)
(customize-variable symbol nil nil t)
(faceup-file-name-member ,file-file-name
======== SAMPLE 59 ========
buffers (in addition to windows/windowed modes). If the window is nil, or the buffer name is nil,
it can be a prefix argument. If it's the last element of
LIST, its first argument is the whole buffer."
(unless buffer-name
(setq buffer-name (buffer-name))))
(defun x-get-buffer-visibility-from-invisible-buffers (buffers)
"Return buffer to which Emacs hides BUFFERS.
BUFFERS is a list of buffers to examine. If nil, or BUFFERS
is the symbol `window', it will be returned instead of the buffer itself."
(let (buffer-name value)
(or buffers
(setq buffers
(cons (buffer-list)
(with-current-buffer buffers))))
(setq buffer-name
(cond ((null buffer-name) nil)
(t (buffer-name buffer-name)))
value)))
(defun x-get-buffer-visibility (buffers)
"Return buffer visible from buffer BUFFERS.
BUFFERS is a list of buffers to examine. If nil, or BUFFERS
is the symbol `window', it will be return instead of the buffer itself."
(with-current-buffer buffers
(with-current-buffer buffers (list buffer-name)) ; This returns the buffer in
; the buffer list.
(with-current-buffer buf
(x-get-buffer-visibility-from-invisible-buffers (current-buffer))))
(defun x-get-buffer-visibility-from-invisible-buffers (buffers)
"Return buffer to which Emacs hides BUFFERS.
BUFFERS is a list of buffers to examine. If nil, or BUFFERS
is the symbol `window', it will be returned instead of the buffer itself."
(with-current-buffer buffers
(with-current-buffer buf
(buffer-name (car buffers))) ; This returns the buffer in
; the buffer list and window
(setq buffer-name
(if noninteractive nil
(condition-case nil
(setq buffer-file-name
(concat (buffer-file-name buf) (buffer-name))
(kill-buffer buf))))))))
;;; Support functions.
(defun x-copy-buffers ()
"Return lists of buffers and directories in buffer BUF to use."
(if buffer-directory-p
(list (car (x-get-buffer-visibility-from-invisible-buffers)))
(cons (car (x-get-buffer-visibility-from-invisible-buffers)))
(x-list-buffer-with-faces buffer-directory-p))))
(defun x-copy-directory ()
"Return list of directories in buffer BUF to use. Leaves buffer name if current."
(if current
(x-list-directory-with-faces buffer-directory-p)
(let ((dst nd-list (len (length t)))
dir dt-list)
(while dt-list
(setq dir (dired-get-dirs (pop dt-
======== SAMPLE 60 ========
buffers-and-buffer)
;;;###tramp-autoload
(defcustom tramp-session-exists-buffer nil
"Buffer for resending messages from \"session\" in this Emacs session.
The value must be a buffer name, not t, which the current buffer will
exist in instead. It is safe to use `exec-buffer' for resending
messages, and a buffer name which does not have a \"\" extension.
When this variable is nil, no buffer or session will exist, but
the value of this variable will be used to resend messages. However,
it is not safe for the default value of this variable to be used.")
;;;###tramp-autoload
(when (tramp--test-sh-p)
(set (make-local-variable 'tramp-session-exists-buffer) "*Buffer sent*")
(unless (tramp--test-sh-p)
(set (make-local-variable 'tramp-session-exists-buffer) "*Buffer sent*"))
(set (make-local-variable 'tramp-session-last-session-time) nil)
(when (tramp--test-enabled)
(set (make-local-variable 'tramp-remote-id) nil)
(set (make-local-variable 'tramp-localname) "*Local name sent*"))
(when (tramp--test-enabled)
(set (make-local-variable 'tramp-remote-buffer-id) nil)
(set (make-local-variable 'tramp-default-user) nil)
(set (make-local-variable 'tramp-default-host) nil)
(tramp--test-run-p)
(message "running pwd"))
(unless (tramp--test-user-id)
(message "Running pwd %s" (tramp-file-name-user-id (tramp-remote-process vec)))
(sit-for 2 t))
(set (make-local-variable 'tramp-debug-message)
(tramp-make-tramp-send-it vec))
(set (make-local-variable 'tramp-debug-args) nil)
(set (make-local-variable 'tramp-debug-buffer) buffer))
;;;###tramp-autoload
(defun tramp-register-shost
(&optional name buffer)
"Invoked when checking for a remote host.
If NAME and BUFFER are specified, no argument is given.
To get a list of buffers, use `tramp-get-connection-buffer-function'."
(declare (obsolete nil "25.1"))
(interactive
(list (tramp-read-passwd "Check for HOST: " "root@" "-c"))
(prog1
(with-current-buffer (get-buffer-create tramp-test-buffer-name)
(tramp-do-connection-with-temp-file "foo")
(with-current-buffer (get-buffer-create tramp-test-buffer-name)
(set-buffer-file-coding-system nil))
(buffer-name default-directory)))
(unless (tramp--test-enabled)
(set (make-local-variable 'tramp-shost-user) (tramp-shost-user)))
(let* ((buf (current-buffer))
(buff
;;(if (tramp--test-with-args-p 'tramp-shost) nil (list 'identity buf))
(with-current-buffer buf
(dolist (buf-string buf-string)
(tramp-do-open-connection))
(push buf (tramp-make-tramp-connection buf-string buffer)))
======== SAMPLE 61 ========
buffers in the current buffer will
;; try to copy buffers into another buffer and
;; copy these (probably temporary) buffers into
;; another buffer (possibly) in order to avoid the
;; user dragging the temporary-file-buffer buffer (where
;; the temporary file buffer is) and subsequently copying
;; the other buffers into the other buffer, as if they
;; were in the buffer-local list.
(and auto-rename buffer-auto-rename-default))))
(when (and transient-mark-mode mark-active-mode)
;; FIXME: The code in function-key-map uses a non-symbolic modifier
;; to mark the mark (to make a mark that doesn't contain
;; the prefix keys), or a string with the same string (to
;; avoid problems where the string in question contains a prefix.
(symbol-function 'key-binding))
(let ((prefix-remaining
(funcall transient-mark-mode)))
(if prefix-remaining
(save-excursion
(end-of-line)
(beginning-of-line nil)))))
(set-buffer-modified-p buf-modified-flag)
(kill-buffer buf-modified-flag)))))
((setq this-command 'buffer-edit)
(setq buffer-undo-list t)
(let ((alist buffer-undo-list))
(setq buffer-read-only t)
;; Now, delete the list of undo variables, and start the buffer
;; again.
(setq undo-list nil)
(goto-char (point-max))
(while (and (not bflag) (setq bflag (funcall function)))
(let* ((alist-buffer-pos bflag)
(auto-redo-list
(and (setq bflag (buffer-local-value 'mode-specific-redo (current-buffer)))
(append (car auto-redo-list) auto-redo-list))))
(delete-dups auto-redo-list)
(and bflag (funcall undo-list)
(setq undo-list
======== SAMPLE 62 ========
buffers
:file-suffix-regex "*~\\(b\\(-\\):\\)"))
(if (and filesets-use-cite-mode (not noninteractive-p))
;; This command doesn't exist
(vc-dav-command
"filesets:"
(format "\\(\\.\\.\\)?Cite: %s"
(file-expand-wildcards (file-relative-name file)))))
;; No file, but we're in a csv buffer and not in a tag table!
;; ... or something like this
(progn
;; Go back to the last directory.
(if (and (eq major-mode 'vc-dav-strict-mode)
(save-window-excursion
(vc-dav-mode-line-lessp "*vc-dav-strict-mode")))
(set-buffer vc-strict-buffer)
(cond
((eq major-mode 'mode)
(vc-dav-execute-command "filesets-strict" fileset-program))
;; This command does not exist
(vc-dav-command
"filesets:"
(if (not (eq major-mode 'mode))
(unless (string-match "*vc-dav-mode?\\'" filename)
(vc-dav-set-current file-name t)
(setq mode (match-string 1)))))
;; Try to kill this buffer
(kill-buffer vc-kill-buffer)))
(message "Checking buffer: %s" buffer)))
(error "File does not exist; delete anyway"))
(set-buffer buffer)
(setq buffer-read-only nil)
======== SAMPLE 63 ========
buffers
\t\t[ \t]*;;;
;; Formatting function.
(defun texinfo-format-texi-function (buffer)
"Return texinfo-default-texi-function for BUFFER, or nil if none."
(and (not buffer) (symbolp buffer) (not (= buffer (current-buffer))))
(buffer-name buffer)
(unless texinfo-default-texi-function
(error "Buffer not defined"))
(let ((doc (when (stringp doc)
(get-text-property (point) 'texinfo-text-mode-docstring))))
(cond
((car texinfo-default-texi-function) doc)
((eq (car doc) 'texinfo-default-texi-function)
(get-text-property (car doc) 'texinfo-text-mode-docstring))
((eq (car doc) 'texinfo-default-texi-function)
(get-text-property (car doc) 'texinfo-text-mode-docstring)))
(t (insert doc))))
(defun texinfo-convert-texi-strings (args)
"Convert each texinfo-string in the buffer to one alist of arguments.
It does this by calling `texinfo-replace-string-array'.
Each texinfo string is processed on the order of the arguments (first
in the string, second in the list)."
(save-match-data
(let ((res
;; There is no current buffer for this.
(let ((buffer (current-buffer)))
(if (stringp buffer)
(format "Buffer %s" buffer)
(save-buffer)
(setq buffer buffer))))
;; Buffer has been left untouched.
)
(apply (symbol-value (car args)) (cdr args))
;; In order for the following args, there must be a `current' buffer. In either case,
;; the args should be a string. So it's necessary to remove the 'current
;; buffer.
(setq buffer (get-buffer-create "*texinfo*" 0 0))
(when (and (not (string= "current " args)) current)
;; Add `texinfo-buffer' to its `current' buffer.
(set-buffer buffer (current-buffer))
(insert "(\t")\t\n")
(setq buffer-file-name (file-truename buffer-file-name))
(kill-buffer buffer)
(set-buffer buffer)
(bury-buffer buffer)
(message "Buffer %s has already been renamed to: %s\nDone"
(buffer-name (buffer-name buffer)))
(setq buffer-file-name nil)
(setq buffer-file-truename 'local)
(insert " ")
)
(kill-buffer "*texinfo*"))))
(defun texinfo-replace-buffer (buffer &optional arg)
"Insert BUFFER into the text between WORD and END.
If ARG is non-nil, operate on the entire text instead of just the
beginning.
If ARG is t, then read each new line in the first command by that buffer,
unless the following command is `read'. Return the result.
If ARG is neither nil nor t, the end is read into the text.
If ARG is any other non-nil value, return nil."
(if buffer (
======== SAMPLE 64 ========
buffers."
(interactive)
(if (and file-name (file-directory-p file-name))
;; Not directory. If using a temp buffer, make sure the
;; directory is readable.
(file-name-as-directory file-name)
;; Change name.
(find-file (read-file-name "Change name: " file-name nil t)))
(let ((default-directory file-name))
(when (and (file-writable-p (expand-file-name "test-tmpfile.c" dir-location))
(> (length (directory-files dir-location)) 1))
(message "Reading temp-dirs...")
(setq default-directory dir-location t)
(setq default-directory dir-location))
(setq buffer-read-only nil)
(delete-directory dir-location)
;; Find the name of the temp-dir. If the temp-dir does not exist, we need
;; to create it first, and to leave it there.
(setq filename (file-name-nondirectory (buffer-file-name)))
(when (zerop (length (find-file-name-nondirectory filename)))
(setq filename (make-temp-file (expand-file-name (car filename) dir-location)
nil nil nil 'dir-locs))
(insert (file-name-nondirectory filename))
(write-region (point-min) (point-max) filename nil 'no-message)
(princ file-name)
(insert (file-name-nondirectory filename)))
(message "%s" (substitute-command-keys "\C-%"))
(if filename
(message "Reading temp-dirs...done.")
(while filename
(setq filename (file-truename (expand-file-name (caar filename)) (cdar filename)))
(setq filename (expand-file-name (file-name-nondirectory filename) filename)))
(princ " ")
(insert-file-contents filename)
(princ (substitute-command-keys "\C-z\C-z\n"))
(princ "\n" (substitute-command-keys "\
This file contains an executable or a file name.
\(a) It is an executable;
(b) It is an optional filename;
(b) It is an explicit file name.
\(c) `with-temp-buffer' is used to check if you are visiting the executable
\(for example, that if the shell prompts you for a file name, then you are asked).
"))))
(defun set-temp-buffer-window-context (buffer current-buffer)
"Set context buffer BUFFER into a window that shows BUFFER's contents.
BUFFER is the current buffer."
(with-current-buffer window-buf
(setq frame-scroll-bars nil)
(while (frame-live-p frame-context-frame-with-side-effects)
(setq frame-context-frame (new-frame frame-context-frame))
(move-frame-1 frame-frame)
(setq current-buffer buffer)))
(let ((res (window-for-time proc last-input-buffer-start))))
;; When the window buffer is dedicated, this function will not restore
;; the window state. But it will restore the old window context, if it
;; can, otherwise it just goes back to the old window state.
(and res (
======== SAMPLE 65 ========
buffers
("#" . "_"))
(append (if ispell-gmane-verb2 (nth 2 (assoc 'verb1 (length elc))) ""))
(if ispell-buffer (setq elc (list elc)))
(append (if ispell-buffer
(list (car elc) (mapcar (lambda (f)
(ispell-translate-query-string
(car-safe (cadr elc)))
(cadr elc))
?\s))))
(if notpell-kill
(setq buffer (ispell-kill-buffer el1)))
(setq buffer (current-buffer))
(when (buffer-modified-p el1)
(with-current-buffer el1
(buffer-disable-undo (current-buffer))
(erase-buffer))))
(setq elc (cdr elc))
(goto-char (point-min))
(while (search-forward
"*pell-interactive" nil t)
(setq el1 (assoc (downcase (char-after)) (length el1))
el2 (assoc (downcase (car el1)) (length el2)))
(goto-char (point-min))
(if (and ispell-kill (< el1 el2))
;; This is a word list.
(insert ":: ")
;; Check the list for spelling errors.
(if (and
(notpell-checkpell buffer))
(progn
;; This is the current buffer.
(unless this-buffer
(ispell-checkpell buffer)
;; This is the buffer from the global dictionary.
(ispell-delete-overlays)
======== SAMPLE 66 ========
buffers.
;; This function is part of
;; `font-lock-defun-declare-symbol'
(defmacro defun-all (name) `(defun-declare-var ,name t))
`(defun-declare-var ,name :name, t))
;; This function is used by the function eval-defun. It calls
;; `eval-defun' in the same way as the defun-all function.
;; This function is used by both the `font-lock-variable-name-face'
;; and `font-lock-string-face' functions. See also
;; font-lock-defvar-deftest-2.4.2.1224
(put 'font-lock-variable-name-face 'edebug-spec '(symbol))
(defun font-lock--deftest-defuns-1:make-defun-propertized (make-defvar definition &optional _arg)
"Determine the defun-propertized symbol for a buffer.
Definitions is a list suitable for `font-lock-constant-face'
and `font-lock-constant-font-lock-keywords-face'.")
(defun font-lock--deftest-defuns-2:make-defun-propertized ()
"Determine the defun-propertized symbol for a buffer."
;; This definition can also be used by `eval-let*', where it is
;; used to evaluate the defun-propertized face in the list containing
;; the definition and returns non-nil if so.
;;
;; This definition can also be used by `eval-let*', where it is
;; used to evaluate the defun-propertized face in the list containing
;; the definition and returns non-nil if so. Note here that we
;; might have to do this manually: we should use the macro `ert--deftest-buffer'.
(let*
((def-symbolp (progn (condition-case nil
(progn
(setq definition (eval-when-compile
(symbol-name def-symbol))
(error
(error-message-string-format)))))))
(def-font (save-excursion (backward-up-list 0)
(buffer-substring-no-properties
(point)
(progn
(beginning-of-defun)
(skip-chars-backward " \t")
(point))))))
======== SAMPLE 67 ========
buffers and files with
included files. We do this by scanning the active buffer. To see
the full history of this command, see Info.el and `Info-merge-dir'.")
(make-obsolete 'Info-merge-dir 'recreate-directory "24.1")
(defvar Info-current-file nil)
(make-obsolete 'Info-current-file 'recreate-directory "24.1")
;;; User Variables:
(defcustom Info-buffer-file-name "~/Cancel"
"File name to use for Cancel Commands on Info buffers."
:version "24.1"
:type 'string
:group 'Info)
;;; Functions:
(defun Info-buffer-files (&optional noerror)
"Return list of all Info Info files associated with point.
See Info for details about using `Info-goto-node' to locate Info files
there."
(with-current-buffer Info-buffer-file-name
(let (posn1 posn2 posn3)
(while (and (not posn)
(setq posn1 (pop posn1)))
(if (member posn1 posn2)
(setq posn1 (pop posn1))
(setq posn2 (pop posn2)))
posn1))))
(defun Info-find-node (info-string)
"Visit the Info node with a given INFO-STRING.
Return the node's title, author, date, and location.
The following strings are returned."
(cl-loop
collect (list (format "\"%s\"" (if (stringp (car info-string)) "" (car info-string)))
file-list (cdr Info-string)))
(or (car info-string) (car (find-text-by-thing-to-string
(format "%s\"" (car info-string))))
(car info-string))))
(defun Info-find-node-text (string &optional found)
"Find the text for the node.
STRING holds the text to search for text, not a list of nodes per
line. This function should be performed if not found in the
history of the Info buffer."
(let ((file (or (Info-buffer-file-name)
(and found
(funcall Info-find-node-text string))))
(path (or (Info-buffer-file-name)
(and found
(funcall Info-find-node-title string))))
(fileinfo file-list)
(dir1 (if (not found) file-list
:file "")))
;; If there is a known node, we make sure it is found.
;; Otherwise, we ignore the current node.
(when (and dir1 dir2)
(setq dir1 (expand-file-name dir1))
(setq dir2
(if (string= dir1 (file-name-nondirectory dir2))
;; If node was selected, find a node that can be selected
;; later by another node. Otherwise, try to find a node
;; that has no previous node.
======== SAMPLE 68 ========
buffers (Bug#26791, bug#29085).
(defmacro with-temp-buffer-dont-use-menu (item menu-bar-filter)
"Replace current menu with ENTRY-PATTERN."
(declare (indent 1))
`(let* ,item (lambda ()
(list ,menu-bar-filter ,item)))))
(defsubst with-temp-buffer (buffer &optional force)
"Remove buffer that is neither in this buffer nor at the top of buffer;
if that buffer is a buffer, remove it.
Argument BUFFER specifies the buffer to be returned."
(buffer-list buffer)
(if (buffer-modified-p buffer) force
(kill-buffer buffer))
(delete-other-windows))
(defmacro with-syntax-table (syntax-table-extra table &rest syntax-proper-syntax-table)
"Like `defalias-syntax-table' for buffers that are not in a syntax table."
(declare (indent 2))
(let ((buffer (get-buffer-create syntax-table-extra)))
(buffer-disable-undo)
(unless buffer
(setq buffer (syntax-class buffer)))
;; Don't copy the list because we would have to copy the order of the
;; names in that buffer.
;; (syntax-table-unquote-syntax-table (syntax-table))
(unwind-protect
;; There's some syntax in the entry (with a number).
(let ((default (assoc (format "%%H:%d" (msb-count)
;; FIXME: How can this be ?
(msb-count) ""))))
(or buffer
(let ((default (assq (format "%%C" (msb-count) obarray))))
(cond (default
(set (make-local-variable 'syntax-table-for-tags)
table))
((eq default 'buffer) nil)
((setq buffer (syntax-class buffer))
nil)
((syntax-after 0) t)
((syntax-after 1)
(car default)))))
;; We don't have to copy the names of the special symbols in the
;; entry (with number.
(delete-region (car default) (cdr default))
(insert-char ?\s-char character))
(setq buffer (syntax-table table))
(cond ((eq buffer t)
(goto-char (1- (point-max)))
;; It appears that the buffer is in its final position.
(let ((buf (current-buffer)))
(
======== SAMPLE 69 ========
buffers '())"))
(save-excursion
(goto-char (point-max))))
(while (and (null (props-get (car props)))
(not (get-text-property (point) 'keymap)))))
(unless props
(condition-case err
(let* ((alist (alist-get (car props)
:value)))
(if car (setcdr car value))
;; If we have no list, use any existing
;; properties to set alist property-wise:
(unless (eq (car-safe (car alist-key)) 'dict)
(setq alist (cdr alist-key)))
alist)))
(while (not (or alist-set ;
(progn
(setq value (alist-get (car alist-key)
:value))
(and value
(assoc value alist))))
(setq alist
(cons value (cons alist value)))
(nreverse value)
(push (cons value alist) props)))
((equal value "") nil)
(t
(push (list value) props))))))
(defun etags-make-tags-tree (string pred action fn &optional tag)
"Create a tree for tags in the buffer with `tags-file-name'.
STRING is a string describing the tags.
PRED is a function returning the string tag to create for TAG.
The variable `tags-file-name' is local to TAG, but used by the functions
it returns."
;; (message "%s: %s%s" (car function) (cadr function))
;; (message ": %% %% %s" (car function))
t (or (not (setq action (assoc (car function) t)))
"")
;; (message "%S: %% %% %s" (car function))
;; (message ": %% %% %s" (car function))
======== SAMPLE 70 ========
buffers when running the lisp version of the
;; version of Emacs, not if any of Emacs's extensions are
;; used to run the Lisp version of
;; the version of Emacs running the lisp version of
;; the version of Emacs, not if any of Emacs's extensions are
;; used to run the Emacs version of
;; the version of any of Emacs's files, not if any of Emacs's
;; extensions are used to run the extension versions of the file buffer,
;; including the extension version of Emacs. See also
;; `set-buffer-major-mode' for the format of a file buffer
;; buffer mode.
;; This macro allows you to define a Lisp version of the Emacs Lisp
;; mode; it does not apply to the files and extensions listed
;; in the lisp version of the version of Emacs used to run the
;; lisp version of Emacs, not if any of Emacs's extensions are
;; used to run the Lisp version of the version of Emacs run by
;; the Emacs version of the current major mode.
;; If the key bindings given in this macro are not used, this file will
;; not be loaded. The user will see that this function is called and
;; it does not do its job easily. You can disable all key bindings of
;; lisp-mode on activation by using `\\[global-lisp-mode]'.
;; There is an additional section in the manual explaining the way
;; the buffer-local variables are set.
;; The function is called in each session and the user will see how all
;; variables are active. The variables defined in the macro will be activated
;; at session start. See the documentation for the function `lisp-mode' for more
;; details.
;; The following example defines the variables
;; [filename new-name, new-version-string, ;; ...
;; (define-key map "\M- " [?\C-e]" 'lisp-mode)
;; (define-key map "\M- " [?\C-r]" 'lisp-mode)
;; This function is called on each run in Emacs, and should not be called
;; directly because the functions `lisp-mode-revert' and `lisp-mode-revert'
;; do not work within such modes.
(defvar lisp-mode-map)
(and (boundp 'emacs-version)
(if (boundp 'emacs-major-version)
(easy-menu-define
emacs-major-version lisp-mode-map "Menu commands for Lisp modes."
'("Keymap for Lisp mode."
["Keymap for Elisp"
emacs-major-version t]
)
"Lisp Mode Manual" ; "Lisp Mode" and similar
:style toggle :selected emacs-major-version]
(set (make-local-variable 'help-f15-help-function) 'lisp-mode-lisp-help-mode)
(define-key lisp-mode-map "\C-s" 'help)
(add-hook 'help-mode-local-find-file-hook (lambda () (funcall help-function lisp-mode-map))
(cons (current-buffer) (current-buffer))
mode-local-map))
(easy-menu-define
lisp-mode-menu lisp-mode-map
"Menu commands for Lisp modes."
`("Lisp Mode"
["Help" help-global-help
:active help-mode t ]
["Emacs Manual" (lambda () (interactive
======== SAMPLE 71 ========
buffers, and don't signal an error.
;;; Code:
;;; Internal Variables:
(defvar edebug-edebug-format 'edebug-debug-with-format
"Format string for debugging Emacs or Emacs-Lisp bindings,
and `edebug-debug-with-format'. This is used while evaluating Edebug.")
(defvar edebug-debug-mode-map
(let* ((map-function
(lambda (x) (if (featurep 'xemacs) (cons (car x) x)))))
(define-key map (char-to-string (edebug-get-format)) map)
map)
"Keymap for debugging Emacs buffers.")
;;; (defcustom edebug-debug-header-line-function
;;; (if edebug-debug-prefix
;;; (with-current-buffer debug-buffer-function-table
;;; (funcall #'current-buffer))
;; "Function to use in C-x C-f for debugging Edebug")
;;; "Function to use in C-f, C-f, C-k to debug a buffer")
(defconst edebug-help "-"
"Describes how the edebug debug session works.
This should be one of `c-setup-print-buffer-variables', `reduce-print-area',
''#+BEGIN: edebug.el\
|*-*- Edebug session\n")
;;; (defconst edebug-mode-map (let ((map (make-sparse-keymap)))
;;; ;; edebug-debug-debug-prefix for the default command
;;; (make-sparse-keymap map-function-map)))
(define-derived-mode edebug-mode fundamental-mode "Edebug"
"Major mode for editing commands in Edebug buffers.
Edebug is a buffer-local set of commands which control the flow of text
and editing. It provides a degree of control over the behavior of this
mode. For example, by manipulating text and text properties, as well as
how it is executed, you can edit text, text properties, and
the like.
\(Edebug Control: *Edebug Commands)\n"
;; FIXME this is actually a bug in emacs26
(let ((buf-mode (if (edebug-buffer-live-p buf-buffer)
(or edebug-debug-prefix edebug-debug-prefix)))
(buf-name (format (edebug-get-prefix-arg nil "-" "-" "-->" "-" "--->"))))
(define-key edebug-mode-map (make-sparse-keymap buf-mode-map))
(define-key edebug-mode-map "\C-g" 'edebug2-backward-matching-defun)
(define-key edebug-mode-map "\C-g\C-v" 'edebug-debug-defvar-start)
(define-key edebug-mode-map "\C-k" 'edebug-debug-defvar-kill-arg)
(define-key edebug-mode-map "\C-c\C-d" 'edebug-debug-delete-arg)
(define-key edebug-mode-map "\C-c\C-y\C-d" 'delete-char-untabify)
(define-key edebug-mode-map "\C-c\C-x\C-d" 'edebug-debug-kill-arg)
(define-key edebug-mode-map "\e\C-k" 'edebug-jump-to-definition)
(define-key edebug-mode
======== SAMPLE 72 ========
buffers; you could, say,
;; ;; don't need to run the calc command.
;;
;; ;; The first time one of the calc commands is given a non-nil
;; ;; value, it should run the calc command, if it has one
;; ;; and a non-nil value. The rest of this code is a case-sensitivity
;; ;; test, and should be called when you hit the prefix key.
;;
;; (define-key minibuffer-local-c-map "\C-c" 'run-at-time)
;; (define-key minibuffer-local-c-map "\C-c\C-t" 'calc-toc)
;;
;; ;; If the key is preceded by an asterisk then that means that one of
;; ;; calc-mode's keymaps is used for calc. This can lead to confusion.
;; ;; Note that the key can be followed by other modifiers, eg [?/-] or [!]) or a number or
;; ;; a character string. If the key is not preceded by an asterisk then
;; ;; Calc mode commands are not invoked; rather the key is invoked.
;; (interactive "P")
;; (calc-wrapper
;; (lambda ()
;; (calc-enter-result 3 0 "\\*Help*"))
;; (global-set-key "*" 'calc-quit))
(defun calc-setup-calc-map (keymap key1 key2)
"Set up keymap for input Calc mode (with Calc mode.)
Keymap is a global keymap for Calc input method. It is used
in the keymap to toggle key bindings and other useful minor settings
for the Calc buffer.
KEYMAP can be a prefix string giving the keymap (if it has one)
which specifies key bindings or a list of functions which apply the value
of the other keys.
You can also use the keymap in the following way:
(defun calc-setup-keymap (sym prefix)
(if prefix
(let ((calc-language calc-language)
(calc-language-prefix-p prefix)
(calc-language-identifier-p prefix)
(calc-language-identifier (if prefix t nil)))
(dolist (sym prefix)
(set (intern (concat sym prefix)) (calc-language keymap) sym))))
(define-key keymap [?/] 'calc-set-face)
(define-key keymap [M-/] 'calc-reset-face)
(define-key keymap [M-h][?*] 'calc-clear-help-message)
(define-key keymap [kp-1] key)
(define-key keymap [kp-2] key)
(define-key keymap [kp-3] key)
(define-key keymap [kp-6] key)
(define-key keymap [kp-9] key)
(define-key keymap [kp-\\] key)
(define-key keymap [kp-0] key)
(define-key keymap [kp-3] key)
(define-key keymap [kp-7] key)
(define-key keymap [kp-12] key)
(define-key keymap [kp-x] key)
(define-key keymap [kp-1] key)
(define-key keymap [kp-2] key)
(define-key keymap [kp-3] key)
;; Don't do this if both keymaps are bound to the same key.
======== SAMPLE 73 ========
buffers (see above) to build or update the file.
(defun dired-insert-d-file (dirs files output filename &optional _old-directory)
"Insert a new DIRS.
Return the result of DIRS, if the given argument FILENAME is
non-nil, or FILENAME. If FILENAME is nil, assume the default for the
last entry in the dired output, i.e., the one created by the
`dired-find-file-1' command."
(dired-goto-file dir)
(dired-file-name-internal (expand-file-name "D:")))
(defun dired-find-file (file)
"Return a DISTANCE object.
FILE is the FILE name found."
(dired-find-file-1
(format "%s%s" dir (or (expand-file-name "foo" file) ""))
(format "%s" dir)))
;;;###autoload
(defun dired-find-file-2 ()
"Return the first DISTANCE object on the current line in the dired output.
This object is a function in the dired-get-filename-function."
(unless (zerop (dired-current-directory))
(dired-find-file-2 nil)))
(defun dired-next-file ()
"Move point to next DISTANCE object."
(error "The Dired subdir of this file can not be selected"))
(defun dired-backward-file ()
"Move point to previous DISTANCE object."
(error "The Dired subdir of this file can not be selected"))
;;;###autoload
(defun dired-insert-d (directory &optional _old-directory)
"Insert FILE in DIRECTORY at point.
Interactively, a prefix argument (prefix, interactive)
non-nil says to insert this new subdirectory."
(interactive
(list (read-directory-name
(if current-prefix-arg "Find file to insert: " "Find" t) "")
current-prefix-arg))
(if (null dired-current-directory)
(user-error "No Dired buffer at point"))
(if (member-ignore-case current-directory dired-directory-files-regexp)
(dired-insert-d dired-current-directory directory t
": " dired-current-directory)
(find-file (or
(dired-current-directory) "find")))))
;;;###autoload
(defun dired-find-file-3 ()
"Return the first DISTANCE object on the current line in the dired output.
This object is a function in the dired-get-filename-function."
(when (zerop (dired-current-directory))
(setq dired-current-directory (dired-get-filename)))
;; Use the latest default.
(when (and dired-subdir-p dired-current-directory)
(dired-find-file-3 nil)))
;;;###autoload
(defun dired-find-file-4 ()
"Go to beginning of next dired FILE.
Optional argument NO-EXIT-FUNC means the last non-point position
of point in `forward-line', or nil if not at an end of the previous
line."
(let (file-found found-pos d-pos next-line-end pos)
(unless (null d-pos)
(dired-move-to-end d-pos)
;; Move this line forward until we find a match for
;; one of the dired-find-files below.
(while (and d-pos
(<
======== SAMPLE 74 ========
buffers.
(defun gnus-group-read-group (&optional server method)
"In a modified version of \\[message-unread-command] in current buffer, read and
return a group message associated with SERVER.
See also the variable `gnus-group-unread-or-blank-line'."
(interactive)
(or server
(setq server (gnus-server-get-method server)))
(gnus-message 5 "Reading group message" nil server))
(defun gnus-group-read-group-buffer (&optional server method)
"In a modified version of \\[message-unread-command] in current buffer, read and
return a buffer message associated with SERVER.
See also the variable `gnus-group-unread-or-blank-line'."
(interactive)
(gnus-message 5 "Reading group message" nil server))
(defun gnus-group-read-server-buffer (&optional method)
"In a modified version of \\[message-generate] in current buffer, read and
return a buffer message associated with SERVER.
See also the variable `gnus-group-unread-or-blank-line'."
(interactive)
(gnus-with-article-buffer
;; If nothing can be done to the buffer, just return the message.
(let ((server
(or (gnus-method-to-server method) (setq gnus-group-unread-or-blank-line
t)))
(server-buffer (format-buffer "@" method)))
(gnus-server-join-buffer server)))
(if (gnus-buffer-live-p server-buffer)
(gnus-set-secondary-buffer server-buffer server-buffer))
(let (buffer-read-only
unread marks)
(unwind-protect
(progn
(with-current-buffer server-buffer
(save-excursion
(goto-char (point-min))
(gnus-request-article article
(format "gnus-group-read-group-buffer" service) t)
(gnus-group-insert-group-line group
server-buffer
(current-buffer)))
(with-current-buffer server-buffer
(when (and marks
gnus-agent-marked-articles)
(gnus-request-group group marks
(gnus-agent-marked-articles-string
gnus-agent-marked-articles))))
(if marks
(gnus-group-unread-or-
======== SAMPLE 75 ========
buffers
for help in directory (`(,(car pwd-list))
do ;; `(,(pop pwd-list) )
do ;; ))
for key (nth 3 pwd-list) ;; `(,(file-name-nondirectory filename) :))'
,(cond
((executable-find "pwd")
,(if (not (executable-find filename)) ""
"pwd: ")
;; .
,pwd : t
)
((executable-find "pwd.el")
,(file-name-nondirectory filename) : )
(t
,name))
)))
;;;###autoload
(defun pwd (host)
"Invoke the `pwd' command from Emacs Lisp."
(interactive
(list (read-file-name "Pwd: ")
current-prefix-arg
current-prefix-arg-locals t)))
(defun tramp-handle-shell-command-output (proc args)
"Like `shell-command-output' for Tramp files."
(unless (tramp-compat-file-wildcards) (tramp-compat-file-name-unquote proc))
(with-parsed-tramp-file-name (expand-file-name "bash" tramp-apps) nil
(let ((proc (tramp-dissect-file-name tramp-apps)))
;; Use Tramp version.
(when (tramp-compat-mode-string-p "")
(tramp-send-command-and-check
vec
(format "with-%s" (tramp-ascii-program tramp-ascii-program-alist))
"c")))
(if andargs
(tramp-message vec 1 "%s" (tramp-handle-shell-command-args proc))
(with-current-buffer (tramp-get-connection-buffer vec)
(buffer-disable-undo) ;Disable truncation of buffer list.
(when (buffer-modified-p)
(unless (zerop
(tramp-call-process
vec
(format-message "\
Displaying %s in the minibuffer.
The command must be in `shell-command-output'."
======== SAMPLE 76 ========
buffers
(error "Invalid input file name %s" filename))
(let ((output-file-name-no-eol (file-name-nondirectory filename)))
(if (string-equal output-file-name-no-eol ".com")
(concat output-file-name-no-eol ".com")))
(let ((file-name-coding-systems
(and
;; Use the same encoding used inside the file header.
(let ((encode-coding-system-alist
'("encode-babyl" "utf-8" "undecided")
'("UTF-8" "utf-8dos" "dos-dos"))
;; See also the RFC 2598 paragraph on encodings..
(decode-coding-system
(let ((coding-system-for-write 'binary))
;; Use the same coding-system used inside the file header.
(setq encoder-coding-system
(copy-sequence encoder-coding-system))
;; If the coding system doesn't provide an encoding
;; in the current buffer, don't try and decode.
(decode-coding-system
(or coding-system-for-read
(gnus-find-file-noselect filename
'binary))))))
;; There are three ways to encode the filename: either
;; encoded as ASCII, or
;; encoded as UTF-8. So we bind MIME-encoding-alist to
;; encode the file header.
(let ((encoding-coding
(condition-case err
(let ((default-directory (file-name-directory filename))
(default-directory filename))
;; If the encoding system in use is the EOL encoding,
;; it will be encoded as utf-8.
(let ((base-directory default-directory))
(if base-directory
(decode-coding-string
(if (file-name-absolute-p filename)
======== SAMPLE 77 ========
buffers
(save-excursion
(goto-char (point-min))
(when (= (current-column) 32)
(save-excursion
(beginning-of-line)
;; Don't stop if there is whitespace after this character.
(and (<= (point) (match-end 0)))
(re-search-forward "\\=[ \t]*" nil t))
(move-to-column nextcnt))
(move-to-column cnt))
(goto-char (point-max))
(forward-line 1))
(setq cnt (1- cnt)))
((save-excursion
(goto-char (point-max))
(when (looking-back cnt-regexp-like-regexp (1- cnt))
(setq newline (buffer-substring
(+ (point) (string-match ".+" cnt-regexp-like-regexp))
cnt-delims))))
(goto-char (point-max))
(setq newline char (point-max)))
(t
(error "Missing \".+" characters"))))) ; end macro
((= cnt 50)
(goto-char (+ cnt 5))
(beginning-of-line)
(setq cnt (1+ cnt))) ; insert newline
((= cnt 51)
(goto-char (match-beginning 2))
(setq cnt (1+ cnt)))
(t
(error
"CNT-LONG was \"long\" or \"short\""))
)))
(defun org-parse-headline-1 (&optional type cnt)
"Parse headline text.
OPT is the type of headline to search. This is the name of a
headline and can be either a capitalized line or a short
capitalized line. The default for the type is the `headline'.
CURRENT-NAME describes the current headline. If
======== SAMPLE 78 ========
buffers with no extra buffer entries in them.
;; This is a special form that handles all the standard buffer
;; forms, but has a specific meaning for a certain keystroke. You can
;; insert these characters and then fill in your buffer list.
'-' ; For font-lock, see
;; ; `font-lock-mode'
;; ; and `minibuffer-fontify-whitespace'
;; Function to set `minibuffer-fontify-symbols'
;; These are all functions for fontification of symbols. This is
;; just a convenient addition to font-lock's lexicographic fontification system.
;; (font-lock-set-defaults nil 'max-syntaxes)
;; (font-lock-set-defaults nil 'font-lock-fontify-symbols))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Customization variables
;; If you add something to this list, don't forget to include a
;; commented out copy of the text around the comment at the start of
;; the buffer.
;;; Change Log:
;;; Code:
(require 'compile)
(defgroup c-mode nil
"Major mode for editing and editing C code."
:version "24.1"
:mailcap 'gnu)
;; Some of the stuff that might not make it into C (major mode or otherwise).
(defcustom c-mode-alist
'(("^\\s-*\\s-*\\(\\[[0-9]+\\s-*\\]\\)?\\s-*$" ; for the variable `-*'.
["+" ; for the cpp-line-number-face.
;; `+' is used as the symbol `line'.
["-" ; for the cpp-fontified-char.
;; `line' is used as the symbol `line'
["=" ; for the .@. character.
;; The value is just a symbol.
["=" ; for the character `(..{\\S-*:}').
["{" ; for the cpp-line-number font-lock.el
;; `line' is used as symbol.
[":" ; for the .*'.
["{:line-number:" ; For c-style cpp-line-number font-lock.el.
(if (c-in-literal) "* \\([^)}]\\|\\[[0-9]*\\]\\)*\\(
======== SAMPLE 79 ========
buffers.
(insert file)
;; Now the main function can go there.
(org-babel--goto-arg-outdent org-babel-tangle-file nil)
(org-babel-goto-arg file))))
;;; Compile script or template files.
(defalias 'org-babel-script-compile 'org-babel-execute-src-block)
(defalias 'org-babel-template-compile 'org-babel-execute-src-block)
(defalias 'org-babel-execute-template 'org-babel-execute-tcl)
(defalias 'org-babel-execute-expand-file-name 'org-babel-execute-expand-file-name)
(defalias 'org-babel-execute-template 'org-babel-execute-template)
(defalias 'org-babel-execute-template-member 'org-babel-execute-template-member)
(defalias 'org-babel-execute-expand-file-name 'org-babel-execute-expand-file-name)
(defalias 'org-babel-read-file-name
'((file (org-babel-expand-file-name ".src" ".el"))
(readfile (org-babel--standard-file-name
(file-name-nondirectory
(buffer-file-name))))
(default (org-babel-default-file-name file t))
(default-file (file-name-nondirectory default)))
"Exhaustively run `find-file' for a file. This will return a file name,
or an empty string. The return value should be a symbol indicating how to
expand the file.
Runs `find-file' on any source block found \(or expanded) as an
element. Otherwise, the return value should be nil.
This can be used to extract function names from the name of an
entity or file or procedure definition. For example, in EIEIO,
let ((a = org-babel-e({
_var_info (lambda () (org-babel-expand-file-name "ex" :body)))
_body))
Runs a plain EIEIO-like, asynchronously.
Note that, on loading a file or procedure, you will run it from within the
file, or even from a different process. On the default EIEIO backend
\(unlike that of `org-babel-execute-expand-file-name') you can change the
variable `org-babel-tangle-file-default-no-warn-buffer' to nil to avoid
the warning. If this variable is set to non-nil, `org-babel-execute-template'
can be used to create a template in this case. (If this variable are non-nil
as well, `org-babel-execute-expand-file-name' is also run.")
\(fn &optional FILE)" t nil)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-babel" '("org-babel-")))
;;;***
;;;### (autoloads nil "org-beamer" "international/org-beamer.el" (0 0
;;;;;; 0 0))
;;; Generated autoloads from international/org-beamer.el
(autoload 'org-beamer-activate "org-beamer" "\
Invoke the Babel Help buffer.
If buffer is current try to contact its owner(es)
and refresh browser window after Babel command.
If buffer is not current, visit current buffer, update browser
window and call `org-babel-update-browser-window'.
This command is bound to function according to
`org-babel-function' SYNTAX." nil nil)
(autoload 'org-beamer-get
======== SAMPLE 80 ========
buffers (or not just one) with a
preferred list of lists from which to apply the command;
the new list is then used with `apply-partially'.
In this way, commands starting from `run-dirstate' and `pop'
work just like in `run-dired', except that the command is preceded
by a newline and it is not possible to mark the point. Instead, the
command runs at the point specified by `point-at-eol'.
See also `dired-jump-subdirs'."
(dired-ignore-case (equal (dired-current-line) "^dired")
(dired-ignore-case (equal (dired-current-line) "\\.\\.exe")))
;; Use the old, slower, less informative command-name-case-alist.
(replace-regexp-in-string
":" "."
(mapcar (lambda (line)
(or match "[" (match-string 0 line) "]"))
(if (match-string 1 line) "," "]"))
(eval (lambda (symbol) (if (eval-when-compile
(symbol-value symbol)
;; Emacs >= 22.0? Do `ediff'
;; properly return the result as a list?
(cons (concat "file" (symbol-name symbol)
'dired-new-file-symlink)
symbol)))
(regexp-quote
(replace-regexp-in-string
(replace-regexp-in-string
regexp-quote (replace-regexp-in-string
"[" regexp-quote nil t
(replace-regexp-in-string
"[" regexp-quote nil 'dired-new-file-symlink)
"[" "]")))
'dired-new-file-symlink-alist))
;; If point is outside the current region and there isn't a dired to go
;; over, do the dired-run command.
(dired-ignore-case (equal (dired-current-line) "^dired-")
(if is-subdir
(dired-read-subdir-by-subdir-commands
======== SAMPLE 81 ========
buffers where the buffer is not hidden.
;; FIXME: This is not yet implemented (Bug#4657), so should probably be fixed
;; later.
;;; Code:
(defvar idl-help-fontset
'((latin-is13
(("Mule\tBlack" . black) ("Eyes wide\tLightGray" . lightGray)
("Color strong\tLightGray" . lightGray)
("Background dark\tMagenta"))
("Face dark\tMediumMagenta"
("Background light\tDarkMagenta"
("Foreground light\tDarkMagenta"
("Background dark\tDarkMagenta"
("Background light\tDarkMagenta"))
("Background dark\tDarkDarkMagenta"))
("Foreground dark\tForestGreen"
("Background light\tForestGreen"
("Background dark\tForestGreen")))
("Gray background\tForestGreen "
"Background light\tan"
"Gray background\tan"
"ForestGreen background\tan"
"DarkBlue"
("Flora\tForestGreen ""
"ForestGreen background\tan"
"ForestYellow landscape\tForestGreen"
("Grain dark\tForestGreen")
("Flora\tForestGreen "_
"ForestGreen \tWhite"
"ForestYellow landscape\tForestGreen"
("Trees\tForestGit\tForestGreen\tGit\tForestGreen\tGit\tForestGreen\tGit\tForestGreen\tGit\tForestGreen\tForestGreen\tForestGreen\tForestGreen\tForestGreen\tForestGreen\tForestGit\tForestGreen\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\tForestGit\t
======== SAMPLE 82 ========
buffers
(let* ((key (concat "+" key "_")))
(setq key (get key key))
(unless comint-input-ring
(with-current-buffer input-buffer
(insert string))
(insert ";; QUICK INTERACTIVE KEYWORD")))
key)
(defsubst comint-input-ring-contains-default (string pred action)
"Return STRING and PRED, the string we're input."
(let ((result (append result input-ring)))
(if (stringp result) result
(cons result (current-buffer)))))
(defun comint-input-ring-internal (proc string pred action)
"Internal command input ring for Icom.
Useful strings are:
\"^\n"
(let ((input (comint-ring-item-name string pred
(cons
(mapconcat (lambda (arg)
(string-to-number
arg)
"\n")))
(cons
(mapconcat (lambda(obj)
(string (read-string (format "Run as an inferior with %s"
obj t))))
string "\n")))
string)
(not (string-match "^\\s-*" (char-to-string input)))))))
(defsubst comint-input-ring-substring-equal (regexp string pred action)
"Same as `string-equal', except `null-or-null-or-not' is recognized."
(let ((ring (make-ring Regexp string pred)))
(setq ring (apply #'max ring)
ring (make-ring
string pred action)))
ring)
(defsubst comint-input-ring-substring-equal (ring regexp predicate)
;; Regexp: same as ring, but it should have a lowercase version.
(let* ((ring (make-ring (if (string-match ring length) length '?-)))
(ring (make-ring (if (
======== SAMPLE 83 ========
buffers in the path, using `dired-load-path1' (which see).
;;
;; For example, if you set `dired-save-directory-files-regexp' (in
;; order to automatically save to the DIR and to its associated file
;; subrescue/merging subdirectory),
;; `save-directory-files-regexp' will also prompt you for a regexp
;; name, which contains all the files that should be deleted from
;; `dired-save-directory-files' (unless you set the variable
;; `dired-directory-files-regexp', which see).
;;
;; To get rid of this, set `dired-save-directory-files-regexp' to nil to no arg.
;;
;; For example, set `dired-load-path-directories' to the directories of
;; your DIRED sub-expansion files in order to load from the directory
;; list of the file (in directories returned by `dir'). Then if you
;; set the variable `dired-directory-files-regexp' to `%s', Dired
;; will try the subdirectory list of the dir in your Dired buffer and
;; replace that list with the list of subdirectories. This is an
;; important feature, but that only takes effect if you use a
;; preformatted, pre-formatted, symbolic link such as ls (which
;; is not loaded by Dired). Setting `expand-file-name-newer' in this
;; direction does the exact same thing for the directory list of
;; the file. (If the file already has a directory, it does not need
;; being expanded.)
If you set `dired-load-path-files' to a non-empty list, Dired
;; will try the contents of all the subdirs of all your Dired buffers,
;; including the *dir* buffer, and do nothing. If you set any of
the above variables in your `:inherit' function, it will
;; throw an error, asking you how to get rid of this error.
;;
;; The file information you get from the command `dired-load-path'
;; is used to get information in the Dired buffer.
;;
;;
;; `dired-find-dirs' will find and search the DIRECTORY in the Dired
;; buffers. It should return an association (with the DIR as
;; the car) between your Dired directory, and the files in your
;; DIRECTORY, including the *dir* buffer. You can find your DIRECTORY by
;; calling the function returned by the functions below:
;;
;; `setq-directory-name' sets the buffer to point at the
;; absolute directory where the Dired buffer is. For example,
;;
;; /dired
;; (dired-locate-file)
;;
;;
;; This function can be called with the variable
;; `setq-directory-name' instead of the function
;; `read-directory-name'. It returns a list (DIRNAME . FILENAME).
;;
;; `setq-directory-name' reads the list of filenames from the Dired buffer, and
;; discards the first list, returning nil.
;;
;; For the rest of this documentation, the following variables and
;; functions (with the argument in parentheses) may be used:
;;
;; dired-current-directory
;; dirname
;; default dirname
;;
;; In other words, the values of the variables
;; dired-current-directory dired-buffer-A and
;; dired-buffer-B both have the form (DIRNAME . POSITION).
;;
;; The variable `expand-file-name-newer' will add,
======== SAMPLE 84 ========
buffers, with full information on the current buffer, and the buffer
(buffer-local) for which this is the preferred value,
(if (or (not current-prefix-arg) (not buffer-local))
current-prefix-arg
(concat current-prefix-arg " "))
(if (stringp buffer-name) buffer-name (buffer-name)))
(save-window-excursion
(with-current-buffer (other-buffer)
(save-restriction
(newline)
(goto-char (point-max))
(when (re-search-forward org-src-block-regexp nil t)
(beginning-of-line)
(setq org-src-block-regexp (match-string 2)))
(org-src-block-limit)))
(goto-char (point-min))
(when (or (not buffer-name) (not (match-string 1)))
(delete-file buffer-name)))))
;; When editing a block or the like, we use `org-mode-fill-paragraph'.
;; See the comment above for more details.
(save-window-excursion
(if org-edit-comment-line-mode-line
(progn
(save-excursion
(goto-char (point-max))
(while (re-search-forward "\\(.*\\)" nil t)
(setq fill-column (string-to-number (match-string 2)))
(goto-char (point-min))))))
;; Mark all lines that are unbound, as being invalid.
(goto-char (point-min))
(while (re-search-forward "_\\^_\\." nil t) (forward-line)))
(widen)
(beginning-of-line)
(beginning-of-line)
(setq truncate-lines t)))
(defun org-edit-comment-line-mode-line (&optional fill-column targ))
(defun org-edit-comment-line ()
"Switch to a mode line, with one line per line.
When this function is called from a function (see `org-funcall-functions'),
it sets a mode line to the value appropriate for `org-read'.
E.g.,
(add-hook 'post-self-insert-hook #'org-read)
will only set one line, regardless of how many Org blocks will be in the buffer."
;; This is useful when in Org mode to switch to another buffer
;; while editing the comment line. However, it has been
;; shown that this is an annoying problem.
;; Eg, if the line ends on a C, and one of B in a footnote comment,
======== SAMPLE 85 ========
buffers.
(if (or (not (string= filename "file.tar"))
(not (file-remote-p filename 'nowarn)))
'dir
(let ((filename-regexp (concat
;; `file-attributes', if known, will get
;; `dir-attributes' in a proper write write.
(if (file-attributes filename-regexp) ; if not in a directory it's
;; not known for this file, get the directory name.
"\\.dir"
filename-regexp))
(name (substring str 0 (match-beginning 0)))))
`(progn
(file-remote-p ,filename-regexp)
(unwind-protect
(apply #'call-process arg nil t)
;; If we have no user dir, it's a port.
(if (eq major-mode 'coding-system-type)
(apply #'call-process "rcirc" t nil nil nil
,filename))
(run-hooks 'rcirc-after-load-hook)
(set-buffer buf)
,name))))
(defun run-hooks (function &optional arg)
"Create and use `rcirc-login-hook' to prompt for user and port names of
a IRC server."
(let* ((default-directory
(or (file-name-directory default-directory)
(make-temp-file
(expand-file-name "rcirc-" d-server-modes-manual
;; No user names and ports.
(buffer-substring (point-min) (point-max)))
(and (stringp (car default-directory))
(list (file-local-name
(file-name-nondirectory default-directory)
default-directory)))
(and (file-remote-p default-directory)
(list (expand-file-name "rcirc-" d-server-modes-manual)))
(and (file-remote-p (file-truename default-directory))
(list (file-local-name
(file-local-
======== SAMPLE 86 ========
buffers, the user is asked for a single
buffer whose name ends with a single `\\[.'
(Note: use a \\=` in these for non-standard Emacs
buffers, for example). See the help for this variable
`edt-menu-buffers-to-save' for further details."
:type 'boolean :group 'edt-help)
(defcustom edt-default-menu-list nil
"List of commands bound to the Edt customization buffer.
The value is a list (MAKE-WORD . BUFFER), where MAKE-WORD is the
text of a command and point is at the beginning of the line beginning
with `edt-name' (`:name').
This variable is local to each major mode, and overrides other variables
in `edt-menu-list-mode'. By default Edt's mode is the buffer
mode-specific buffer-local value. Other modes override this variable.")
(make-variable-buffer-local 'edt-default-menu-list)
;;;###autoload
(defcustom edt-default-menu-list-buffers
'(("\"Edt Menu\""
["Insert" (":name" :value 1 "Name")
"--" --
:help "Insert text, prompting for user name and version and
files to save." --the-help-echo "Find file to use: "]
:type (let ((default-directory (file-name-directory
,file-name-as-directory)))
(if (buffer-file-name) default-directory
default-file)
(insert-file-contents default-directory))))))
'(setq edt-default-menu-list-buffers (append edt-default-menu-list-buffers
(list))
:style toggle :selected edt-default-menu-list-buffers))
;;;###autoload
(defcustom edt-default-menu-list nil
"List of default Edt entries.
An edt menu is a list of menus which can have elements. The
command that looks for a menu item and returns that item is
called with two arguments:
WORD_MENU (the item that is to be saved, the default menu),
and
WORD_MENU (the name of the menu, including this menu line).
These are the default Emacs commands for a list of menus.
The commands are not allowed to modify the list. If the command
they are given should change the list, then they are not allowed to
kill or change the variables the list contains. The reason why
this is important is that while the command `save-buffer' uses
the selected variable, it may be used outside of the selected buffer,
so it cannot be bound to a buffer-local variable.
You can set this variable dynamically by using
the syntax of `list (edt-default-menu-items'). For example,
;;
(add-to-list 'edt-menu-buffers-to-save
(list '("Edtmenu" "--" edt-cmd "Edtmenu.el")
"--")
")."
(list '("Edtmenu" "--" edt-cmd "Edtmenu.el")
======== SAMPLE 87 ========
buffers
("graphics" . "n"))
("calendar" . "o" ?ş)
("calendar-d &" . "g")
("calendars" . "f" -4)
("calendar" . (n nil "n" -1)
"o" -1)
("dicalendar" . "of" -1)
("diary" . "x" ?Å¡)
("diary-anniversary" . "xf" -1)
("diary-of-moon" . "xg" ?Ŗ)
("diary-of-moon-entry" . "xg" ?Û)
("diary-of-fortnight" . "xy" ?庀)
("diary-of-moon" . "xy" ?è)
("diary-of-moon" . "xy" -1)
("diary-of-summer" . "xm'" ?ñ)
("diary-of-year" . "xm" -1)
("diary-of-month" . "xz" ?á)
("diary-of-" . "m" ?m")
("y" ?亁)
("n" ?亂)
("n/y" . "n")
("nn" . "n"))
"Default diary entry type.
See `diary-entry-alist'."
:lighter "Diary" :keymap calendar-diary-mode-map
(if (memq language '(time-and-a-sorrow time-and-e-sorrow))
(format "%s" (get language 'calendar-b-string-format)))
(if (memq language '(time-and-a-sorrow time-and-e-sorrow))
(format "%%d~%s" (get language 'calendar-b-string-format)))
(interactive (list (if (memq language '(time-and-a-sorrow time-and-day-and-moon))
'("&diary")))
(calendar-increment-month month year -6)))
;; The diary-extract-date function.
;; This is currently not used. See http://www.diaryoflurker.de/diary-of-moon.
;;;###autoload
(defun diary-extract-year-from-string (string)
"Return a numeric number which represents the year of the date in STRING
that is returned by the function above."
(concat (calendar-absolute-from-gregorian string)
(calendar-iso-date-string string)
"-"))))
;;;###autoload
(defun diary-date (&optional date)
"String diary entry date.
Returns string if DATE is not negative, or nil if date is positive."
(let (found)
(diary-set-printed-month date (if calendar-date-style 'day month year))
found))
(defun diary-extract-month-name (&optional date)
"Extract the name of the date after which the month name is displayed.
Only works if `diary-print-month-name' is non-nil."
(let ((name (calendar-extract-day-name-function calendar-date-style)))
(when name
(format "%d" (diary-extract-month-name (+ date diary-day-list)))
(calendar-dlet* ((diary-date diary-date)
(date-name-array
(calendar-extract-day-name (calendar-extract-day-from-
======== SAMPLE 88 ========
buffers (a)
`(if (= ,(and viper-c-show-command-hook viper-c-show-cmd-hook)
;; Maybe just run the hook now?
(= ,(and viper-c-show-command-hook viper-c-show-cmd-hook)
:timeout 0))
;; Maybe also switch to a new buffer, even if it's already in one, and
;; we're finished.
(unwind-protect
(progn
(setq viper-current-buffer buffer-A)
(set-visited-file-modtime
(if (buffer-modified-p) 0 100000)
(let ((buf-A1 (current-buffer)))
(when (buffer-modified-p)
(rename-buffer buf-A1 t)
(when viper-show-command-hook
(delete-file buf-A1)
(set-buffer buf-A1)
(set-buffer buf-A1)
t)
(set-buffer buf-B1)))
;; If we're trying to delete files, don't make VIM and kill
;; the buffer. Save it as `new-buffer' for later use.
(let ((cursor-in-echo-area nil))
(kill-buffer new-buffer))
(set-buffer-modified-p nil)))
(set-buffer-modified-p nil)))
(set-visited-file-modtime
(if (null viper-C-show-command-hook)
(with-current-buffer viper-C-show-buf
(let ((buf-A1 (if (buffer-modified-p) 0 100000))
(buf-A1 (current-buffer)))
;; If the last viper-C-cmd was the same, kill that buffer
;; now.
(kill-buffer buf-A1)))
(or (buffer-local-value 'C-C-show-command-hook
(current-buffer)))
(kill-buffer buf-B)
; We want a buffer local value
(when viper-C-C-show-cmd
(with-current-buffer viper-
======== SAMPLE 89 ========
buffers
(and (= 1 end)
;; Use `end' instead of end, unless a previous
;; line ends with more than that number.
(or (zerop (+ end (current-column))))
;; In case we didn't read the line, read the end of it.
(if (or (re-search-forward
(concat "*"
(regexp-quote (or (match-beginning 0)
(match-end 0))
(or
"From \\2"
(match-beginning 0)
(match-end 0)) "."))
1 (or (match-end 0) 1))
(and (> end (current-column))
;; Go past the end. Note: this will
;; only work on line 0.
(not (looking-at "\\( \\|$\\)\\s-*$"))))
(and (= start (point-min))
(looking-at "\\(\\.\\) *\\( \\|$\\) \\(\\s-*\\)")
(goto-char (match-end 0)))
(> begin (- start (current-column)))))))))))
;; Add an element to `org-agenda-show-function'.
(defcustom org-agenda-show-function
'org-mode-expand-all-or-one
"Function that expands all or some elements to a single item.
This function takes arguments as strings and expands to the item
or a list of items of the same type."
:group 'org-agenda
:version "24.4"
:package-version '(Org . "8.0")
:type 'function)
(defcustom org-agenda-exclude-items-per-subtree 'org-agenda-exclude-item
"The regexp allowed in exclusions items.
A regexp may also match items within a TODO list. See
`org-agenda-show-list' for details on the regexp and the
results it yields."
:group 'org-agenda
:version "24.4"
:package-version '(Org . "8
======== SAMPLE 90 ========
buffers.
t To enable these, invoke `gnus -m ', if a prefix arg is given,
and then enter `--enable-threads'.
In order to set gnus-thread-sort-function, add the following to your .emacs file.
\(fn &optional ARG)" t nil)
(autoload 'gnus-thread-sort-number-and-difference "gnus-thread" "\
Return a number suitable for sorting the articles in the current thread.
If `gnus-thread-sort-function' is an integer or is nil, the default algorithm is
to create a new thread. If `gnus-thread-sort-function' is nil, the default
function is not used. You can set the variable `gnus-thread-sort-function' to a
function which returns a number suitable for sorting the article.
If prefix argument ARG is non-nil, use gnus-thread-sort-function instead.
With no prefix argument, it will print the number, in the echo area.
Also, if `gnus-thread-sort-function' is `auto-max-revert', it will not use
the article's default sorting method.
The default sorting behavior can change depending on the `thread-type'.
See `gnus-thread-sort-function' for the meaning of these functions.
\(fn &optional ARG)" t nil)
(autoload 'message-number-to-field-string "gnus-summary" "\
Make a message message string that can be displayed upon a summary.
If buffer is read-only, prevent calling `message-uninteresting-flag'.
The message string can also specify a description function (`imenu').
To display the message in a buffer, set `message-buffer-show-function' to
`gnus-message-buffer-list'." t nil)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "gnus-summary" '("gnus-article-")))
;;;***
;;;### (autoloads nil "glob" "progmodes/glob.el" (0 0 0 0))
;;; Generated autoloads from progmodes/glob.el
(autoload 'glob-mode "glob" "\
Major mode for glibc/glob.
This mode is a global minor mode for use in lisp programs that
require the `current-buffer' parameter, or provide a non-nil
use-first-nonmenu-action property for programs that create
glibc/glob files (in that order) that do not contain
keyword and keyword-like functions. When called
from Lisp, use the current major mode and set `initial-buffer-default-syntax'
to that of `buffer-name'.
Also, whenever the function `glob-next-nonterminal' returns
nil (i.e. no prefix argument is possible for that function), this
function is available in that buffer (unless the function
`glob-next-nonterminal' returns nil) and will return nil when the
next non-terminal in the file is found.
The buffer is displayed upon exit, and the value returned is the buffer
specified by `message-show-list' or `message-fetch-msg'." t nil)
(autoload 'message-setup-glob-mode "glob" "\
Major mode for using the buffer-local variables `message-buffer-list',
`message-news-prefix', and `message-reply-prefix'.
This mode is designed to be invoked from Lisp functions; it is
non-destructive and should not be invoked interactively. See the
function
\(add-hook 'message-send-hook #'message-setup-glob-mode) for details.
See `message-buffer-list'." nil 'message-buffer-list)
(autoload 'message-send-mail "message-util" "\
Sends outgoing mail directly to `*Messages*' buffer.
If buffer is read-only, don't try to edit it." t nil)
(autoload 'message-display-list "message-util" "\
Display buffer `*Messages*'.
If buffer is not read-write, display it in an empty buffer.
If buffer is writable, make sure that it is
======== SAMPLE 91 ========
buffers
(let ((old-fmt-regex (concat old-fmt-"\"\\|\\[\"\\(?:-?\\):\"")))
(setq old-fmt-regex (concat old-fmt-"\\|\\[\\\"\\(?:-?!\\):[:x:]")))
(setq old-fmt-regex (concat old-fmt-"\\|\\[\\\"\\(?:-?\\):\\(?:-?[0-9]+:\\(?:-?\\)")))
(setq old-fmt-regex (concat old-fmt-"\\|\\[\\\"\\(?:-?\\):")))
(setq gnus-agent-broken-group-prefix-regex nil
gnus-agent-group-broken-prefix nil
gnus-agent-new-prefix-regex nil)
;; Find the first group in the group file name that contains "\\{*\\(%1\\)?\\s-*\\(?:-?\\s-*\\)?\\(?:-?\\s-*\\)?\\(?:-?\\s-.*\\)?", and replace that
;; by the new match.
(let ((new-match-prefixes gnus-agent-broken-group-prefix-regex))
(while (setq new-match-prefixes (sort new-match-prefixes
gnus-agent-broken-group-prefix-match))
(setq gnus-agent-broken-group-prefix-regex
(read-string (format "Match %s from %s\n" new-match-prefixes)
t)))
(setq gnus-agent-broken-group-prefix-regex
(concat gnus-agent-broken-group-prefix-regex
(read-string (format "Match %s from %s: "
gnus-agent-broken-group-prefix-regex))
t))))
;;; Code:
(require 'gnus-sum)
(defcustom gnus-agent-group-mode-message "Group name is alive"
"Show group name in Message mode."
:version "22.1"
:group 'gnus-group
:group 'message
:link '(custom-manual "(gnus)Toggle Group Mode")
:type '(choice
(const :tag "Show group name" gnus-group-mode-message)
(const :tag "Hide group name" hide-group-mode-message)))
;;; Functions:
(defun gnus-agent-request-read-group-buffer (group buffer-name)
"Get `gnus-agent-read-group-buffer' bound to a buffer."
(let* (bufname
(buf (get-buffer-create (format "%s:%s"
gnus-agent-read-group-buffer
bufname)))
======== SAMPLE 92 ========
buffers,
and `font-lock-enable-fontification'.
You can further set `buffer-display-table' to nil to make a buffer into a
buffer display table instead. This variable may also be set in a
local variable which Emacs needs to call from."
:type '(choice (const :tag "Disable window system fontification" nil)
(const :tag "Disable frame system fontification" frame-system-fontification)
(const :tag "Off" t))
:group 'font-locks)
;;;###autoload
(defcustom font-lock-verbose-mode-hook nil
"Hook called by \\[font-lock-print-cite-on-region] to be run as the minibuffer when font-lock is
off."
:type 'hook)
(defvar font-lock-mode-line-faces t
"Control whether font-lock should display any fontification, or not.")
;;;###autoload
(defcustom font-lock-fontify-common-faces
'((?\n . font-lock-fontify-cite-on-region)
(?\f . font-lock-fontify-fontified-text)
(?\s . font-lock-fontify-region)
(?\C-.] . font-lock-fontify-region-default)
(?\M-.) . font-lock-fontify-region-default)
;; FIXME: maybe do a function, and call it?
;; For something that might look weird, this is easy: just turn it on.
(?\s
(mapcar
(function (lambda (face)
("\C-u" "<!--")
(cond
((eq face 'c++-mode)
'font-lock-fontify-region-default)
((eq face 'c++-mode)
'font-lock-defvar-default)
(t
'font-lock-variable-name-face)))))
"Fontification faces used in `font-lock-mode'.")
;;;###autoload
(defvar font-lock-defaults nil
"List of key bindings for default fontification functions.
A function in the list is called with two arguments, a key that indicates
what function is to be used and a string representing the default font
buffering order. The default fontification function is called with three
arguments, a key, a string of the form (FROM . CONT) with two
parameters, which specify the fontification order to be used. If there are no
other fontifying functions and FROM doesn't specify a key, the default fontification
command is called with three arguments (FROM . CONT).
To enable fontification in your buffers, use `set-default', which
also supports variable highlighting. In such a case, you may want
to re-use the fontification key.")
(defcustom font-lock-fontify-mode-hook nil
"Hook that should be run when fontification mode is turned on.
Set to nil if fontification doesn't seem to work when fontification mode is off."
:type 'hook)
(defcustom font-lock-fontify-region nil
"If non-nil, Font Lock mode highlights the region around point."
:group 'font-lock)
(defvar font-lock-fontify-cite-on-region-mode-hook nil
"This hook is called when fontification mode is turned on and is run
with a regular invocation of `font-lock-fontify-region-hook':
`font-lock-show-citation-fontify-function' is bound to an
interactive function.
`font-lock-fontify-cite-fontify-on-region' is bound to
======== SAMPLE 93 ========
buffers. You can do
;; ;; (let ((b (point)))
;; (or b (throw 'found "No match"))))
;; `(let ((match (lambda (b &rest _s))
;; ((and (not (stringp b))
;; (null match))
;; (or b b)
;; (throw 'found "No match"))
;; ((and (not (or (file-exists-p match)
;; (boundp (find-file-name-noselect match)))
;; (eq (find-file-name-noselect (car match))
;; (file-name-directory))))
;; (message "Error parsing match: %s" match)
;; (error "Error Parsing match: %s not found" b))))
;;;###autoload
(defun semantic-find-buffer-arglist (arglist)
"Return a list of all files with NAME ARGLIST.
If NAME is nil, use the default value of `semantic-lisp-find-file-arglist-defaults'
With 2nd arg, return the list of possible results (if any)."
(interactive "fL FILENAME1 FILENAME2 ARGLIST")
(let ((result (eval (funcall semantic-find-function arglist))))
(if result
(error "File NAME error: %s, found: %s"
(semantic-lisp-find-file-arglist-defaults arglist nil))))
(let ((default-list (find-file-in-directory-p filename
result
(current-buffer))))
(if default-list
(apply 'nreverse default-list)
result))))
(provide 'semantic/grammar)
;; Local variables:
;; generated-autoload-file: "loaddefs.el"
;; generated-autoload-load-name: "semantic/grammar"
;; End:
;;; semantic/
======== SAMPLE 94 ========
buffers
;; to go to "inhibited" status (i.e.,
;; the current file doesn't have a queue, or
;; a file with a queued status file hasn't got a queued
;; status).
(setq buffer-file-name
(cond ((buffer-file-name)
(not buffile-names-or-targets)
(buffer-file-name))
(t
(error
(message "Buffer `%s' does not exist and needs to be deleted, abort"))
buffile-names-or-targets
)
;; In buffer name, we need to ask why we
;; have to insert this buffer as empty.
((and buffer-file-name buffer-name)
;; Look again, so we don't need to call buf-create again.
(let ((buf (current-buffer)) ; bufname of buffer,
(name nil)
(posbuf (get-file-buffer name))) ; buffername of buffer
(buf-name bufname)
;; It seems that we have not found the current file.
(if (and buffer-file-name name)
(insert-file-contents name)
(progn
(if buf (delete-file name))
(set-buffer bufname))))
(t (error "")))))
(set-process-filter proc bufname)
(set-display-table-func proc bufname)
(apply #'process proc)
(setq bufname (buffer-name bufname)))
(if (and (not (string-match "PACKAGE/" file))
(string-equal
(file-name-nondirectory (file-attributes file))
bufname))
(progn
======== SAMPLE 95 ========
buffers
(while (setq n (pop norecursables))
(setq list (nnheader-add-archive-to-man t)
nnmail-files-directory nil)
(setq files (cons (setcar (nthcdr (1- nnmail-file-list) files)
(cons (copy-sequence files)
(car files)))
files)))
(goto-char (point-min))
(while lists
(push (car lists) lists))
(unless (member (car files) lfiles)
(nnmail-message 5 "Checking archive file %s" ;; nnmail-file-directory)
(when (member (list files) lfiles)
(let ((file (car files)))
(when file (setcar file (nnheader-find-file file)))
(when (and (eq (length files) 1)
(nntp-server-p 'OpenPGP))
(progn
;; OpenPGP isn't registered at the time we
;; see this message.
;;
(setcar (nthcdr n files)
(cons (copy-sequence files)
(nnmail-parse-signature))))))
;; Delete list.
(setq lists (cdr lists)
lists nil)
(while lists
(nnmail-remove-header (car list)))
(setcar (nnmail-parse-signature (car lists)) nil)))
(nnmail-message 5 "Removing empty headers...")))
(if unread
(nnmail-unselect-article
(gnus-agent-article-name "Unsuitable" "Unsuitable
======== SAMPLE 96 ========
buffers."
:group 'edt-sparse
:initialize 'custom-initialize-default
:link '(custom-manual "(edt) Top")
:link '(emacs-commentary-load-links
:included (lambda (info _match _match)
"Find the line that matches the file name."
)
:version "24.1"
:type 'string)
(defcustom edt-highlight-highlight-files
'("*Gitfile" "*SCCS File" "*SCCS Subfile" "*File(s)")
"List of directories that are affected by highlighting (and highlighting) commands.
This variable is only relevant if highlighting commands are installed on the
system which uses this variable."
:group 'edt
:link '(custom-manual "(edt) Top")
:link '(custom-manual "(edt) Top")
:group 'edt)
;; ======================================================================
;;; Utilities
;; ======================================================================
;; ======================================================================
(define-minor-mode edt-mode
"Toggle ETABILITY in the speedbar (Buffer Selection and Markup) buffer (Buffer Selection and Markup)
Buffer Selection and Markup. When non-zero, enable ETABILITY mode."
:global t :group 'edt
;; Don't enable this in Emacs or if the window system uses it.
(defalias 'edt-select-buffer 'selective-highlight)
(defalias 'edt-select-buffer 'selective-select-file)
(defalias 'edt-select-buffer 'selective-select-file-default)
(defalias 'edt-set-buffer 'set-buffer)
(defalias 'edt-set-buffer 'set-buffer-name)
(defalias 'edt-set-buffer 'set-buffer-file)
(defalias 'edt-set-buffer 'set-file-name)
(defalias 'edt-set-buffer 'set-file-name-default)
(defalias 'edt-set-buffer 'set-file-name))
;; ======================================================================
;;; Utilities that speedbar can use in case buffer values change.
;; ======================================================================
(defun edt-checkin ()
"Check for update of buffer with point at end of buffer in the current frame.
Update mode-line according with this function."
(interactive)
(let ((buf (edt-checkin ())
(pos (point-min))
(inhibit-read-only t)
found pos)
;; Return value.
(save-match-data
(setq pos (point))
(when buf
(setq pos (point))
(cond
((consp edt-checkin-file-list)
(setcar (funcall buf)
(save-match-data (buffer-substring pos (1+ pos))))
((eq found t)
;; If there are already the current buffer positions, return the buffer found on the
;; end.
nil
;; If not, throw an error; otherwise return nil.
;; Move to the start-point of the current buffer, which positions the end.
(progn (backward-char 1)
(if (and (re-search-forward edt-markup1-or-at-eol-re-p-eol-re)
======== SAMPLE 97 ========
buffers (C-h v)
;; (v 1)
;; v - (1)
;; v - (2)
;; v - (3)
;; v - (4)
;; v - (5)
;; v - (6)
;; v - (8)
;; v - (9)
;; v - (9)
;; v - (11)
;; v - (11)
;; v - (12)
;; v - (14)
;; v - (16)
;; v - (17)
;; v - (18)
;; v - (19)
;; v - (20)
;; v - (21)
;; v - (23)
;; v - (24)
;; v - (25)
;; v - (27)
;; v - (28)
;; v - (31)
;; v - (34)
;; v - (35)
;; v - (47)
;; v - (51)
;; v - (54)
;; 1)
;; v - (1)
;; 1 - (2)
;; v - (2)
;; v - (3)
;; v - (4)
;; 1 - (5)
;; v - (6)
;; v - (7)
;; 1 - (8)
;; 2)
;; 2 - (7)
;; 2 - (8)
;; 3)
;; 3 - (9)
;; 3 - (9)
;; 4)
;; 4 (2)
;; 4 - (9)
;; 4 - (10)
;; 4 - (9)
;; 5)
;; 5 (3)
;; 5 - (11)
;; 5 - (5)
;; 5 - (10)
;; 6)
;; 6 - (11)
;; 6 - (7)
;; 6 - (6)
;; 7)
;; 7 (3)
;; 7 - (5)
;; 7 - (4)
;; 7 - (7)
;; 8)
;; 8 - (5)
;; 8 - (8)
;; 8 - (8)
;; 9)
;; 9 . (1)
;; 9 - (1)
;; 9 - (1)
;; 9 - (1)
;; 9 - (1)
;; 9 - (7)
;; 9 - (1)
;; 9 -- (1)
;; 8)
;; 8 - (1)
;; 8 - (1)
;; 8 - (1)
;; 8 - (1)
;; 8 - (1)
;; 8 - (1)
;; 8 - (1)
;; 9)
;; 9 - (1)
;; 9 - (2)
;; 9 - (2)
;; 9 - (1)
;; 9 - (1)
;; 9 - (1)
;; 9 - (1)
;; 7)
;; 7 - (5)
;; 7 - (5)
;; 7 - (2)
;; 7 - (5)
;; 7 - (3)
;; 7 - (5)
;; 8)
;; 8 - (1)
;; 8 - (1)
;; 8 - (2)
;; 9)
;; 9 - (1)
;; 9 - (1)
;; 9 - (1)
;; 9 - (1)
;; 9 - (1)
;; 9 - (1)
;; 8)
;; 8 - (1)
;; 8 - (1)
;; 8 - (2)
;; 8 - (2)
;; 8 - (1)
;; 8 - (2)
;; 8 - (1)
;; 6)
;; 6 (1)
;; 6 (1)
;; 6 - (5)
;; 6 - (2)
;; 6 - (2)
;; 9)
;; 9 - (1)
;; 9 - (1)
;; 9 - (2)
;; 9 - (1)
;; 9 - (2)
;; 9 - (2)
======== SAMPLE 98 ========
buffers, because Emacs will not find the current line's header file on the remote server."
(save-match-data
(save-window-excursion
(let (ret)
(setq ret (re-search-forward "^filename:" nil t))
(when (not ret)
(setq ret (replace-match (buffer-string) nil nil 0)))
(delete-process ret)
(sit-for 0)
(let ((gnus-server-methods nil))
(delete-file (get-text-property (point) 'gnus-server-method))
(gnus-set-connection-property t 'gnus-server-current-directory server))))
(gnus-barf-if-not-control-buffer))
(defun gnus-request-copy (url accept-encoded-word)
"Ask URL if it is acceptable to copy, and if it is, copy it.
If optional second argument ACCOMPLY, copy what you send, and accept any
words which don't end in a backslash character.
If `url-copy-no-copy' is non-nil, the current buffer is made available.
Accepting a backslash letter is like `let*' but may also be like
`while-lisp-expand-wildcards'. So this may well yield some characters
with a special meaning that are not handled by the text-decoders
that `url-copy-no-copy' expects."
(interactive "*sRequest URL: ")
(let* ((filename (url-filename url))
(inhibit-read-only t)
(contents
(if (and (stringp url-filename)
(not (string-match "^\\." (url-filename url)))
(not (equal (url-filename url) "." nil nil nil)))
(concat filename ",")
(setq contents (file-truename contents)))
(from-url (url-filename url))
(to-url (url-filename url))
(header (concat (mail-fetch-field "Message-ID")) "\n"))
(if header
(unless (member filename gnus-default-headers)
(setq header t)
(when (not (gnus-fetch-field "Content-Type"))
(error "%s does not have an extension" header))
(setq headers (url-unhex-string (or to-url ".")))
(setq headers (concat headers ".")))
;; We might need to use some other method to decode the file.
(let ((case-fold-search t))
(dolist (url headers)
(setq header (url-fetch-field "message-id" nil t))
(if (string-match "\\`\\s-+From \\(.*\\)\\s-+To \\(.*\\)" header)
(setq from-url (url-filename url))
(setq from-url (url-filename url))
(setq contents
(concat contents
======== SAMPLE 99 ========
buffers are used as if they're current.
(setq gnus-sort-unseen
(if (or last-use-time 1)
(gnus-group-get-new-news group))
(when (and last-use-time
gnus-group-current-group-is-invalid
(< gnus-group-current-group (point-max)))
(gnus-update-mode-line)
(gnus-group-read-event
event nil nil nil
'nnmail-sort-unseen (with-current-buffer nnmail-server-buffer
(current-buffer)))
(gnus-delete-forward-line 1))))
(defmacro gnus-group-group (&rest body)
"Run BODY with group, the list of all articles in this group."
`(progn
(let ((progn (gnus-group-read-article nil nil nil nil nil nil nil nil t)))
(gnus-group-read-article '(t nil nil nil nil nil nil nil nil t nil nil nil nil nil nil nil nil nil nil nil nil nil t))))
(defmacro gnus-group-set-cached-marks (&rest body)
"Run BODY with group, the group of articles that have been modified."
`(progn
(set-buffer gnus-group-buffer)
(gnus-group-goto-group 1))
(or (and (not gnus-group-default-score)
(not gnus-group-automatic-auto-update))
(progn ,@body)))
(ert-deftest gnus-group-kill-emacs ()
:tags '(:causes-redisplay)
"Test that the `kill-emacs-query' is non-negligible"
:tags '(:causes-redisplay)
(with-current-buffer (find-file-noselect (buffer-file-name))
;; The buffer doesn't exist, so we kill the buffer.
(kill-buffer (find-file-noselect (buffer-file-name))))
(let ((gnus-quit-hook 'kill-emacs-query-function t)
(gnus-run-hooks 'gnus-group-kill-emacs-query-hook)
(article-coding-system 'latin-7-point-alist)
list found)
;; We have to do some cleanup. I think it is a good idea to
;; make such a hook take one form and cleanup the other two.
(gnus-run-hooks 'gnus-article-prepare-hook)
(gnus-run-hooks 'gnus-group-prepare-hook)
(with-current-buffer nntp-server-buffer
(goto-char (point-min))
(cond
;; We have to set up nntp-server-buffer and nntpserver-host-properties to
;; work well with Emacs. I think it is right to put the
;; buffer-name on an nntp server.
((not gnus-server-buffer)
(gnus-buffer-local-file-coding-system))
((not (buffer-file-name gnus-group-buffer))
(gnus-buffer-default-buffer))
======== SAMPLE 100 ========
buffers will not
;; work with the XPM files. This will just remove
;; it from Emacs' default font setup list.
(when (and (not (eq system-type 'ms-dos))
;; For DOS or Windows and MS-DOS
;; The XPM files must not use font-locking, for some
;; reasons.
(setq font-lock-fontified t))
(progn
(set-compilation-error-regexp
nil
(make-string
(char-to-string
(if (eq system-type 'windows-nt) "-" ".."))
t)
,@(and c-font-lock-keywords-1 (if (eq c-lang 'c++ 'java)
c-lang
"C++")))
,@(and c-font-lock-keywords (if c-font-lock-keywords
(if (eq c-lang 'c) c-lang
"" c-lang)
(if c-lang
c-lang "\C-a")
(if c-lang
(if c-lang
(c-lang-const c-lang-ver-func)
(c-lang-type-assoc-list c-lang c-lang-ver-func))))
(c-remove-trailing-spaces)
(c-fontify-syntax-propertize c-syntactic-context c-font-lock-syntactic-faces)))))
(defcustom compilation-command
;; Default one. If it has the wrong value, call `font-lock'.
(append (list
(default-value 'font-lock)
'(c-syntactic-context c-font-lock-syntactic-faces)))
======== SAMPLE 101 ========
buffers.
(defvar gnus-agent-use-long-newsgroups t
"Whether long newsgroups should be activated.
The default is to only enable these by default. If this is
nil, then gnus uses some `gnus-agent-use-long-newsgroups' function
to force activating."
:group 'gnus-group-deletion
:link '(custom-manual "(gnus)Group Deletion")
:type '(choice (const nil) (const t) (const integer) (const number))
:risky t
:version "23.1" ;; No Gnus
:set (lambda (variable)
(set var (symbol-value variable)))
:group 'gnus-group-deletion)
(defcustom gnus-agent-use-long-body nil
"Whether to activate the agent when you are not in the body of a message.
If t, then gnus will activate it when no other message is using
the agent. A number of other variables to activate are:
magentviewviewviewview* . If true, gnus will display more view
views when the user is not in the body of a message"
:group 'gnus-agent
:link '(custom-manual "(gnus)Agent Deletion")
:type '(choice (const nil) (const t) (const number))
:risky t
:version "23.1"
:set (lambda (variable)
(set var (symbol-value variable)))
:group 'gnus-agent)
(defvar gnus-agent-use-regexp nil
"Whether to activate the agent when the regexp matches something you say.
If t, then gnus will activate it when non-whitespace-syntax,
in which case nothing happens.
A small set of other variable values to activate are:
magentviewviewview* . If true, gnus will view more
viewistic viewisticview* . If true, gnus will display
more viewisticviewview* (in
the same way as other messages, without sending them to the
agent.
A number of other variable values are:
magentviewviewview* . If true, gnus will view more viewistic
viewisticview* . If true, gnus will display
more viewisticview* (in
the same way as other messages, without sending them to the
agent.
A number of other variables are:
magentviewviewview** . If true, gnus will view more viewistic
viewisticview* . If true, gnus will display more viewistic
more viewisticview* (in
the same way as other messages, in an empty buffer).
A number of other variables are:
magentviewviewview*display-view-only . If true, gnus will view the only
display that I think is the only
======== SAMPLE 102 ========
buffers or to display the
buffer in a separate window."
(interactive)
(let ((window-combined-p t))
(unless (and (get-buffer "*Marked Marked Marked Marked Marked Marked Marked Marked*")
(not (numberp buffer-file-name)))
(condition-case nil
(dolist (mark mark-markers)
(when (and (marker-buffer mark-marker)
(marker-buffer buffer-marker)
(goto-char (point-min))))
(goto-char (point-min))
(insert mark-marker))
(error nil))))
(defun display (&rest args)
"Show the text with `display:' in it.
A \"display:\" menu item has the form (FUNCTIONNAME ARGS...).
A display of a sequence of \"lines\", \"columns\" \",\" in size is possible.
The elements of the menu are as listed in `display-filter-functions'.
FUNCTIONNAME specifies the function to call for each line's display
in that display \(and its argument). It may have one or
many entries with the format: ARGS....
A sequence of \"lines\", \"columns\" \",\" in size is possible with this
function. This is done by setting the variable `display-filter-functions' to
always return the same function.
ARGS is the argument to call in display's buffer.
It is not the last argument, or a string to be returned.
This function uses the minibuffer to display the display. In this
place, ARGS may be a list of arguments, as in
:\n
\(fn FN &optional ARGS)"
(declare (obsolete customize-display-filter-functions "24.1"))
(let ((filter (make-symbol "display"))
(args (list (cons 'function (cons nil arg)))
(t 0))
(with-current-buffer (apply #'make-hash-table :size (length args) :ok t)
(if (> (length (nth 0 args)) 16)
(error "Format string (%s...) is too long" args))
;; It happens that we do not support the `:unspecified' feature!
(goto-char (point-max))
(while (setq
;; When custom-view-mode is enabled, `display-filter-functions' are
;; only in the frame.
(widget-spec
:filter (cons 'invisible
(mapcar
(lambda (widget)
;; If WIDGET is on a new line, call it
;; to show the display
(widget-field-value widget))
======== SAMPLE 103 ========
buffers, but this will require the
;; c-forward-sws to have been modified here and to accept a newline
;; and a \\ rather than a space.
;;
;; Acknowledgments of feedback/bug reports that apply to this version
;; of Emacs.
;;
;; Here are some ideas from Emacs 6.38 (see C-DEL), which seems better
;; since it uses a different convention, but still fails to work properly:
;;
;; (M-x c-forward-sws) <a-char>
;; (M-x c-do-not-pop) <a-char>
;; (M-x c-do-not-pop) <a-char>
;; (M-x c-do-not-pop) <c-forward-line>
;; (M-x c-do-not-pop) <c-forward-line>
;; (M-x c-forward-syntactic-ws) <c-forward-sexp>
;; (M-x c-backward-syntactic-ws) <c-backward-syntactic-ws>
;; (M-x c-forward-single-char forward) <c-beginning-of-line>
;; (M-x c-forward-sws) <a-char> <b-char>
;; (M-x c-forward-syntactic-ws) <c-end-of-sws>
;; (M-x c-forward-syntactic-ws) <c-end-of-sws>
;; (M-x c-backward-sws) <a-char> <b-char>
;; (M-x c-forward-sws) <c-point>
;; (M-x c-forward-sws) <c-point>
;; (M-x c-forward-sws to c-forward-sentence
;; ">" ":") <cdh>") <c-forward-sentence>
;; (M-x c-forward-sentence) <c-point>
;; (M-x c-backward-sentence) <c-point>
;; (M-x c-backward-sws) <c-point>
;; (M-x c-beginning-of-sentence>
;; "^$" <cdh> "<" <A-Char> > ">") <c-beginning-of-sentence>
;; (M-x c-end-of-sentence) <c-end-of-sentence>
;; (M-x c-end-of-sentence to c-forward-sentence>
;; "![^]*[^?]$" "<" <A-Char> ) <c-end-of-sentence>
;; (M-x c-end-of-sentence backward-sentence>) <c-end-of-sentence>
;; (M-x c-end-of-sentence to c-forward-sentence>) <c-end-of-sentence>
;; (M-x c-end-of-sentence forward-sentence>) <c-end-of-sentence>
;; (M-x c-forward-sws) <goto-char>
;; (M-x c-forward-sexp>
;; "<>$" <cdh> "\\[[+]>\\]$" <c-forward-sws> "\\|<?"
;; "\\{(") <c-backward-close-paren>[^'{]\\|\\=" <cdh> "<" )))
;; (C-RET FORMS EXPLANES COMMENT PAGES BUFFERS
======== SAMPLE 104 ========
buffers;
(if (<= (point) start-end)
(setq end-pos (point-marker))
(setq end-pos (max (point-max) (point-min)))
(forward-line (1- end-pos))))
(setq start-end (or start-end (point)))))
(defun org-table-column-width (column width &rest widthlines)
"In TABLE, set column width to WIDTH/WIDTH lines.
With a prefix the number of columns in TABLE
increases by WIDTH/WIDTH lines.
Non-nil argument - non-nil if WIDTH/WIDTH is greater than the
`default' value in TABLE."
(when (numberp width)
(setq width (if (= width columns)
(string-width (org-table-get-field column :type)) width)
width (or width (org-element-property 'column column))
;; We can only set columns by side effects, we need to
;; convert them.
(while (>= (1+ width) column)
(setq columns (1+ columns)))
(while (> (1- width) column)
(let ((start-column (string-width (or width "@") (1- (point-max)))
column-width)
column-width (1+ (org-element-property :end column)))
;; Convert the columns to columns by side effects so
;; a table cell takes priority.
(if (> (< column start-column)
(< column width))
(setq column nil
width nil))
(while (<= 1 column)
(let ((start-column (string-width (org-element-property :end column)))
(indent (org-element-property :indent column)))
(unless (org-string-nw-p contents)
(user-error "No column to fill")))
;; Otherwise it is a table cell.
(setq column-width column-width)))))
(defun org-table-col-width (column width &rest widthfiles)
"Set width to columns in TABLE to WIDTH/WIDTH+1 columns.
This sets the column width to the value in widthfiles,
which will always be the column of the current entry."
(when (<= (plist-get org-table-columns :widthlines) widthfiles)
(setq width (car widthfiles)))
(add-to-list 'org-table-columns-computed nil 'default))
(defun org-table-copy (row &optional column col)
"Copy the columns specified by the current table cell.
Set the current column to COL to the column of the previous entry.
When a new table cell enters a new table,
this function does nothing to set it in the table.
When `org-table-row-width' is not equal to the current width of the
table cell, this function sets the column to the width of the
last entry in the following row."
;; Set width to the value in row.
(setq row nil)
;; Return the current width of the table cells.
======== SAMPLE 105 ========
buffers,
;; and the corresponding CVS files (and the entire
;; working directory).
(goto-char (point-min))
(while (or (funcall (car cvface-regexp-key)) 0) ;Check for CVS keywords
(or (null (car cvs-regexp-key-from-index)) ;Check for submatches.
nil))))
;; We need the match to end with a newline or a newline without
;; the last possible character. But this could fail, since
;; "\\(?:[\n\t ]*")
;;
;; We need the match to start on a blank line. If it doesn't, look for
;; a CVS file to put it in.
(while (and (or (not (zerop (forward-line 1)))
(not (looking-at (concat "\\<" (regexp-quote todo-start))))
(re-search-forward cvs-startup-file-regexp nil t))
(or (not (looking-at "\\(?")) ;Check for submatches.
(not (looking-at "\\(?")) ; check for CVS keywords.
2) ;Check for all submatches.
(not (looking-at "\\(?:[\t ]*?\\)[#\n\t]*"))) ;Check for CVS keywords or "\\(?:[\"&\"]\\)".
(forward-char -1)))
;; Look back at the last line of the last search.
(looking-at
"/[^:/]*/[\n\t ]*:")))
;; When CVS wants to search its `~' or `[^:]*' files, ask whether
;; they need `fileset' and `cvs_search_dir' (and also for `file' and
;; `:~' in CVS files)
(while (and (looking-at cvs-file-key) (not (eobp)))
(skip-chars-forward "^|=>=>=>|;" (point-max) t)
(or (buffer-name (find-file-noselect
(get-buffer-name) (current-buffer))))))
(if (eq cvs-
======== SAMPLE 106 ========
buffers)
;; Don't signal an error. See [R/C for bug#9477].
(let ((str (encode-time 0 (current-time-string 2) nil nil 'rfc822-gtraces)))
(if (time-less-p str (encode-time 0 (current-time-string 82400)))
;; FIXME: A lot of the time loops below below, like #if/while/foreach.
(if (eq last-command t)
;; the old code below has been fixed for now, but some newer compilers.
(progn
(setq str (encode-time str 82400 242400)))
str))
(if (eq last-command 'self-insert-command)
(progn
(goto-char position)
(while (and (< (point) end-marker)
(not (eobp)))
(delete-region (point) end-marker))
(goto-char position)))
(while (not (eolp))
(let ((end (save-excursion
(end-of-line)
(forward-char)
(not (bobp)))
(end-marker) ; if we can't find end of line...
c cb)
(re-search-forward str (point-at-eol) t)
(setq c (or (= (preceding-char) ?\n)
cb -1))))))
(defun read-file-name (prompt)
"Read a file name from the minibuffer.
Like read-file-name, but if there is an existing buffer visiting
its name, and it contains text that can be converted
to a string."
(let ((s eof) (d1 d2) d3 p)
(while (not (eobp)) (setq d1 (downcase (buffer-substring-no-properties
(point) (line-end-position)))
(setq p (point)))
(if (equal (car d3) ?/)
(setq p (buffer-substring p (point))))
(setq d5 (concat (buffer-substring p (point)) p))
(setq d6 (cdr d3) p (1+ p))))
(if (null s) (list s))
(prog1
(read-string prompt
(cons "Save file name to file" p (if s "" s)))
(setq s (if p s)))
;; Write the input file contents to an entry in the minibuffer.
(let ((prompt1 (read-file-name prompt)))
(setq s (read-string prompt1))
(save-excursion
(while s
(setq d1 (concat d1 d1 (buffer-
======== SAMPLE 107 ========
buffers.
;;(message ":user")
;(message ":class"))
(princ "\n")
(when (listp (caar args))
(setq args (cdr args))
(when (or (equal (car args) "")
(equal (cadr args) "")
(equal arg "")
(not (equal (cadr args) " ")))
(princ (concat ":") args)))
(if (null arg) (setq args (pop args)))
(when (setq args (member arg arg-list))
(if (stringp args)
(setq args (list args))))
(if (null arg)
(setq args (sort args (lambda (a b c)
(string-lessp (car a) (car b)))))
(setcdr args (cdr args)))))
(defun org-export-as-list ()
"Append to current buffer the list of list elements.
This puts point at the beginning of the opening
region and closes the closing region.
Argument is the string to be appended to the current buffer.
When called from Lisp this function also takes
the optional PRE-BOOLEMS argument, which is ignored."
(interactive)
(let ((org-ascii-special-heading-p org-ascii-special-heading-p))
(unless (org-ascii--parsing-line 'quote
'((nil t ?\])
(t ?\)))
(error "No list elements here"))
(setq org-ascii-special-heading-p nil))
(let ((old-buffer (current-buffer)))
(delete-overlay old-buffer)
(org-with-silent-modifications
(org-remove-indentation (org-ascii--parse-headline-indentation org-ascii-special-heading-p)))
(org-entry-entries org-level org-format-tag-alist
(org-toggle-keystroke 'org-ascii-show-level)
(org-show-block)
(beginning-of-line)
(beginning-of-line)
(let (done)
;; First parse.
(while (re-search-forward ":[ \t]*\n." org-heading-end-re)
(let ((beg (match-beginning 0)))
(unless (eq (char-before beg) ?[)
(setq done (org-entry-getsyPE arg-list))
(move-overlay old-buffer (point-at-eol) (point-at-bol)
(+ (- (- (point-at-eol) (point-at-bol))
org-element-indentation-level))))
======== SAMPLE 108 ========
buffers, using
the corresponding function. If no such function exists, then find any
existing function using `define-derived-mode' and
define-variable-overloadable-p' (see below).
The function is called with the buffer of the buffer containing the
buffer. In this case, it first calls the function which
will execute the buffer contents, if it is a Lisp object.
\(fn &optional ARG BACKUP-BUFFER)
#'define-derived-mode x-backup-buffer-default-setup-function
(cons (car buffer-var) ARG))
The variable is set to that of the buffer buffer, if any, or nil. In
this case, it is first called with the buffer buffer, if
any, and set the variable to that of the buffer buffer; or if none
except the buffer buffer and the buffer buffer not in the
first element of the list.
This function also creates a new buffer buffer; if it would like
to use the existing buffer buffer, set the variable to that
buffer buffer or nil.
\(fn BUFFER &optional ARG BACKUP-BUFFER &rest IGNORED)" nil t)
(cl-defstruct (x-backup-buffer-default-setup-function
(:lighter "Backup" "BufBuff" "Unbuffered")))
;; Name of the function or symbol for the buffer buffer:
;; `x-backup-buffer-default-setup-function'. This name should not
;; mean either a function or a symbol:
;; `x-backup-buffer-default-setup-function' is for advice,
;; `x-backup-buffer' uses `add-hook' when setting the variable.
("\\`\\[--]\\|--\\'\\(\\[\\[[0-9]+\\]:\\([^][]\\)\\)?\\)" 1 nil cps)
;; `x-backup-buffer' is the default function for advice.
("\\`\\(.*--.*--\\)?\\'" 1 nil cps))
(defun x-backup-buffer-default-setup-function (prefix function)
"Find the function or symbol for the buffer buffer, using PREFIX.
If any function is not allowed, add it to PREFIX and run FUNCTION."
(let ((name (car prefix)))
(if (not (and (plist-get value :backup-buffer-p) (not prefix)))
(x-backup-buffer-default-setup-function
(let ((buffer (if (stringp prefix) prefix (plist-get value :backup-buffer-p)))
(marker (make-marker)))
(unless (derived-mode-p 'x-backup-buffer-default-setup-function)
(x-backup-buffer-default-setup-function prefix function))))
(x-backup-buffer-default-setup-function prefix name function))))
(x-defalias 'x-backup-buffer-default-setup-function
((keym (x-mouse-set-point (car prefix))
x-mouse-set-point (concat "*" (symbol-name key))))
(defalias 'x-backup-buffer-default-setup-function #'x-backup-buffer-default-setup-function)
((default-minibuffer-completing-read "Browse buffer with this major mode?"
nil default-minibuffer-completing-read)
nil)
"Find the default function to use."
;; The name of the function or symbol for the buffer buffer:
;; `x-backup-buffer' is used for advice, using the corresponding function.
;; If no such function exists, then find any
;; function using `define-derived-mode' and create an obsolete function.
(car (last-command-event))))
(defun x-backup-buffer-default-setup-function (&optional arg)
======== SAMPLE 109 ========
buffers)
;; :help "Add the function to a function group")
(function (if file-name-exists
#'file-name-as-directory
'directory-name))
(local (if file-name-exists
#'file-name-as-directory
#'file-name-directory))
(file (if file-name-exists
#'file-name-as-directory
#'file-name-directory))
(local (if file-name-exists
#'file-name-as-directory
#'file-name-directory)))
(defvar buffer-file-name-syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?\` " " table)
;; Syntax-table could use some extra characters in the first line.
(modify-syntax-entry ?: "|\n" table)
;; We need to move back the first character.
(modify-syntax-entry ?\# "." table)
;; The next word starts with a number. The first character is
;; left unchanged. Some languages have a separate comment if needed.
;; We don't need it if we don't want to have to replace characters.
(modify-syntax-entry ?% "< " table)
;; When this string does not change point, try the next line.
(modify-syntax-entry ?* "< " table)
(modify-syntax-entry ?# "." table)
(modify-syntax-entry ?* "." table)
;; At the end of this string, we can see the last line.
(modify-syntax-entry ?= "." table)
;; We don't need an extra comment on this line.
(modify-syntax-entry ?_ "< " table)
(modify-syntax-entry ?\" "\" \" \"" table)
;; On a text containing whitespace, this is a string or comment.
(modify-syntax-entry ?^ "< " table) ;; A \n.
(modify-syntax-entry ?\\ "\\ " table) ;; One -*- goes after the ?!.
(modify-syntax-entry ?/ "." table)
(modify-syntax-entry ?. "." table)
(modify-syntax-entry ?^ "/" table)
;; All this does is fix up the syntactic structure. We also
;; need to add comments to make it easier for the user to find
;; the proper syntax.
(modify-syntax-entry ?/ "." table)
(delete-char -1)
(modify-syntax-entry ?- ". 16" table)
(modify-syntax-entry ?- "/" table)
(renumber-list
======== SAMPLE 110 ========
buffers)
;; if it has been in the same position for at least the last few frames.
))
((eq (selected-window) (next-window frame))
(error "`next-buffer' has not been started yet"))
(t ;; the last window of the selected frame did not start yet
(error "`previous-buffer' does not start yet")))
"Frame specific information for `window-min-height'."
:initialize 'custom-initialize-delay
:version "24.4" ; default buffer-local value
:group 'frameset)
(provide 'window-min)
;;; window-min.el ends here
<|endoftext|>;;; window-saver.el --- Simple window manager for Emacs
;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
;; Author: Eric Schulte
;; Janice Raymond <zerocon@lysator.liu.se>
;; Maintainer: emacs-devel@gnu.org
;; Keywords: window
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; This file implements a simple window manager for Emacs, giving the
;; following functions, for use with the command line:
;; Saver.el:
;;
;; (defun my-window-saver-mode (&rest args)
;; (interactive)
;; (window-saver-mode 1 1 #'my-window-saver-mode)
;; (message "window-saver.el is the only window manager this format can support.")))
;; Widget used by most Emacs packages in an Emacs buffer.
;; This one is not used by most of Emacs.
;;; Code:
(defgroup my-windows nil
"A window manager for Emacs."
:group 'display)
(defcustom my-windows-saver-mode 1
"This mode is meant to be turned on by `my-windows-saver'."
:type 'number
:group 'my-windows)
(defcustom my-windows-saver-options
'(window-system-setup-hooks)
"For all window system options, see `my-windows-saver-options'."
:version "24.4" ; Emacs-22
:type '(repeat (group symbol))
:group 'windows)
;; Set the default for this to disable the window manager options.
(defcustom my-window-saver-options
'(display-warning-screen-setup frame-setup)
"For all window system window options, see `my-window-saver-options'."
t)
(defcustom my-window-saver-flags
'(display-warning-buffer-setup frame-setup)
"For all window system flags, see `my-window-saver-flags'."
nil)
(defcustom my-window-saver-flags-with-other-window t
"Non-nil means \"with-other-window \" for all non-newlines in %s buffers.
To disable a flag of this class, first check whether other windows show
the same %s buffer."
:type 'boolean
:group 'my-windows)
(defcustom my-window-saver-flags-with-other-window-string 'never
"Non-nil means show %s buffer if %s is displayed, otherwise show
======== SAMPLE 111 ========
buffers.
(defun ibuffer-delete-file-at-point-handler ()
"Delete the current buffer."
(cond
((and (bufferp ibuffer-buffer-A) ibuffer-buffer-A)
(buffer-substring (point-min) (point-max))
(setq ibuffer-buffer-A (find-file "*ibuffer-file-A" t))))
((or (boundp 'ibuffer-buffer-A) ibuffer-buffer-A)
(ibuffer-kill-buffer-at-point-handler)
(ibuffer-delete)))
(if b-buffers-are-active-p
;; Buffer A is non-nil.
(buffer-list b-buffers-are-active)
(error "Buffer A is not actually active"))
;; Buffer A is visible buffer, but some buffer A's in buffer B, and B's are not.
;; We remove those buffers.
(if buffer-A
(save-window-excursion
(save-restriction
(unless buffer-A
(when buffer-B
(ibuffer-remove-buffer-when ibuffer-buffer-A ibuffer-buffer-A))
(set-buffer buffer-A))))
(setq buffer-A t)))
(defun ibuffer-delete-file-A ()
"Delete the current buffer."
(ibuffer-delete-buffer-A-handler)
;; On most systems, the buffer under point isn't there, so delete it!
(let ((buf nil) (b nil))
(while b
(when (or (equal (buffer-name (car b)) (buffer-name (buffer-list (cdr b))))
(and (plist-get (cdr b) 'ibuffer-overlay)
(not (eq ibuffer-overlay (overlay-get (car b) 'mode)))
(eq ibuffer-overlay (overlay-get (car b) 'mode))))
(pop-to-buffer buf)))))
(defun ibuffer-kill-buffer-at-point-handler ()
"Kill the current buffer."
(if ibuffer-buffer-A
(save-window-excursion
(unless (buffer-modified-p buffer)
(setq buffer-A ibuffer-buffer-A))
(if (string-equal ".*" (buffer-name buffer-A))
(setq buffer-A ibuffer-buffer-A)
(set-buffer buffer-A)
;; Remove the buffer that was the last buffer of BUFFER at POINT!
(if (not ibuffer-kill-buffer-at-point-handler)
nil
(setq ibuffer-kill-buffer-at-point-handler t)))
(when ibuffer-kill-buffer-at-point-handler
(setq ibuffer-current-buffer buffer-HARD)))))
(defun ibuffer-delete-file-buffer-handler ()
"Delete the current buffer. If there is a pending message, move
to another buffer. Delete the current buffer."
(interactive)
(let ((b nil))
(while b
(unless (or
(and (not ibuffer-show-buffer-hook)
======== SAMPLE 112 ========
buffers
"\C-C v "
"\C-c f "
"\C-c f v "
"\C-c x ")))
(setq-local semantic-lex-c-symbol-syntax-alist
(list semantic-lex-c-symbol-syntax-alist
"[ \t]*#\\+C"
"--\\(\\[[^]]*?\\(?:[^]]+\\)\\|\\sw\\|\\\\\\]\\)\\)")
semantic-lex-c-symbol-syntax-alist))
(set-minor-mode 'semantic-lex-c-mode
(if semantic-flex-mode :auto "C-y or c")))
;;; Functions to add functions to semantic-lex.
;;;###autoload
(defcustom semantic-lex-expand-function 'semantic-c-bovinate
"The function for expand the current buffer."
:type '(choice string function
function (other :tag "Function"))
:group 'semantic)
(defcustom semantic-lex-analyzer-default-function nil
"A function to use during macro expansion if Emacs was not started a
pre Emacs. Defaults to `semantic-c-a-local-variable'.
If nil, or if you're using Emacs 5, the function will use the current
buffer, the buffer created by `semantic-lex-analyzer-default-function'."
:type '(choice string function
function (other :tag "Function"))
:group 'semantic)
(defcustom semantic-lex-token-type-alist
'((ansi . "String or regexp")
(ansi . "Regexp, as a string or as single-character code."))
"Alist of tokens based on the first token of a buffer. Each token
matches a pattern with the pattern matching submatches, as
strings. Each element is a character, and the first character
in a token is used for the subsequent tokens. tokens with
the right syntax are tried to match tokens that they aren't already
matched."
:type '(choice (repeat character) (symbol :tag "Symbol")))
;;; The analyzer type.
(defvar semantic-lex-default-syntax-table
(let ((table semantic-lex-default-syntax-table))
(modify-syntax-entry ?\( ". " table)
table)
semantic-lex-default-syntax-table)
;;; The analyzer type.
(defvar semantic-lex-syntactic-eol-data '(
. "\e[ \t\na_$")
"Data to store SYNTETYPES.")
;;; The buffer.
(defvar semantic-lex-expand-buffer-function nil
"Function which is used for the expansion of new buffers.")
(defvar semantic-lex-c-syntax-protection 'semantic-lex-lex-compile-syntax-protection
"The current syntax protection of syntax buffers.")
(defvar semantic-lex-syntax-protection-alist ()
"Alist of syntax protection values.
These special characters are the symbol symbol and the string
character.")
(defvar semantic-lex-syntax-protection-included nil
"Syntax properties to be included in `semantic-lex-syntax-protection'.")
(defvar semantic-lex-syntax-protection-used-for-syntax-protection
'((nil . semantic-lex-syntax-protection-included)
(string . semantic-lex-syntax-protection-used-for-syntax-protection)
(number . semantic-lex-syntax-protection-included)
(
======== SAMPLE 113 ========
buffers
:active (pop commands)
:filter t
:stub nil)
"\\<exec-mode\\>")))
(defvar org-babel-tangle-directives
'((cmd . "build")
(list . "cmd")
(cmd-r . "build")
(list-item . "test")
(list-item . "test")
(list-item . "set")
(list-item . "set")
(list-item . "set")
(list-item . "set")
(list-item . "build-set")
(list-item . "set")
(list-item . "set")
(list-item . "build-set")
(list-item . "set")
(list-item . "build-set"))
"Elements that lead to a command in a mode directive to use a
`c-opt-cmd' command. They are used when building `:code'. When
`:cmd-r' is t, these elements are used to set the variable name of a
command and the variable name of the source file that the
cmd is being run in."
:type '(repeat (cons symbol (choice (cons (string :tag "Command")
(function :tag "Command")
(choice (string :tag "Subr")
(string :tag "Subr"))))))
(defvar org-babel-builtin-builtins nil)
(defun org-babel-expand-body ()
"Take a body and add it to the current buffer and return that.
If it doesn't already have a known name, make it a new body and return that."
(interactive)
(save-excursion
(let ((body-name (org-babel-current-buffer-file-name)))
(when body-name (setq org-babel-result-params body-name)
(cdr (assoc-string body-name (mapcar #'car
(mapcar #'car org-babel-tangle-command-history)))))))
(defun org-babel-execute:execute (body params command &optional error body-name)
"Run BODY with PARAMS as its first argument.
When error is encountered, execute that statement, as a command when
the error condition is encountered. The error code will be passed as a command
\(that is passed as argument to the command)."
(or (org-babel-execute:execute:command:body params command error body-name)
t)
(let ((result (org-babel-eval:execute:command params))
(proc (org-babel-get-buffer-obj:file-process (org-babel-tmp-buffer))
(org-b
======== SAMPLE 114 ========
buffers/minibuf for the
function or command `emacs -k-i-q-n-a
|
| |
|
|
|
|
|
|
|
|
))))
(defvar shell-file-name)
(defvar shell-command-history nil
"History for using this shell command at start of file")
;;;###autoload
(defun shell ()
"Run a shell command interactively.
Interactively, prompts the user for the name of a command, using
a prefix argument. The default is `sh'."
(interactive)
;; If this is an interactive shell, then this should have
;; a read-only property but it's hard to tell right for the
;; case of interactive shells which do not pass it. Let emacs do the
;; otherwise.
(let ((prompt-read-only t))
(eval-buffer)))
;;;###autoload
(defun shell-initialize (&
======== SAMPLE 115 ========
buffers
:help "Show the list of articles you subscribed to.")
nil
:type nil
:keys :help "List your subscribed articles, and jump to their mode list.")
:group 'gnus-compress)
(define-obsolete-variable-alias 'gnus-browse-article-mode-hook
'gnus-browse-article-mode-hook "25.1")
(defcustom gnus-browse-article-file-name nil
"Name of the FILE to be examined for articles.
This is usually a temporary file name for a specific group."
:version "23.1"
:group 'gnus-compress
:group 'gnus-thread
:type '(choice (const :tag "Default") file-name))
(defcustom gnus-browse-article-mode-hook nil
"Hook called by `gnus-browse-article-mode-hook'.
The functions below are only suitable for setting `browse-file-name'."
:type 'hook
:initialize 'custom-initialize-default
:set 'gnus-customize-set-default
:group 'gnus-compress)
(defvar gnus-browse-thread-hook nil
"Normal hook that is run when a thread is selected.
It is called with one parameter in the event `switch-to-buffer' which
displays the thread in the current window.")
(easy-menu-define gnus-browse-thread-menu-items
"Thread"
`("Thread"
["Browse"
:help "Browse the thread under point by its text instead of by name"
(progn
(easy-menu-create-menu
"Browse"
(cons
:help "Browse the threads of the current thread by text instead"
(prin1 gnus-browse-thread-menu-items)))
("List"
["List in selected window" gnus-browse-thread-select
:help buffer]
:button (:radio t)
:visible (get-text-property (point) 'mouse-face)
:visible (get-text-property (point) 'gnus-buffer-mark)
:action 'browse-article (lambda (buffer)
:after-fn
(when (memq system-type '(windows-nt cygwin))
(setq
buffer (get-buffer-create "*GNU-CHANGES*"))
nil (current-buffer))
(if (or (null buffer) (not buffer)
(eq switch-to-buffer 'quit)))
======== SAMPLE 116 ========
buffers.
(if (> (length result) 2)
(setq newsticker--cache-id
(make-hash-table :test 'equal))
(setq oldsticker--cache-id (make-hash-table :test 'equal))))
(message "CacheId `%s' found, and `newsticker--id%s' is `%s'"
newsticker--cache-id newsticker--id))))
(defun newsticker--get-new-news-id ()
"Return new news item id.
This is the value returned by get-new-news-function which returns the
object being created."
(newsticker--id-assoc 0 newsticker--cache-id))
;; ======================================================================
;;;
;;; Functions for retrieving and reading news data from the server
;; ======================================================================
(define-derived-mode newsticker-mailcap-mode special-mode "Mailcap"
"Major mode for reading, writing, and navigating news."
(setq buffer-read-only nil)
(setq mode-name "Mailcap"
buffer-read-only nil)
;; turn off message mode to prevent calling this again later.
(set (make-local-variable 'message-mode-hook) nil)
(setq buffer-read-only t)
(setq mode-name "Mailcap")
;; Turn on message mode to avoid calling this again later.
(set (make-local-variable 'message-start-time) 1)
(set (make-local-variable 'message-last-charset) message-charset)
(set (make-local-variable 'message-reply-to-string)
message-reply-to-string)
(setq buffer-read-only t)
(set (make-local-variable 'buffer-string) "*")
(setq newsticker--current-feed
(with-current-buffer (setq newsticker--current-feed (aref newsticker--current-rss feed)))
newsticker)))
(defun newsticker-save-rss-feed (feed-name)
"Save current feed and return it as a RCS feed.
This is like `save-buffer', but uses the `current-buffer'
symbol instead."
(let* ((name (symbol-name feed-name))
(name1 (process-get (current-buffer) 'rss-name)))
(when name ; name1, name2, name3
(setq newsticker--current-feed name
newsticker-feed-name name2)
(set-buffer-modified-p nil)
(rename-buffer name1)
(switch-to-buffer name2)
(kill-buffer (current-buffer))))
(if newsticker--cache-id
(progn
;; Delete old `newsticker--cache-id' value. This is needed after
;; the old `newsticker--show-feed-id', when the cache is
;; invalid.
(delete-dups ; delete all duplicates
(delete-dups ; remove duplicates of the cache
(remove-duplicates newsticker--cache-id))))
(setq newsticker--current-feed
(with-current-buffer (process-get (current-buffer) 'url-buffer)
======== SAMPLE 117 ========
buffers
(setq-local font-lock-mode nil)
(setq major-mode 'org-mode)
(setq-local highlight-face-function #'org-fontify-highlight))))
;;;###autoload
(defun reftex-mode-revert (&optional all-buffer buffer)
"Revert the buffers listed in `reftex-TeX-regexp-alist' and `reftex-TeX-text-entities-alist'.
BUFFER defaults to the current buffer. All other buffers
are ignored. The difference between NEW-BEG and DELETE-BEG is
calculated in `RefTeX-BEG-adjust-window-height', or in
`reftex-TeX-regexp-alist'.
RefTeX is currently only compatible with the `RefTeX' utility from
theTeX2 package (whose font-lock mode only works on windows
\(e.g. Emacs < 26.1), and whose default-doc-only option doesn't
exist in `reftex-ELaTeX-mode'. It's not compatible with Emacs 21.x and X
Emacs. See `reftex-TeX-regexp-alist', `reftex-LaTeX-strings-to-index',
and RefTeX-LaTeX-strings-to-index."
(interactive)
(reftex-mode 1 "REV-WAVE" t)
(reftex-revert nil t buffer))
;;;###autoload
(defun reftex-edit (file &optional update-mode-line)
"Edit the file FILE in all reftex trees.
If updating the buffer, make a buffer named NEW-BUFFER.
When called from Emacs, use `reftex-mode' instead.
Return the buffer to edit."
(interactive current-prefix-arg)
(reftex-mode -1 file))
;;; Define RefTeX files
;;
;; The files defined in RefTeX are also the ones used as part of
;; `latex-mode' and `reftex-mode'. (I guess it's just their names.)
;;
;; This library defines and implements the RefTeX files.
;;;###autoload
(defvar reftex-latex-files '()
"Association list of files to be visited and visited-printing commands.")
(defvar reftex-latex-files-regexp nil
"Regexp matching the regexp that should be re-expanded.")
(define-obsolete-function-alias
'reftex-find-file-for-library 'reftex-mode-revert #'reftex-mode-revert "27.1")
(defvar reftex-tex-file-name nil
"File name used in the LaTeX buffer.")
(defvar reftex-latex-file-regexp nil
"Regexp matching the regexp from the user's LaTeX file.")
;; Variables local to the entire file
(defvar reftex-latex-file-local ?n nil)
(defvar reftex-tex-file-name-regexp
"^[ \t]*%{\\([^}]*@\\)*\\)\\{%![0-9]*\\}")
(defvar reftex-tex-file-index nil)
(defvar reftex-mode-syntax-table
(let ((table-list (make-syntax-table)))
(modify-syntax-entry ?\\ "." table-list)
(modify-syntax-entry ?\n "." table-list)
(modify-syntax-entry ?\^_ "w%" table-list)
(modify-syntax-entry ?\" "\"" table-list)
(modify-syntax-entry ?' "\"\"" table-list)
(modify-syntax-entry ?+ "." table-list)
(modify-syntax-entry ?+ "." table-list)
(modify-syntax-entry ?= "[ \t]*#\\+begin{\\(.\\)}"
table-list
======== SAMPLE 118 ========
buffers with
;; `buffer-file-coding-system-alist'.
(if (and buffer-file-coding-system
(consp buffer-file-coding-system)
(plist-get coding-system :utf-8))
(let ((coding-system
(cons
(if
(buffer-file-coding-system-alist)
(let ((b (buffer-modified-B nil)))
(and b (buffer-string-modified-B nil) b)
(replace-regexp-in-string "\n\n" b)
(buffer-string-modified-B nil)))))
(set-file-coding-system buffer-file-coding-system coding-system))))
;; Convert non-existing non-ASCII characters to Unicode.
(let ((utf-8 (utf-8-to-unicode))
;; This has to be done after `insert-buffer-visiting'.
(utf-8-to-encode
(buffer-name (buffer-string)))))
;; Convert a UTF-8 sequence buffer into Unicode.
(with-temp-buffer
(set-buffer-multibyte nil)
(erase-buffer)
(insert-buffer-substring read-buffer)
(if utf-8-to-unicode
(message "UTF-8 encoding is %s" utf-8-to-unicode
(buffer-name)))))
;; `read-buffer' does not accept a non-ASCII character.
(set-buffer-multibyte nil)
(setq buffer-read-only nil))))
(defun read-buffer-substring (read-buffer delimited-description)
"If the current buffer contains a non-ASCII character, insert it at the end of the region
to save the buffer. If the current buffer contains another `read-from-minibuffer',
it should end after delimited-description."
(let ((buffer-read-only nil))
(goto-char (point-max))
(delete-region (point-min) (point-max))
(insert buffer-file-coding-system delimited-description)
(goto-char (point-max))
(setq buffer-read-only nil))
(while read-buffer
(setq delimited-description (buffer-substring (point-min) (point-max)))
(insert delimited-description nil)
(setq read-buffer-substring read-buffer)
(when read-buffer
(when (or (eq read-buffer read-substring)
(not (save-excursion
(goto-char (point-min)))
======== SAMPLE 119 ========
buffers. I'd imagine the following code to work very well even if code was written to accept a different
value of point in the loop.
As you may have noticed, this is only done if point-max reaches an error at
beginning; otherwise, point-max is left out."
(or (bolp) (backward-char 1))
(let ((end (point))
retval)
;; Turn off the loop if point-max is within the loop limit.
;; Also turn off the loop if point is past the first element of
;; the string to be printed.
(when
(and strlen
(<= (mod strlen (- end-point (point-max))) 1))
(while (and (not retval)
(>= (mod strlen (- end-point (point-max))) 1))
(setq retval (1- (- end-point (point-max)))
retval (or (char-displayable-p (buffer-substring-no-properties (point-min) (point-max)))))))
retval))
(defun print-maximum-lines (&optional ascii-character)
"Print maximum number of chars, one per line, if visible.
The characters which could be displayed in the region are also
displayed (if in ASCII mode). As a default, only ASCII characters
are used, else if `ascii-character-display-p' is non-nil the
output is mapped to its actual name.
Any non-nil value of `print-screen-column' is displayed, and
if `display-color' is non-nil `ascii-line-spacing' is printed
in the same color."
(apply #'nconc
(mapcar
(lambda (char)
(cond
((integerp char) char)
((not (natnump (setq char (read-string "First char: "
(if (or (not char)
(char-to-string char)
char))
char)
t))
nil)
(char-displayable-p char))
(if (and display-color display-color-p) t display-color-p))))
;; ----------------------------------------------------------------------------
(defvar strlen)
(defun print-lines (arg)
"Print lines, possibly even columns.
See `print-count-lines' for possible values."
(interactive "P")
(let ((columns
(and arg
(list arg (point-min) (point-max))))
(width (/ (count-lines (point-min) (point-max))
======== SAMPLE 120 ========
buffers)
(add-hook 'kill-buffer-hook #'completion--list-for-completion)
(setq buffer-file-format nil))
(if buffer-file-name
(progn
(setq file-name filename)
(user-error "Invalid element `%s'" filename))
(setq filename (abbreviate-file-name buffer-file-name))
(if (and (setq buffer-file-name (directory-files buffer-file-name))
(string-match "/$:" filename))
;; There were file name-nondirectory errors here, so remove the
;; line "..:" from the output.
(delete-and-extract
file-name-from-filename (buffer-file-name))))
(setq-local completion-try-syntax 'list-for-completion)
;; We cannot use the "list for completions" mechanism in
;; this major mode buffer since completion will be called asynchronously
;; and we will return. But we can disable this for "Completion"
;; if it is really used.
(unless (listp (cdr (assoc 'completion prefixes)))
(push '(completion-pcomplete--list (car (car (cdr (cdr (cdr (cdr (cdr (cdr (cdr (cdr (cdr
(cdr (cdr (cdr (cdr (cdr (cdr file-format))))))))))))))) completion-pcomplete--list)
completion-pcomplete--list))
(if (stringp prefix) prefix (substring prefix 1)))
completion-pcomplete--list))))
(defun completion-list-for-list (list)
"Helper function for `completion-list-make'.
The return value is a list of elements of the form (PRED-TYPE COUNT-TYPE)."
;; The `pred' is used to evaluate the list.
(if (eq pred 'PRED-TYPE)
(let ((tail nil))
(push tail list)
(setcar list tail)))
list)
(defun completion-list-put (list pred-type &rest pred-calls)
"Make list PRED-TYPE (default `:list') or list PRED-CALL (default `:calls').
Return LIST'ed or PRED-CALLs if no elements are PRED-TYPE, nil otherwise."
;; The first `:name' element in LIST is the last element in LIST.
;; In that element, either PRED-TYPE or a `:name' element is also found.
;; But PRED-TYPE is non-nil if the first element in LIST is a `:name'
;; element and thus the name is not a predicate name;
;; and PRED-CALLs are nil except when nil is provided.
(unless pred-type
(setq pred-calls
(and completion-list-make-calls
(buffer-substring comint-file-name comint-last-input-end)
completion-list-make-calls)))
(while (and pred-type (not (member pred-type (car pred-calls)))
(member pred-type (cdr pred-calls)))
;; Check the elements that PRED-TYPE already selects, and the next
;; search is needed to construct lists with the pred entries.
(let ((elements (nthcdr (- (length pred-type) (length completion-list-list-
======== SAMPLE 121 ========
buffers
:foreground "Pink")
(t "Black"))))
(defun gdb-set-command-prefix (cmd)
"Update the command prefix prefix table if in a buffer.
Use command prefix command-prefix (prefix arg) instead."
;; FIXME: This should be removed. We don't want this stuff to be
;; used by the user. Instead, it is copied to (gud-buffer)
;; where it can then be used and used again (on newlines).
(cond
;; When newline is coming you need to make sure that `gud-prefix' is at
;; end of arg or else the prefix prefix will match the line length
;; from previous call (which doesn't have to be the last arg).
((looking-at comint-prompt-regexp) (gud-set-command-prefix cmd))
;; Do the normal thing, don't do the redisplay/de-marker.
((looking-at comint-prompt-regexp)
(if (looking-at gud-prompt-regexp)
""
(gud-do-command-prefix cmd)))
(when (not (looking-at "\r\n")) (setq cmd (concat cmd (buffer-substring (point) (point-at-eol))))))
(defun gud-complete-stdio-call (arg)
"Perform completion on the current command in C.
Called on a program as a stdio command."
(interactive "P")
(comint-send-string (or arg gud-stdproc-args))))
;; GUD provides the functionality of running commands through gud-comint-buffer
;; (eg comint) which allow us to do something useful
;; (eg send and read). In my opinion, these routines would be
;; better spent in a different package. -- rms.
(defvar gud-comint-last-command nil
"GUD's last command sent when `gud-comint-buffer' is not empty.")
(defun gud-comint-buffer ()
"This function is called from `gud-mode'. It takes one argument, the
current buffer and should take a single non-save char as its
argument. The user will have to wait for that char. This
function can be overridden by \\[gud-comint-buffer-save].
When reading a program in the inferior process, GUD uses this command as
command-line argument."
;; Read the source in
;; This function should be run at the same time we are completing it
;; (which happens in comint mode under some circumstances).
(let ((buf (get-buffer-create " *gud history buffer*")))
(or buf (setq buf (read-buffer "Read buffer: ")))
;; Read buffer
(with-current-buffer buf
(gud-comint arg)
(gud-set-command-doc (current-buffer))
(when (file-remote-p cmd)
(gud-comint arg-min)
;; Don't do this if the command passed in has no buffer or if cmd was
;; not part of any command line arg, that is known.
(gud-set-command-doc-first arg)
;; If the command passed in is a shell command, we have to read that
;; command first to find out its meaning. If I'm working on
;; a binary I can't wait for this call of the command in the
;; shell line, if it is only a shell command and not a program command,
;; I don't know what to do about it. I don't expect
;; anything to change, but it won't be as bad as last time.
(set-buffer (find-file-noselect cmd))
(when (file-buffer-p buf)
(display
======== SAMPLE 122 ========
buffers are not included.
;;;###autoload
(defun semantic-idle-text-region (begin end &optional force)
(interactive "r")
(semantic-buffers-kill (&optional force) start-recursive-edit start-of-current-line))
;;;###autoload
(defun semantic-idle-view-buffer ()
"View a buffer of the current semantic tag.
Interactively, return the location of the start of the tag if the
context is established while View is active."
(interactive)
(save-excursion
(beginning-of-line)
(if (and (semantic-tag-overlay tag)
(semantic-tag-in-buffer-p tag))
(goto-char (semantic-tag-start tag))
(if (semantic-tag-buffers-p tag)
(when (semantic-tag-buffer-p tag)
;; The buffer is in the view buffer
(delete-overlay tag))))
(save-selected-window
(set-window-start (selected-window) (point))
(message "Viewing buffer %s in current buffer %d" (buffer-name) (buffer-size))
(start-view-buffer-query))))
;;;###autoload
(defun semantic-idle-refresh-tags ()
"Reread all tags with tags from the current buffer."
(interactive)
(set-buffer (generate-new-buffer semantic-tag-buffer-name))
;; When Semantic is active and we have a view buffer, we want
;; to get rid of any buffers which are not marked as active.
(let ((buffers (semantic-refresh-tags)))
(unwind-protect
(progn
(with-current-buffer (semantic-brute-find-tag-buffer-for-symbol)
(save-excursion
(goto-char (point-max))
(princ (format " <%s>\n"
(buffer-substring (point) (point-max))))
(save-excursion
(select-buffer (current-buffer))
(goto-char (point-min))
(semantic-refresh-tags-in-region (point) (point-max))))))))
;;;###autoload
(defun semantic-idle-view-list (browse-args &optional)
"View the list of tags based on a buffer BUFFER.
If you are using Emacs for Semantic Recoder, this function may make some
differences on display.
The buffer to view is determined based on the variables
CHASEFFONTUM, BUFFER, and VISAGE. BUFFER is a string used when
to display buffer information in the Semantic Recoder
buffer. BUFFER is the buffer that was being displayed,
BUFFER is the buffer showing the buffer at the other end of the
window used for the search, and VISAGE is the variable controlling the
current mode.
If two buffers are displayed, the view buffer BUFFER and BUFFER is
the one to be used.
Return list of buffers to scan."
(save-excursion
(let* ((view (browse-url-at-point))
(buff (semantic-current-tag-at-point))
(view-regexp "^\\(\n\\)\\*"))
======== SAMPLE 123 ========
buffers and
\n\t\\)" nil t)
(c-font-lock-unfontify-region (match-beginning 0) (match-end 0))))))
(defun c-font-lock-do-change-re with-syntax c-maybe-change-syntax-syntax-syntax-off (&optional pos)
"Font lock function for C-like code.
Set this to nil when pos is set to 0.
Also the first unfontified line of the comment/string will be fontified."
(let ((case-fold-search t)
(forward-line 0)
(uncompiled t)
(paragraph-separate nil))
(when pos (goto-char pos) t)
(if (> (point) (marker-position c-marker))
(c-fontify-symbols t)
(cons (point-max)
(list (save-excursion (cadr (forward-line -1))
(point-max)))))))
(defun c-font-lock-do-string-delete (start end)
;; Don't do anything if a line before START has been fontified.
;; The line before END is not fontified yet. We do not want it
;; inserted. (Except for comment and string replacements.)
;; (point)
;; This won't cause a misalignment.
;;(save-excursion (goto-char start)
;; (let ((old-end (point)))
;; (re-search-backward "[\t\n\r]+\\(\\sw\\|\\s_\\)+"
;; (min to-end (point-max) t)
;; (point)))
;; (goto-char (match-beginning 0))
;; (while (and (>= (point) (match-end 0))
;; (< (point) end))
;; (goto-char (match-end 0))
;; (< (point) end)))
;; (forward-line))
;; (< (point) end)))
(c-font-lock-add-keywords
c-font-lock-keywords-1-open
'("C++ Mode" "C++ Mode" c-mode) t)
(c-font-lock-add-keywords
c-font-lock-keywords-2-end
'("Java Mode" "Java Mode" c-mode) t)
(c-font-lock-add-keywords
c-font-lock-keywords-3-begin
'("Java Mode" "Java Mode" c-mode) t)
(c-font-lock-add-keywords
c-font-lock-keywords-4-end
'("Lisp Mode" "lisp Mode" c-mode) t)
(c-font-lock-add-keywords
======== SAMPLE 124 ========
buffers
:active (gethash (cadr file) (ebrowse-get-node-artical-file-alist))))))
(defvar ebrowse-tmp-directory-name)
(defun ebrowse-file-name-for-operation (file-name operation)
"Like `file-name-non-special' for OPERATION, but only if FILE-NAME is a directory."
(if (member operation (ebrowse-file-name-directory-name))
(or file-name-non-special
(member operation ebrowse-tmp-directory-name))))
(defvar ebrowse-tmp-file-regexp)
(defun ebrowse-file-name-for-operation-1 (file-name operation)
"If FILE-NAME is in the tmp directory, return the file name of OPERATION on FILE-NAME."
(or (cadr (file-name-all-completions file-name operation))
(and (cadr (file-name-all-completions file-name operation))
(cadr (file-name-all-completions file-name OPERATION))
(ebrowse-file-name-all-completions file-name-all-completions))
(cadr (file-name-all-completions operation))))
(defun ebrowse-find-file-other-window (file &optional dont-examine)
"Find FILE-NAME, asynchronously, in another window.
Optional argument DONE-EXAMINATE means show it by that window."
(let ((window (make-frame-invisible t))
(buf (current-buffer))
(window (window-with-parameter window 'ebrowse-mode))
(buf-in-direction 0)
pos)
(if ebrowse-buffer
;; `ebrowse-mode' is enabled.
(progn
;; Find the file.
(ebrowse-mode 1)
(setq pos (point))
(unless (eq (point-min) (point-max))
(ebrowse-display-ebrowse))
(if dont-examine
;; Display the buffer if not already visible.
(ebrowse-update-buffer-line)
(ebrowse-display-buffer)
(insert-buffer-substring buf)
t))))
;; EDE autocomplete
(defun ebrowse-autocompleter-autocompleter-get-filename (filename)
"Find out if FILTER is a filename extension.
If FILTER is a string, the name of `ebrowse-filename-format' is returned."
(let ((eof (get ebrowse-filename-format 'ebrowse-autocompletion-ext))
(lst (or (car eof)
(if (stringp filename) filename
(or (ebrowse-file-name-extension filename) ".?")))
elt)
fn)
(or fn
(error "The autoexpand_path.el extension requires a string"))
;; Get our own filename, e.g. if we can get the directory and the
;; filename is a string.
======== SAMPLE 125 ========
buffers are not allowed.
;; ;; Note: To avoid any error, it is better not to add to init.el
;; (delete-file filename)
;; (unless (integerp start) start))
;;
;; (insert "-print" "-print " ")\n"))
;;
;; (t
;; (insert "("))
;; (insert "-print ")\n"))
;;
;; (set-window-start buf (selected-window))
;; ;; Otherwise, we can set it to the local value at the start.
;; (set-window-start buf start))
;;; User Interface Functions
(defsubst vip-get-buffer (bufname &rest args)
;; If BUFNAME is a null buffer, it will be used for the current bufname.
;; Otherwise, BUFNAME must be a buffer, and the current buffer will appear
;; after BUFNAME, which will become empty before returning.
(apply #'vip-get-buffer-create bufname args))
(defun vip-get-buffer-create (bufname &rest args)
;; If BUFNAME is a null buffer, it will be used for the current buffer.
(apply #'vip-get-buffer-create bufname args))
(defun vip-get-buffer-position (buf-marker)
;; If BUF-MARKER is nil, use the current buffer as destination.
;; If BUF-MARKER is 'delete, make sure it was originally selected
;; before sending BUF-MARKER.
(let ((buf (find-file-noselect buf-marker (current-buffer)))
(buf-pos (marker-position buf-marker))
bufpos)
(set-marker buf-marker nil)
(with-current-buffer buf
(setq buf-pos (buffer-size))
(save-excursion
;; If BUF-PATTERN is non-nil, then insert `buffer-file-name'.
(if (stringp buf-pos) (setq buf-pos (string-to-char buf-pos)))
;; Insert the current buffer.
(insert "\nBuffer\nBuffer\n: " buf-pos)
(insert buf-pos))
(set-marker buf-pos nil)
(erase-buffer)
(when (and buf-pos (>= buf-pos (- buf-pos start)))
(cond ((or (bufferp buf-pos) (buffer-file-name buf-pos))
(insert (mapconcat (lambda (buf-pos)
'string-to-number (buffer-name buf-pos)) "["
buf-pos "\n")
buf-pos))
((viper-viper-to-comment-is-buffer-p)
(insert "Buffer ( ")))
((and (buffer-local-value 'buffer-file-name buf
======== SAMPLE 126 ========
buffers
(if (equal (car form) (cdr form))
(goto-char (car form))
(let ((beg (point)) (end (progn (forward-line) (point)))
(form (funcall (nth 2 form) (point))
(nth 1 form)))
(when (< (point) end)
(delete-region (point) end)))))
(when (or (< (point) limit) (> (point) limit))
(insert forms-in-buffer)
(forward-line 1)))
;; Delete the lines with a single dot.
(goto-char (point-min))
(delete-region (point) (point-max)))
(defun org-add-babel-options ()
"Add options to `org-babel-options-alist'."
(let (options options-elements docstruct)
(save-restriction
(narrow-to-region
(if (not (org-at-heading-p))
(org-match-line org-babel-options-alist nil nil nil nil t))
(progn
;; If point is in a table, don't look there.
(re-search-forward
(concat
;; Check if it's a block of org cells.
;; https://lists.gnu.org/r/emacs-org/2007-06/msg00073.html
"("
;; Check if we are inside a table.
"{"
)
"}"
")")
(goto-char (match-beginning 2))
(while (re-search-backward
(concat (match-string 1) "; "
(if (bobp) (1- (match-beginning 0)) nil))
nil t)
(replace-match (if org-babel-options-alist
(lambda (arg) (list "--no-toplevel-toplevel-header/table"
"--inline-data-table"))
'org-babel-custom-arguments nil t)
")")))))
(defalias 'org-babel-table-map '(function data-map data-var bind-map
)
"Map functions to table-cell types.")
(unless (fboundp 'make-hash-table)
(defvar bind-hashtable)
======== SAMPLE 127 ========
buffers and font-lock.
(setq font-lock-keywords-1 nil
font-lock-keywords-extra 0)
(setq font-lock-keywords-extra (1+ font-lock-keywords-extra)))
(defun font-lock-default-function-keywords (f)
(when (featurep 'xemacs)
(xemacs)
(let ((case-fold-search font-lock-case-fold-support)
(case-fold-search-forward t t))
(if (string-match "\\`\\(\\*\\|\\`\\)\\(.*\\)[ \t]+\\([ \t]*\\)\\(?:\n\\)\\(?:" font-lock-keywords)
(let* ((default (match-string 1 font-lock-keywords))
(value
(if (member value font-lock-defaults-with-case-sensitive)
(concat global-set-key-after-initial-value value)
"(default "(default ":set") ".
value)))
(while value
(setq value (pop value))
(and (eq value global-set-key-after-initial-value)
(prog1
(buffer-substring (point-min) (point-max)))
(setq value (eval value))))))
value)))
(defun setf-key-after-init-syntax (syntax key &optional context-key)
"Set SYNTAX and return its context.
If prefix argument COMPOUND-KEY is non-nil and context was set,
do nothing until context-key is non-nil. Otherwise, this
command may return to the previous command, which is
tried and returned as the default value.
Return nil if SYNTAX is not set, or if it is the empty string of
the string SYNTAX was ignored during the command.
KEY must be a character not in the string to be ignored."
(if context-key
(setf-key-after (or context-key (read-char-exclusive))))
(cond ((assq syntax key-bindings) ; for compatibility with XEmacs
(if (and context-key (not (assq syntax key-bindings)))
(setf-key-after (or context-key (read-char-exclusive)))))
((keywordp syntax)
;; Not in Common Lisp, and should not be set at all.
(if (< (length key) 0)
(setq syntax nil)
(setq context-key (if (< (length key) 0)
(read-key-sequence nil)
(read-char-exclusive)))
(setq key-bindings (cons syntax key-bindings))))
((not (memq syntax '(nil t))
(stringp context-key))
======== SAMPLE 128 ========
buffers (not implemented by this version)."
(if (and (string= name "")
(or (not (and (stringp value) (not current-prefix-arg))
value))
org-export-metaleft-alist))
(let ((key (if (and value
(not buffer-read-only))
(let ((tmp (make-temp-file "org-format-lob-2")))
(when (and default-directory
(file-readable-p default-directory))
(make-directory (file-name-directory tmp))
(setq tmp temp))
tmp)))
(org-export-read-format org-format-lob-alist value key))))
(defun org-export-lobify-entry (key name value)
"Lobify an entry to a format entry.
KEY is the key as returned by return-value-fcn, NAME is the
string PROP1 and VALUE is the string VALUE.
Returned value is a list, with leading empty colon."
(let ((result nil))
(while key
(setq key (pop key))
(unless (member key result)
(unless (member value result)
(push entry result))
(setq result t))))
(let ((result nil))
(while key
(setq key (pop key))
(unless (member key result)
(member value result))
(push entry result))))
(defun org-export-collect-src-links (string info &rest args)
"Convert STRING into either a Lisp source link or an association list.
First, the strings in STRING, VALUE as a string.
Then, FORMAT, INFO depending on TAG.
Return the association list (or nil with no association) for the string.
ORIGIN is the symbol passed as argument. This function returns only a
reference to an association list in STRING. The rest of TAG information
is given as is.
The string is stored in a buffer, and the result is returned. The
buffer may be modified after evaluation to prevent this.
The source of the source is controlled by TAG.
Return VALUE."
(declare (debug (string &rest [&or org-src-tag])
(symbolp &optional stringp))
;; See the docstring for TAG.
(when org-src-tag (set-symbol-value org-src-tag (symbol-value org-src-tag))
result))
(catch 'exit
(let ((alist org-src-tag-link-alist))
(while alist
(setq alist (cdr (assoc (car (car alist)) (cdr (cdr alist))) alist))
(dolist (entry (nreverse alist))
(when (member (car entry) result)
======== SAMPLE 129 ========
buffers with which we don't have to use the
;; `file-expand-wildcards' check.
;; We are not going to look for a path through the file system, so it
;; doesn't matter (it could be the last non-directory
;; part of that path). Instead we are going to look for a file in
;; the other system and return it.
(let* ((file (* (file-name-as-directory (car path) (cdr path)))))
(when (file-directory-p file)
(when (and file (file-directory-p file)
(not nt-file-handler-functions))
(directory-file-name file)
(if (member (file-name-directory file)
(directory-files file directory-file-handlers))
(directory-files file directory-listing-file-coding-systems-alist)
file))))))
;;;###autoload
(defun ls-lisp-compute-file-name-directory (dir &optional size no-error)
"Compute the file name on DIR in the following ways:
- `directory-file-name' - a list of directories instead of using the default.
- `subfile' - a subdirectory of DIR. This only works for the most typical
-specific directory, because `file-attributes' must return the name of a full
-relative file name (i.e. sans a wild card). The `file-attributes' property
-nil or `file-name-directory' will only return `dir'. However, if DIR
appears in this list with a \"-t\" command (`/dev/null'), it may represent
as a wild-card, or a full path.
| | | | | | | | | | |
| | | | | | | | |
| | | | |
| | | |
| | | | |
; for non-relative path
-- for non-absolute path
; to an absolute file name.
; for absolute path
; for relative or absolute
; for absolute or relative path
; for absolute or relative path
======== SAMPLE 130 ========
buffers in a separate buffer."
(setf (nthcdr 2 a-list) (nth 0 a-list))
(setf (nth 1 a-list) (nth 2 a-list))
(setf (nthcdr 3 a-list) (nth 3 a-list))
(setf (nthcdr 4 a-list) (nth 4 a-list))
(setf (nthcdr 5 a-list) (nth 5 a-list))
(setf (nthcdr 6 a-list) (nth 6 a-list))
(setf (nthcdr 7 a-list) (nth 7 a-list))
(setf (nthcdr 8 a-list) (nth 8 a-list))
(setf (nthcdr 9 a-list) (nth 9 a-list))
(setf (nthcdr 10 a-list) (nth 10 a-list))
(setf (nthcdr 11 a-list) (nth 11 a-list))
; (setf (nthcdr 12 a-list) (nth 12 a-list))
; (setf (nthcdr 13 a-list) (nth 13 a-list))
; (setf (nthcdr 14 a-list) (nth 14 a-list))
; (setf (nthcdr 15 a-list) (nth 15 a-list))
; (setf (nthcdr 16 a-list) (nth 16 a-list))
; (setf (nthcdr 17 a-list) (nth 17 a-list))
; ;; Now make a list a string of numbers
; (stringp (nth 0 a-list))
; (stringp (nth 1 a-list))
; (list (nth 2 a-list) (nth 2 a-list)
; (nth 3 a-list) ""))))
;;
(provide 'cal-tex)
;;; cal-tex.el ends here
<|endoftext|>;;; cal-texx.el --- Calix commands for cal-tex
;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
;; Author: Per Abrahamsen <apab@acs.des.org>
;; Mark A. Hershberger <maya@hansgap.net>
;; Maintainer: Glenn Morris <grey@tobletey.net>
;; Keywords: cal c cal
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Code:
(require 'calc-key)
(require 'calc-units)
(require 'calc-units)
(require 'calc-xwidget)
(defvar calc-command-prefix-function nil
"If non-nil, this function will attempt to run commands on the command line.
If it is nil, an interactive command is available.")
(defvar calc-command-mark-func nil
"If non-nil, it is the function that will be called on the command line.")
(defvar calc-command-line-args)
(defun calc-command-line-internal (command &optional no-command)
(if (eq calc-command-prefix-function 'defun)
(progn
(while (< (length command) 3)
(cond
((and no-command (< (length command) 4)) nil)
======== SAMPLE 131 ========
buffers from `org-remove-replaces'."
:group 'org-display-table-table
:version "24.1"
:type `(map ,@(orgtbl-table-make-export-key
(lambda (table _lst vf) _vf _table)
"Export Table:")
:version "24.1"
:type `(let ((val ,(if (eq c 'table t) "[ \t]*[^ \n]" "[ \t]*[^ \n]"))
(nalist (mapcar #'org-combine-plists
(orgtbl-packages vf))))
(and val (/ val 2)))))
(defun org-make-heading-title (arg)
"Set `org-heading-title-face' to its full name."
(set-face-foreground 'org-heading-title-face arg)
;; Add the new headline property to `org-heading-title-property-list'.
(let* ((name (if (eq arg 'standard-output) "Org.\n" "Org\\.el\n"))
(title (org-get-archived-headline-title))
;; If the heading is empty, turn the title attribute on.
(key (if (string-match-p ":[ \t]+\\'" headline)
"%[ \t]*"
"Org.\n")))
(if (string-match-p "\\`\\(\\[\\]\\(.*?[ \t]*\\)?\\)\\'" title)
(concat name (concat "\\`" (regexp-quote key) "\n")))
(setq key (substring key 0 (match-beginning 0))))
(unless (equal key '(4))
(error "Not a valid key"))
(unless key (setq key (concat "." key)))
(let ((val (org-export-data (substring headline 0 key) type)))
(if (equal val (or (equal key "+") val ""))
(setq val ""))))
(defun org-make-heading-title (&optional arg)
"Set `org-heading-title-face' to its full name."
(set-face-foreground 'org-heading-title-face arg)
(let* ((name (org-get-archived-headline-title))
(title (if (string-match ":[ \t]+\\'" title)
"Org\\.el" "Org\\.el\n"))
(subtitle (if (string-match-p ".*:[ \t]*\\'" title)
"Org\\.el\\.el\n" "Org.\n")))
(unless (string= title "")
(setq title
(concat "(" title ")" (format "%d" (length title))))
(setq title (concat "(" title ")")))
(unless (eq 'table (org-export-data (substring headline 1 (length title)) type) t)
(error "Unknown \"%s\" key \"%s\" line %d"
(mapconcat #'identity (org-latex-title title)))
(error "Table is too short for this file. Try `org-latex-title
======== SAMPLE 132 ========
buffers.
If a buffer is being edited, it is a window-modded buffer.
The following parameters are normally specified for edited buffers.
Any other value is treated as empty.
The first two variables control the depth to search. (If nil, these
the most special one will go in the other direction.) (The more
special `first' means to save the value and restore it to before-value
which it otherwise would have.)
The value of this variable changes with function `dnd-file-type-value'.
For each element of the list, the value is a list of (WINDOW . FILENAME).
WINDOW must be a live buffer, which must be a live buffer of that
type, as returned by the original function, or the first element of
that list is t.
FILENAME and FILENAME are optional, as in `apply-partially'.
The first two variables control the operation of the function `set-file-name-or-file-name'.
WINDOW must be a live buffer, which must be a live buffer of that
type, as returned by the original function, or the first element of
that list is t.
If FILENAME is a function, it is called with two arguments:
(WINDOW . (WINDOW-NAME) where WINDOW-NAME is the name of the
file, and FILENAME is the name of the original function that was
called on that file instead of calling the function itself if it
might call the function from other buffers; this is used to
avoid problems where buffers that are visited with different versions
are visited by the same Emacs process.")
(defcustom dnd-file-type-value-history nil
"History list for history file.
If nil, nil is ignored.
If value is a list of keys, it should contain the sequence of the
current key in the sequence, or one sequence for each mode.
If nil, it is not a list.
If value is t, the value is nil and the value is a list of the
defaults, but a symbol.
If you have any value that differs from \"default\" from
default, set the `dnd-file-type-value-history' property to nil."
:type '(repeat symbol)
:group 'dnd-file
:set :initialize 'custom-initialize-default
:version "21.1")
(defvar dnd-file-type-value-history nil
"History list for the key-history for an dnd-file.
Value takes effect when `dnd-file-type-value-reset' is called.
This is useful when setting the value of a variable
`dnd-file-type-value-reset-history', and you are trying to delete a
file with that name. It does the same to another file that is
part of the same dnd-file-type-value-reset-list.")
;;; Internal variables.
(defvar dnd-file-type-value nil
"Value for the default search, if any.")
(defvar dnd-file-type-value-reset-alist nil
"Alist of regexps and function for `dnd-file-type-value' to reset
historical values of various type properties.
Each function is called once for each dnd-file-type-value,
and you can use `dnd-file-type-value' to reset both.
In DND, the list of regexps is: ((,default . nil) (:inhibit . nil))
In DLP, the list of functions is:
((:inhibit . nil) ((:interactive . nil))
(:default :inhibit ((setq dnd-file-type-value nil) (setq dnd-file-type-value t)))
(:file-name-nondirectory . nil))
;;; File names.
(defun dnd-read-file-name (prompt)
"Prompt for the file name to use."
(let ((file-name-handler-alist dnd-file-name-handler-alist))
;; Only one entry is currently used in the function.
(dolist (f (funcall f 'dnd-file-type-value-history))
(nthcdr (mod 20 (cdr f)))
(if (member f file-name-handler
======== SAMPLE 133 ========
buffers
`(:global ,(concat "\\|--" "" (mapconcat ,(lambda (x) (prin1-to-string ,x)) x ", ")))
;; For `dired-select-files' we don't need to do anything special. Use
;; `dired-update-default-directory', `dired-select-files-other-window'.
`(:enable dired-select-files :interactive :preset t
:doc
(dired-select-files ,(car dired-files) t)))
(provide 'dired-x)
;;; dired-x.el ends here
<|endoftext|>;;; ezimage.el --- image image or text editing and display support for eZ
;; Copyright (C) 1996, 2001-2019 Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <zappo@gnu.org>
;; Package: ez
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Define an image or text editing and display implementation for Emacs
;; using an ez format, and eZ format (a) for use with eZ, or
;; c) for use with EZ-like images/text images.
;;; Code:
(require 'eufs-x)
(require 'compile)
(require 'epg)
(defvar ez-image-mode)
(defvar ez-x-header)
(defvar ez-x-start) ;Defined as an integer, either 1 or 0
(defvar ez-x-header-type)
(defvar ez-x-init-face) ;Defined as an integer, either 1 or 2
(defvar ez-x-header-font '(foreground "Black" )
"Font used to fontify the header line of the X menu.")
(defvar ez-y-start) ;Defined as an integer, either 1 or 0
(defvar ez-y-data) ;Defined as a list, such as: [:_0][:_1][:_0]{}
(defvar ez-y-font '(foreground "black" )
"Font to fontify the header line of the X menu.")
(defvar ez-y-data-font '(foreground "Black" )
"Font to fontify the header line of the X menu.")
(defvar ez-font) ;Defined as an integer: either 1 or 0
(defvar ez-x-init-face) ;Defined as an integer, either 1 or 0
(defvar ez-x-init-face) ;Defined as an integer, either 1 or 0
(defvar ez-x-reset-font)
(defvar ez-x-data-font) ;Defined as an integer: either 0 or None
(defvar ez-x-data-font) ;Defined as a list, such
======== SAMPLE 134 ========
buffers (and `*-r/a-zA-Z0-9_').
;;;###autoload
(defun rfc2047-b-macro-program (arg)
"Insert program ARG lines short, and print it at the end.
Use C-s and *to control programs."
(interactive "*P")
(let ((macros '([{ 1 -2} ; 1-5 1 -6 -7 -8 -9 -<=>>=}
(`[{ 1 -2 } ; 2-5 -6 -7 -8 -9 -<=>=}
(`[{ 1 -3 } ; 3-9 -9 -10 -11 -12 -13 ; 1-12 -13 -<>=}
(`[{ 1 -4 } ; 4-5 -6 -7 -8 -9 -<=>=}
(`[{ 1 -5 } ; 5-7 -9 -10 -11 -13 ; 1-11 =}
[{ 1 -6 -1 ; 7-1 -6 -7 -9 -<=>="}
(`[{ 1 -3 } ; 3-9 -10 -11 -12 -13 ; 1-12 =}
(`[{ 1 -1 } ; 1-9 -1 -6 -7 -9 -<=>="}
(`[{ 1 -17 } ; 17-1 -1 ; 7-1 -5 -7 -7 -8 ; 1-13 =}
(`[{ } ; 1-9 -1 ; 9-1 ; 8-1 ; 9-13 =}
(`[{ } ; 9-13 ; 13-2 ; 8-13 ;;= :))
(`[{ } ; 8-13 ;;= :))
(`[{ 1 -0 ; 0-6 ; 7-1 -9 ; 1-11 =}
(`[{ -4 ; 7-1 ; 10-1 ; 5-1 ; 2-11 =}
(`[{ } ; 10-1 ; 11-1 ;
======== SAMPLE 135 ========
buffers, that is, the buffer will be read in
before we start editing. If the buffer is not reading, we need a new buffer
that we don't want to edit.
An explicit closing comment will make `w32-terminal' a
terminal that is not read."
;; (interactive "p")
(setq w32-terminal-type 'w32-terminal)
(if w32-terminal-type
(list w32-terminal-type)
(list 'w32 w32-terminal)
(list 'w32-forward-w)
(if (called-interactively-p 'interactive)
(message "W32-terminal type used when editing, %s: " w32-terminal-type))
(w32-backward-w)
(w32-print-w32-arg) ; to print the last WS line in the W32
(w32-show-message) ; To see buffer's message, just type SPC or RET.
(w32-display-message)
(setq char (w32-parse-arg-discard))
(write-file (expand-file-name w32-file-name nil w32-command-name
(current-buffer))
'w32-arg))
(w32-set-display-column) ; for WINDOW
(w32-goto-line)
nil)
(defun w32-start-and-move-w32-arg (arg)
(w32-start-with-args)
(w32-send-signal "W32 argument %s is not present" arg)
(w32-position-for-arg)
(w32-move-marker (- arg w32-position-for-arg))
(w32-send-signal "W32 argument is %s" arg)
(w32-print-arg)
(w32-line-position)
(if w32-position-for-arg
(setq position w32-position-for-arg))
(unless w32-position-for-arg-interactive
(w32-position-for-arg))
(when w32-use-prompt
(let* ((buf (generate-new-buffer "*W32 Terminals*"))
(prompt (if (equal w32-print-arg-function
"print an argument to w32-print: ")
"print the command ")))
(with-current-buffer buf
(with-current-buffer (get-buffer-create "*W32 Terminals*")
(erase-buffer)
(insert-buffer-substring buf))
(with-temp-buffer
(insert-buffer-substring buf start end)
;; WIDGET
(widen)
(setq w32-display-column (current-column))
;; FILLED-OUT
(widen)
;; ARGUMENT
(if (and w32-use-prompt (not (= (point-max) (+ (+ w32-position-for-arg)
======== SAMPLE 136 ========
buffers))
(end-of-line)
(while (and (not beg) (= (following-char) ?/)
(progn
(forward-line 1)
(bobp))
(looking-at "|"))
(forward-char -4)
(bobp)
(setq end (1- end))
(forward-line 1))
(insert (format ";; -*- coding: %s -*-"
(org-trim (if (eq coding 'iso-2022-jp) " " "[0-9]"))
start-pt))
;; FIXME: add a second blank line at end of comment, and check how
;; does the newline fit.
;; (fill-region start-point end-point nil 'noindent))))
((or (and (> (match-end 2) (match-end 2 len)) (< (match-end 2) len))
(< (match-end 4) (match-end 4 len))
(= (match-end 2) ?|))
(insert (format ";; -*- coding: %s -*-"
(org-trim (if (eq coding 'iso-2022-jp) " " "[0-9]"))
start-pt))
(goto-char start-point)
(beginning-of-line)
(insert "\n;; (if current-prefix-arg
\n")
\n")
(indent-to (if (match-end 1)
start-pt
start-point)))
;; FIXME: move point at end. At B+ to have the indent modified.
(t
(end-of-line)
(forward-line 1)
(insert ")\n"))))
(defun org-md-stringify (limit)
"Convert the delimiter part of a line to a delimiter string, return it."
(or (stringp limit)
(if (string-match "[]>=<>" limit)
(string-to-number (concat " " limit)))
(save-match-data
(save-restriction
(narrow-to-region (point-min) limit)
(with-temp-buffer
(insert limit)
(goto-char (point-min))
(cond
((= (match-end 0) (match-end 1)) ""))
======== SAMPLE 137 ========
buffers)
(nthcdr (parse-partial-sexp
(point-min) (point-max) arg))))
str))))
(_ (save-restriction
(let ((n (parse-partial-sexp
(point-min) (point-max) arg)) 'nohits))
(narrow-to-region
(save-match-data
(setq n (parse-partial-sexp
(match-beginning 0) (match-end 0)))
'nohits nil nil arg)
(goto-char (match-end 0)))))))
(forward-line n))))
(defun mm-file-cache-entry (file-cache)
"Append FOO to FILE-CACHE, and return it."
(mm-with-unibyte-buffer
(mm-insert-file-contents-internal
(url-file-cache-extension file-cache) 0 file-cache-contents)
(mm-insert-file-contents file-cache)
(let ((inhibit-read-only t))
(insert-file-contents file-cache-contents)
(list file-cache--nohits
(mm-handle-cache-entry file-cache-file-name)))
(mm-with-unibyte-buffer
(if (and (not (file-symlink-p file-cache-contents))
(buffer-modified-p))
(setq file-cache-contents (mm-parse-file-attributes)))
(cl-incf arg)))
arg))
(provide 'mm-decode)
;;; mm-decode.el ends here
<|endoftext|>;;; mm-uu.el --- a command to perform completion on MIME parts
;; Copyright (C) 1995, 1998-2001, 2005-2019 Free Software Foundation,
;; Inc.
;; Maintainer: emacs-devel@gnu.org
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(require 'mm-decode)
(defvar mm-uu-charset) ;; for compatibility with
======== SAMPLE 138 ========
buffers."
(defun tramp-handle-file-attributes (filename &optional method)
"Like `file-attributes', but only for file names and attributes.
This works for file attributes that are part of a filename, but
are not really part of a filename."
(apply #'tramp-handle-file-property
(file-name-nondirectory filename)
(append (list method)
(list method)
(tramp-compat-file-attribute-list-face nil 'file))))
(make-obsolete-variable
'tramp-handle-file-attributes
"use `file-attributes' instead."
'tramp-handle-file-attributes
"24.4")
(defun tramp-handle-copy-file (filename &optional key-seq local-name mustbenefs passwd-list)
"Like `copy-file' but not like `copy-region'."
(unless local-name
(setq local-name (tramp-file-name-localname filename)))
(setq key-seq (or local-name (copy-sequence local-name)))
`(set-file-name-as-directory (with-parsed-directory-name
filename
`(if key-seq "?" "?"))))
(apply #'tramp-file-name-as-directory filename local-name))
;; ======================================================================
;; Utility functions
;; ======================================================================
(defmacro tramp-handle-file-local-copy (&rest body)
"Like `file-local-copy' but not for directory."
`(with-tramp-file-property (locate-file ,regexp ,filename) nil t
(when (tramp-tramp-file-p (locate-file ,regexp ,filename))
,@body))))
(defun tramp-handle-file-attributes (_filename &optional methods)
"Like `file-attributes' but not for directory, attributes, names and attributes.
This is only useful for file attributes."
(cond
((listp methods)
`(with-tramp-file-property (locate-file ,regexp ,filename) nil t
(tramp-compat-file-attribute-link-p ,filename))))
"Like `file-attributes' but not for directory."))
(defun tramp-handle-file-modes (filename &optional localname mustbenefs passwd-list)
"Like `file-modes' but not for files in local directories.
Local values of `directory-file-name-function' and `file-modes' are returned,
so local values outside of `default-directory' are used."
`(and (tramp-file-name-localname ,filename)
(and localname
(file-name-as-directory ,filename)))
"Like `file-modes' but not for files in directories."
(and (tramp-file-name-localname ,filename)
(if localname
(or
(tramp-file-name-localname ,filename)
(tramp-file-name-localname ,filename)))
(file-remote-p default-directory)
localname))
(defun tramp-handle-add-file (filename new-name &optional mode-p require-final)
"Like `add-file-function', but it overrides `add-name'.
If the remote filesystem is not loaded, `add-name' defaults to
the filename
======== SAMPLE 139 ========
buffers for the region.
(goto-char (point-min))
(beginning-of-line)
(while (not (eobp))
(unless (looking-at-p (regexp-quote (buffer-substring (point-max)
(point-max)))
;; We want the whole buffer after point, so make sure the
;; start points are moved to the right after we have
;; found the end of the region. Also, we want the start
;; from point-min to be at the start of the first buffer,
;; in case the buffer was loaded before.
(while (and (not (eobp))
(not (search-forward-regexp ".*" nil t))))
(forward-char)))
;; We start here, so find the end of the buffer, and then try the
;; whole buffer. If yes this causes problems when the
;; buffer is first saved.
(goto-char (point-min))
(when (not (bobp))
(when (search-forward "%" nil t)
(beginning-of-line)
(if (re-search-forward "^.*?\\([^:]*\\):\\("
nil t)
(goto-char (match-beginning 0)))))
(beginning-of-line)
(when (looking-at "[ \t]*\\*\\([^:]*:\\):\\("
nil t)
(delete-char (- (match-end 0) (match-beginning 0)))
(let ((lines
(mapcar (lambda (line)
(let ((buf (buffer-substring (point-min) (point))
(buffer-file-name line))))
(cdr (split-string lines)))))
(forward-line lines)
(delete-region (point-min) (point-max))
(delete-char (- (point-max) lines))))))))
(defun org-babel-expand-body (&optional from to body)
"Expand the body of the current buffer, if that buffer is loaded."
(interactive)
(unless body
(user-error "Not in a loaded
======== SAMPLE 140 ========
buffers (and maybe add extra menu entries).
;;
;; * Make it happen
;; (customize-group 'todo-edit) => toggle diary file display
;;
;; * Allow the user to modify the major mode-specific diary file to reflect the
;; default value of this buffer-local variable.
;; (set-default buffer-local-variable 'default-todo-todo-mode-map)
;; (customize-set-variable 'todo-buffer-buffer-savings-list nil)
;; (customize-set-variable 'todo-buffer-saved-saved-time nil)
;; (customize-set-variable 'todo-buffer-last-saved-time nil)
;; (setq buffer-file-name
;; (file-name-nondirectory (concat (buffer-name) (buffer-name) "*todo-saved-files*"))
;; buffer-file-name)))
;;;###autoload
(defun todo (&optional arg)
"To do a list item from the file drawer.
The default value of the variable `todo-sorting-files-by-done' determines the time
when the category search filter buffers list items.
When called interactively, prompt for a numeric prefix argument
or for a key sequence to select an item from the list of done items.
Optional arg N says how many lists should be done.
Interactively, ARG can be any number of arguments that may appear as
indications for the number of lists for which sorting should be done.
The value of this variable should be one of the following:
- nil Non-nil means to display a time stamp.
- t Display the time instead of listing items.
- thetag Display tag information.
If the optional argument ARG is (interactive :PROGRAMS), this command is
called with a single argument COUNT, which defaults to 3.
If COUNT is empty, the value of variable `todo-sort-files-by-done' is used
and ARG is omitted.
Return number of items in the list or nil."
(interactive "P")
(let* ((minibuffer-completing-file-name nil)
(todo-sorting-files-by-done 'none)
(regexp (or regexp
(concat todo-sorting-file-ring "\n" todo-sort-files-by-done))))
(when (and (symbolp arg) (not t))
(setq arg
(or arg 1))
(if (not todo-sorting-files-by-count)
(read-string
(format "%d priority of sorting done lists: "
nil (if (> (logand arg 0) 7) (list todo-sum-done-number) "")))
(let* ((count 0)
(countp (- 1 count))
(regexp (concat todo-sorting-file-ring "\\([^ ]+\\)\\( .*\\( +\\)[^ ]+\\)?\\( +\\) "))
(length (or (and rfc822-numberp
(downcase rfc822-numberp)) 2))
(countp (- l) (if (integerp rfc822-numberp) l 0))
(countp (* l (if rfc
======== SAMPLE 141 ========
buffers
;; to go where we want.
(setq count nil)
(while
(progn
(insert " %3d%%"
(or count (1+ count)))
(goto-char (point-min))
(forward-line 1)
;; Now, find the next start. Don't do that if there
;; are no more than two lines.
(search-forward "\n\n")
;; Skip the following, the last-completion.
(while (and
(or
;; If there is a `last-completion' after this
;; line, this is a valid last completion. It
;; is set to non-nil if the first possible choice
;; was not found when we started, so the
;; first possible choice is nil.
(not (string-match
(if (looking-at "[\t]*\n[ \t]*")
(int-to-string
(string-to-number (matching-string 2))
(string-to-number
(string-to-number (string-to-number
(matching-string 2)))))))
======== SAMPLE 142 ========
buffers and other stuff.
;; Keybindings:
;; Commands that Emacs calls more than once to toggle the window display
;; or other window switching. If `display-buffer-same-window' is non-nil, these
;; commands are invoked when Emacs starts. They do so only if the selected window
;; is the frame's normal window. If `window-dedicated-p' is nil, this
;; command is invoked just before the display of the buffer.
;;; Code:
(defcustom-declare-minor-modes nil
"The minor modes to inhibit scrolling if the window displays is too small (default non-nil)
for the selected window. To inhibit scrolling, use the `s' key."
:version "24.1"
:type 'boolean
:group 'frameset)
(defcustom-declare-font `((choice . ,choice))
"Font used for the selected frame's display."
:version "24.1"
:type `(;; (choice . ,choice)
(character . ,character))
:group 'frameset)
(defcustom-declare-keymap 'frameset-minibuffer-mode
"Keymap used for the selected buffer's minibuffer display.
It is keybindings.el's own face-table in an internal keymap.")
;; Variables:
(defvar minibuffer-enable nil
"Non-nil means the currently selected window should use this buffer.
See `minibuffer-switch-to-buffer' and `minibuffer-switch-to-frame'.")
(defvar minibuffer-minibuffer-map nil
"The minibuffer map used in buffers of this major mode.")
(defvar minibuffer-minibuffer-quit nil
"If non-nil, quit and return nil when exiting.")
(defvar minibuffer-quit-hook nil
"Normal hook used to quit, exit and return nil when entering another frame.")
(defvar minibuffer-frame-width nil
"Width of the selected window's header.")
(defvar default-frame-width nil
"Default width of the selected frame's header.")
(defvar frame-size nil
"Number of pixels to use in `frame-width' for an ordinary frame, if available.")
(defvar frame-selected nil)
(defvar frame-selected-visible nil
"If t, don't select an unselected frame in the minibuffer window.")
(defvar frame-width 1)
(defvar frameset-width 0
"If nil, the current window's display is displayed.
Otherwise it is calculated.")
(defvar frameset-frame-width 0
"If nil, the current window's display is used.")
(defvar frameset-width 0
"If nil, the current window's display is used.")
(defvar frame-set-size nil
"The total pixel size of the selected frame (in lines)."
(if frameset-size
(frame-width)
;; Only widths by which we want to select the best one, which is not what we
;; want to want to do if we want to switch to a window with the selected
;; window.
(frame-height)
;; The size of the selected frame, in pixels.
(frame-size)
(if frameset-shrink nil
(frame-height)
;; Frame sizes on a non-N terms frame.
(frame-width -1)
(frame-height 0)
;; Frame widths which have no pixels.
(let ((frame (list (- (minibuffer-frame) (frame-width)
(frame-pixel-width))))
(left nil) (top nil) (center nil))
(mapcar
(lambda (var)
(if (equal var 0)
======== SAMPLE 143 ========
buffers
(setq pkx (car (nreverse x)))
(setq sigma (math-div c1 (cdr pkx)))
(while (/= sigma (cdr math-div))
(setq math-div (cdr math-div)))
(if (symbolp pkx)
(insert "\n<" pkx)
(insert "\n</")
(insert "\n" pkx "\n"))
(replace-match "*"))
;; This also works for integers, since we have to have a number or
;; complex number that is numerically valid to have a real number.
(let ((v2 (math-simplify-integers
(if (or (eq (car-safe math-integered-str) 'vec)
(memq (car-safe (nth 2 math-integered-str)) '(0 1))))
'(var nan var-nan)))
(if math-integered-str
(format "%.2d%s" (max (1+ (cdr math-integered-str)) v2)
(format "%.2f" (max (1+ (cdr math-integered-str)) v1))))
(unless (<= n 1)
(if (math-messy-integerp (nth (1- n) math-comp-str-triv1))
(setq n (math-make-int n -1))
(setq math-comp-str (string-to-number (nth n math-comp-str-triv1)))
(setq math-comp-str-triv1 (math-make-int (- n (length math-comp-str-triv1)) 1)))
(if (< n 1) (<= n n)
(let ((v1 (math-make-int (- n 1) (car math-comp-str-triv1))
math-comp-str2 (list 'vec (nth 1 math-comp-str-triv1)))
(if (setq v2 (math-sum-expr math-comp-str2 1))
(if (setq v1 (math-real-expr v1 2))
(if (memq (car-safe math-integered-str) '(0 1))
(if (memq (car-safe (nth 1 math-integered-str)) '(1 2))
(not (memq (car-safe math-integered-str) '(0 2)))
(cons (cons v1 v2) (reverse math-comp-str2))))
(setq v2 (list 'vec (nth 1 math-comp-str2) v2))
v1 v2 v1))))
(defun math-read-Integral (num &optional neg)
(or neg
(if (eq (length num) 0)
(let (k1 k2)
(mod num 1)
(while (< num 0)
======== SAMPLE 144 ========
buffers (not in new buffers in the current buffer).
(if (>= (point-max) (point-min))
(error "C-x i"))
(move-overlay
`(("I" ,@(if (window-dedicated-p) "#* " (buffer-name)))
(("i") ,@(if (window-dedicated-p) "* " (current-buffer))))
;; Set window's new focus.
(set-window-new-buffer "*I*")
;; Set new buffer's new buffers.
(set-window-buffer
new-buffer
;; Update focus.
(when (window-live-p new-window)
(set-window-new-buffer new-buffer (current-buffer) :notify nil))
;; Update buffer's visible/invisible state.
(set-window-buffer new-buffer
(window-prev-buffers new-buffer))
;; Reset visible focus.
(set-window-buffer new-buffer
(window-prev-buffers
(window-next-sibling)) :notify nil :size (1*SIZE) :height 0 :active t :width 1 :mouse-down-flag (1+SIZE) :auto-refresh 'set-window-buffer
:help "Set the new buffer's active window to the buffer that was selected.
If the buffer is selected now, the active window is cleared
when the buffer is set to the buffer that was selected before."
:key-type 'window-active-p :type 'window
:properties " "
:restore-list-before nil :active t
:local-map (lambda (widget)
(customize-set-variable 'window-dedicated-p
:on-derived-buffer
nil)))))
(window-setup)
;; Setup new buffer.
(unless (window-dedicated-p new-buffer)
(move-overlay
(or (get-buffer new-buffer)
(pop-to-buffer new-buffer)
======== SAMPLE 145 ========
buffers (like this one with `cvs-toggle-vc-visit') when a region is visited."
(interactive)
(vc-call-backend 'visit vc-parent-backend))
(defun vc-visit-file (source-file)
(interactive
(when vc-parent-backend-file-alist
(list (expand-file-name (let ((dir (file-name-directory source-file)))
(or dir (expand-file-name (vc-parent-file-name source-file))))
(cond
((equal filename "") current-prefix-arg)
;; Directory name, using file's full path, or no path at all
;; etc.
(file-name-nondirectory filename)
(t (file-name-directory filename)))
nil)))))
(defun vc-visit-source-file (source-file)
(interactive
(when vc-parent-backend-file-alist
(list source-file nil)))
(vc-checkout source-file)
(let* ((directory
(expand-file-name (or source-file source-file))))
(unless directory
(vc-checkout-default-directory source-file)
(vc-message nil "Checking out %s..." source-file)
(with-current-buffer (get-buffer-create " *vc-file-output*")
(goto-char (point-min))
(while (re-search-forward "^@change-log.*$" nil t)
(replace-match " "))
(save-buffer))
(message "Updating `vc-command-output-buffer'...")
(if dir
(vc-command-output-mode
"updating `vc-command-output-buffer'..." )
(vc-command-output)
(vc-command-output 'up-list directory)))))
(defun vc-execute-edit ()
(interactive)
(let ((inhibit-modification-hooks t))
(with-current-buffer (get-buffer-create " *vc-change-log*")
(goto-char (point-min))
(while (search-forward "\n\n+ " nil t)
(replace-match "\n\n")
(forward-line 1)))
(setq buffer-read-only nil)))
(provide 'vc-mode)
;;; vc-mode.el ends here
<|endoftext|>;;; vc.el --- backend for the CVS repository -*- coding: utf-8; -*-
;; Copyright (C) 2003-2005, 2006-2019 Free Software Foundation, Inc.
;; Author: Gerd Moellmann <gerd@gnu.org>
;; Maintainer: emacs-devel@gnu.org
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (
======== SAMPLE 146 ========
buffers
(c-with-temp-buffer
(insert-buffer-substring texinfo-buffer)
(goto-char pos)
(if (and (forward-word-strictly -1)
(not (looking-at c-awk-keyword-re)))
(progn
(goto-char pos)
(c-ensure-newline)
;; if the newline isn't a continuation line, we need to
;; use just that one's position; for example, if
;; the next line contains the whole string. That would
;; be pretty annoying when they find an error message
;; telling them that the last line contains the
;; first \ on this line; it is not useful for anything to
;; happen
(progn
(c-forward-syntactic-ws)))))))
;; Move forward to last syntactic error.
(unless (memq last-tag '(point-max backward-sexp sexp))
(if (or (looking-at "<[^>\n]*>")
(save-match-data
(forward-line 1))
;; the <> is used to specify the backslash
;; characters that the
;; last-tag's expression is still in the syntax.
(c-save-buffer-state
(forward-line -1)
(c-backward-syntactic-ws)
;; we'll find the last comment character in this
;; line, where its comment chars will continue, otherwise
;; they get stuck on that one. If none of them is
;; there then it's a problem.
(and comment chars
(save-excursion
(cond
((and c-syntactic-indentation
(save-excursion
(c-beginning-of-macro lim)
(looking-at (c-awk-declaration-re-lst reftex-macro)))
======== SAMPLE 147 ========
buffers by the end of these characters.
(forward-char)
(let ((end (/ (skip-chars-backward "^\n\\b" end) 2)))
(backward-char)
(forward-char)
(unless (zerop (char-after))
;; Don't erase, but the next char gets the property on the property
;; of `c-syntactic-indentation', to be consistent.
(c-reset-syntactic-context)
(while (and (< (point) end) (not (= (point) end)))
;; Move back into the previous space, so the next character
;; gets the property on `c-syntactic-indentation' to be
;; consistent with this point in the context, otherwise the
;; previous character gets the property
(backward-char))
(setq point (car-safe (char-after)))
(if (equal point (point))
(backward-char)
(setq point (point)))
;; This case doesn't change at all.
(setq point
(and c-syntactic-context
(progn
(goto-char point)
(c-reset-syntactic-context))
(< (point) point)))
(move-to-column c-column)
(setq c-column (current-column)))
;; Move back into the preceding char at the same location in
;; the context between this char and point, so the next
;; one gets the property of `c-syntactic-indentation' on the next
;; char so that it is consistent with the preceding one.
(while (and (not endp)
(not (eq (char-before) ?\s)))
(c-forward-ws)
(c-clear-syntactic-context)
(goto-char ppoint)
(cond
((or last-token last-word-end)
;; Skip over this last character, which we are now
;; not inside a quote char.
(setq ppoint (point)))
;; Remove the last comment or a newline.
======== SAMPLE 148 ========
buffers
(defvar org-agenda-current-buffer) ; Defined via `org-agenda-buffer'.
(defvar org-agenda-global-marker) ; Deferred by `org-agenda-buffer'.
(defvar org-agenda-global-help nil)
(defvar org-agenda-show-list
'(:global :tag "Top agenda buffer")
"Display the global help messages for agenda view.")
(defvar org-agenda-mode-map-keymap
(let ((map (make-sparse-keymap)))
(define-key map [left] [delete] org-exit])
(define-key map [right] [delete] org-exit-backwards)
(define-key map [up] [back] [down] org-exit-other-frames])
"Keymap for agenda view in Org mode.")
(defvar org-agenda-mode-map
;; defined via variable `org-agenda-mode-map'
;; (define-key map "\C-c\C-w" 'org-agenda-toggle-window)
(let ((map (make-sparse-keymap)))
(define-key map [back] 'org-select-window)
(define-key map [up] 'org-select-other-window)
(define-key map [down] 'org-select-other-window)
(define-key map [left] (lambda (x y) (org-exit-frame)))
;;(define-key map [right] (lambda (x y) (org-exit)))
(define-key map [right] (lambda (x y) (org-exit))))
;; (define-key map "\C-c\C-w" 'org-cycle-backward-hook)
(let ((map (make-sparse-keymap)))
(define-key map [down] 'exit-frame)
(define-key map [left] 'org-cycle-backward-hook)
(define-key map [left] 'org-cycle-backward-regexp)
(define-key map "\C-c\C-w" 'org-toggle-window-attribution-mode)
(define-key map "\C-x\C-t" 'org-toggle-window-attribution-mode)
(define-key map [up] 'org-toggle-window-attribution)
(define-key map [down] 'org-toggle-window-attribution)
(define-key map [up] 'org-select-window)
(define-key map [moveleft] 'org-select-window)
(define-key map "\C-x\C-v" 'org-select-window)
(define-key map "\C-x\C-f" 'org-show-all-drawers)
(define-key map "\C-x\C-q" 'org-toggle-window-quit)
;; (define-key map "\C-x\C-a" 'outline-menu)
(define-key map [(control control)] 'org-outline-stack)
;; Make it a toggle key-map
(define-key map [(control down)] 'org-outline-stack)
(define-key map [(control up)] 'org-outline-stack)
map)
"Keymap for agenda view in Org mode.")
(defvar org-agenda-mode-menu
(let ((map (make-sparse-keymap)))
(define-key map [menu-bar org-agenda]
(cons "Org Agenda" (make-sparse-keymap "Org Agenda")))
(define-key map [(meta tab)] 'org-agenda-shift-indent)
(define-key map [(shift down)] 'org-shift-tab-stops)
(define-key map [menu-bar
======== SAMPLE 149 ========
buffers and keymaps
1 (interactive "p")
(setq viper-mouse-help-buffer
(get-buffer viper-doc-buffer-name-face-format)))
((not viper-mouse-map)
'viper-menu-item-with-prefix-map)
(t (message "mouse-2: kill buffer")))
;; The next two sets of bindings are actually bindings for the
;; next and previous functions, i.e. the last one can make
;; whatever bindings that get set to keys in the list that get set to
;; the next one become bindings.
;; There's a funny trick going on here as well when you're using
;; viper-make-vi-command-keys.
(cond
((memq last key-binding)
(setq key-binding (symbol-function last))
(viper-get-vi-command-key))
(t (error "viper-menu-item: key binding not allowed")))))
;;
;; The viper-menu-p and
;;
;; last bindings: the keys are put onto the vi bindings so that they
;; don't mess up the hook that runs viper-show-bindings.
;;
;; the last binding is always nil to avoid losing a key.
(defun viper-show-bindings ()
"Hide key bindings in the hook. Use the last key on the hook."
(when viper-mouse-help-buffer
(display-buffer viper-help-buffer (current-buffer) 'viper-mode))
(let ((key "")
(key-binding (vconcat)))
;; This is the viper-mouse-function.
(if (display-graphic-p)
(set-buffer viper-emacs-window-config)
(switch-to-buffer (if viper-emacs-window-config
(get-buffer-window viper-emacs-window-config)
(get-buffer-window viper-emacs-window-config)))
(set-buffer viper-emacs-window-config)
(vi-set-key key-binding "N"))
;; If this is an emacs-major-mode binding to viper-menu-p?
(viper-set-key key-binding "N")))
;;;###autoload
(define-minor-mode global-vi-mode
"Toggles global Vi mode.
When Global Vi mode is on, buffers are displayed in buffers A, B, and
C on lines whose text contains text A or less of the buffer's text B.
This is a buffer-local minor mode. When enabled, buffers will appear in order
after the cursor, not in order of appearance in the buffer list.
If you set this buffer-local minor mode (`global-vi-mode'), enable
Viper mode (`vi-global-map'), and customize it to turn on Global Vi mode,
it calls the following custom forms:
(global-vi-mode 1)
where 1 is the key sequence number used when executing this command.
If you set `vi-global-p-prefix' to nil, the Vi command prompt displays a
string giving prefix characters and prefix characters separated
by backslashes. This uses `vi-filter-char-fold' to filter the lines
invisible as well as visible lines to which you're applying some text.
If you set `key-define-coding-system' to the atom `noreturn', the
CORE-CODING-SYSTEM must be a coding system specified by
======== SAMPLE 150 ========
buffers)
(push
(vhdl-item-string "A") ; (A string)
(vhdl-item-string "B") ; String to insert into the buffer,
; or nil.
(vhdl-item-string "C") ; List of two-element vectors
(vhdl-item-string "D") ; list of two-element vectors or nil if not required
(vhdl-item-string "E") ; string to insert into every buffer
(vhdl-item-string "F") ; list of three-element vectors or nil if not required
))
(vhdl-compile-warning
#'vhdl-warning-warning
#'(lambda (error)
(vhdl-warning-warning error nil t )
(vhdl-warning-warning "Bad VHDL Mode")))))
(defun vhdl-warning-message (format help-echo function)
"Display message explaining why the variable `vhdl-warning-enabled' has no value."
(if (not function)
(concat "Error: (You can't read this line)"
"Error: "(This line in a warning) (You can't read this line)"
"*** WARNING: ***"
(if (not vhdl-warning-mode)
(setq
nil
vhdl-warning-mode)
function))
""))
(defun vhdl-warning-message-internal (format help-echo function)
"Display message explaining why the variable `vhdl-warning-enabled' has value."
(if (not function)
(concat "Error: (You can't read this line)"
"Error: "(This line in a warning) (You can't read this line)"
"*** WARNING: ***")
"")))
(defun vhdl-warning-message-in-header (format help-echo function)
"Display message explaining why the variable `vhdl-warning-enabled' has no value."
(if (not function) (setq function 'vhdl-warning-mode))
(if (not vhdl-mode) (setq vhdl-warning-mode nil)
(vhdl-warning-message (format "Warning about %s" vhdl-warning-mode))))
(defcustom vhdl-warning-mode-line-hook nil
"Hook run after `vhdl-warning-mode-hook'.
You could add, and remove from the hook whatever variable you
do not like to control, but I think there would be the following:
\"*Warning*\" => If this is the value of the variable `vhdl-warning-mode',
\"*Disabled/Unsupported*\" => Ignore,
except *Disabled/Unsupported* => `*Disabled*', `*'
======== SAMPLE 151 ========
buffers:
(c-beginning-of-line)
(save-restriction
(let ((nest 0) (start (- nest)))
(while (or (not (bolp)) (< start left))
(setq start (c-beginning-of-syntax)
nest (1- nest)))
(setq base (point-min-marker))
(goto-char base)
(skip-syntax-backward "w_")
(setq nest (c-point-syntax-table (point)))
(if nest
(progn
(c-end-of-statement)
(setq nest (point))
(c-forward-syntactic-ws))
(if nest
(progn
(c-forward-token-property 1))
(c-end-of-token)
(goto-char base)
(setq nest (point))
(if nest
(c-forward-syntactic-ws)
(c-forward-syntactic-ws)))
(setq end (point-max-marker)))
(goto-char start)
(setq base (point))))
;; CASE 7: Inside a comment, we can see at which level
;; before encountering a blank line, if we are on a line that contains
;; the comment header. This case was caught by one of the
;; following lines:
(progn
;; Ignore lines like c-beginning-of-line or
;; c-block-comment.
(and (eq ?* (char-before))
(looking-at "[ \t]")
(eq ?* (char-before)))
(save-restriction
(narrow-to-region (line-beginning-position) (match-end 0))
(or (memq (char-before) '(?\s ?\t ?\r))
(setq end-col (current-column)))
;; Ignore comments past the end of a line.
(save-restriction
(goto-char base)
(while (and (c-at-vsemi-p 'block-comment) (>= (point) (c-point 'boi)))
======== SAMPLE 152 ========
buffers (in case the first one was a string).
(concat " " r (mapconcat 'search-replace-string string
:args " "
(or gnus-original-article-search-arguments t)
" ")))))
((eq article-buffer gnus-default-article-buffer) nil)
((eq article-buffer gnus-default-article-buffer) 'gnus-summary-find-article)
(t (error "Invalid article buffer")))
(setq gnus-use-even-numbered-headers nil)
(let ((buffer "GetArticle")
m m-id r r-id gnus-current-article-viewable)
(set-buffer (gnus-get-buffer-create gnus-buffer-name t))
(setq m (car m-id))
(setq r (cdr r-id))
(when r-id
(setq m (pop m-id))
(setq r-id (pop r-id)))))
(gnus-message 3 "Reading article...done"))))
"
;;; Server Message Buffer
(defun gnus-message-buffer (message)
"Say MESSAGE.
If MESSAGE contains lines, that line will be searched for.
If MESSAGE contains a regexp, the current line will be searched for."
(when message
(setq message-from message-to))
(if (and (not (equal message-buffer (current-buffer)))
(buffer-modified-p gnus-message-buffer))
(when gnus-message-buffer
(gnus-message-buffer nil message)))
(if (and gnus-save-current-buffer
(not gnus-auto-save-headers)
(not (and gnus-automatic-auto-save-headers
gnus-autosave-current-newsgroup-file-name
(file-exists-p gnus-auto-save-newsgroup-file-name)
t))
;; We don't want to mess up the current buffer; we want to put something
;; permanent to gnus-auto-save-headers.
(delete-file gnus-auto-save-headers)
(gnus-message 1 "%S'ing %s" (car (car (car gnus-auto-save-headers)))))
(let ((gnus-auto-save-headers (and gnus-auto-save-headers
gnus-auto-save-
======== SAMPLE 153 ========
buffers by using different
arguments (the new format is like the old format, except that the
arguments in the string are strings, not actual text).
The standard format functions are described in the docstring
section of `org-element.el'. They are useful for setting
`org-element-store-context' and for inserting context.
The `org-element-element-store-custom-formulas' function
stores a set of formulas for customizing Org mode. It is
called upon entering Org mode.
`org-element-insert-variable-initialized' reads the variable
from the buffer before inserting. `org-element-insert-contents'
reads the contents of the variable as a string.
The first element, `org-element-store-data', stores data on the
current state of all the links in the current buffer (except
the link at the top of the buffer). Each link in the buffer
has a variable value associated with it.
Each element in the string is of the form:
<type>
<name>
<begin>
<end>
where <type> contains the keyword type.
<begin> contains the keyword and start of the data field.
<end> contains the end of the data field.
</begin> is the end of data."
:group 'org-export-export-as
:line-end-double-space 'limit-to-result-end
:version "24.4" ; added by Bill O'Reilly
:options '(org-element--convert-standard-references
org-element--convert-standard-references-backward)
:tags '(:filter (org-element--convert-standard-references
nil t
'(("a-zA-Z0-9_") ("a-zA-Z0-9_" . "")
("A-Z_") ("A-Z_" . "")
("<begin>") ("<end>")
("<begin>") ("</end>")
("<begin>") ("<end>")
("<begin>") ("<end>")
("<begin>") ("<end>")
("<begin>") ("<end>"))
:type '(repeat face))
(defcustom org-element-store-context org-element--context-keyword
"Context keyword function.
`%s' means use this context when creating Org mode links
======== SAMPLE 154 ========
buffers
;; ;; ;; (not no-message)
;; (message "Error: not found")
(error "Error: not found")
;; (error "error")))))
(defun org-publish-info-file-for-changelog (file mode)
"Return an info file for CREATE FILE, a Changelog mode for Org mode files in FILE."
(let* ((file (expand-file-name
;; Add an extra `orgnode-changelog-format' line if
;; optional (e.g. in a headline). Otherwise, no `orgnode-changelog-format'
;; line might be there.
orgnode-changelog--changelog-format
(if orgnode-changelog-format
(format " %s" (org-babel-octet-string (org-string-to-terminator
(car file)))))))
(info (format "CREATE %s\n"
(org-babel-octet-string (org-string-to-abbrev ".")))))
(when info
(setq info (car info)))
(and info (concat "CREATE ?\\(?1:" (regexp-quote (buffer-file-name)))
(expand-file-name
(concat (if file " " "\\|" ":?:" info) "(?N-")))
info))
nil)
;;;; Obsolete Functions
(defun org-publish-update-table ()
"Update the table on publishing."
(interactive)
;; Update all functions. But do not create tables, we force a publishing because of
;; the way in which we work with publishing.
(org-publish-setup 'publish)
(org-publish-mode 1)
(org-publish-mode -3)
(org-publish-mode -5))
(defun org-publish-mode (file)
"Change the state of the org-publish table in FILE."
;; Add to the current settings. That could fix-it.
(setq file (expand-file-name ".*org" (or (plist-get org-directory :path)
"\\.org"))
table
(plist-put org-directory :path (org-remove (file-name-directory file))
table))))
(defun org-publish-load (&rest articles)
"Load ARTICLE."
(let (parsed)
(dolist (article articles)
(setq parsed (org-string-nw-p parsed))
(if (not parsed)
(progn
======== SAMPLE 155 ========
buffers
'(("\\(?:Cc\\|Cc\\+?\\)\") . "[") ; comment
;; Note: the code above used for the comment comment syntax.
("\\(?2m:[[{}\n].*?\\):[[{}\r]*?\\)[^ \t]*\\(?[?:]+\\)?"
"^[^:]()[]>:" (1 "<"))
("\\(?2m:\\(?:[:\n+]\\)+?\\)[^: \t]*?\\(?[: ]+:[:]\\)?"
(2 "\\([ \t]\\)*[ \t]+\\([^ \t\n]\\)*\\([^\n :]+\\)?"))
("\\(?:[^:<.>\n]+[\t]*\\(?[^\n :]+[\t]\\):[\t]*\\(?[^\n \t]\\)?:[\t]\\)?[\t].*?[^\n \t]*)\\)?"
"^[^:]+[ \t]*\\(?:[:>]\\)?\n[^[:]*?\\([.]+?\\)\\)"
"\\(?:[^[:;~.]+@\\)*[\t]*?\\(?:[:]\\)?[ \t]+:\\([.]+\\)?"
;; The code above did not handle the special case of \n,
;; so should not be used on comment characters.
("\\(?:[ \t]\\)?\\(?[\"&%%_].*?\\)?"
"'%%_" (1 "@'\\(.\\|%%_\\)?\\(?:[:]"))
;; Note: the code above used for the \n (which also doesn't use "@")
;; syntax.
("\\(?:\\[*(\\([ \t]+\\),\\)?)\\(.?[ \t]\\|\\(\\(\\*\\)\\)?\\(?[\t.]\\)?\\)?"
1 "[a-z_]+" (2 "\\([\\(?:@]\\|[.*\\*)\\)"))
;; Comment and comment-in-subr comments like these are recognized by
;; c-mode
;; See comments in the following two lines for the special
;; special handling of the \\(?\\)[^\n] character in these.
("\\<[^.]*$\\>\\s-*\\(?(\\(?[^:]+:<.>\n\\)*\\)?\\)?"
1 "@" (2 "\\([\\(?:@]\\|[.*\\*)\\)?\\(?:[.]\\)?\\)?"
(3 "@" (3 "\\([^:]+\\):[\t]*\\(?[ \t]\\)?\\(?[:.\\)?\\)?" 1))
("\\(\n\\)?\\.?\n@\\s-*$"
;; The regexp "\\(.*\\)?$" is the last regex followed by a character,
;; and is probably always a comment. The regexp below is ".*$", but
;; it may also be a comment or a non-empty string. ".*$" is
;; a non-continuation delimiter of "\\(.*\\)?$"
;; Note: The code above still treats comment comment characters like \\\(\\(?:\\([^ \t\n]+?\\)*\\)[^ \t\n]*)",
;; so may be a comment as an element. (Note: comment char ?!)
("\\>\\(\\sw+\\)" ; "`\\?$" or "`~$"))
("\\(?\\{1,2,3\\}"
======== SAMPLE 156 ========
buffers
(defsubst org-table-copy-file (file)
(interactive (list (org-read-file-name "Copy to file: ")))
(org-table->copy-file-1 file))
;;;###autoload
(defun org-table-show-header ()
"Reconcile Org tables on this table."
(interactive)
(org-table-move-to-column 1))
;;;###autoload
(defun org-table-align ()
"Reconcile all column columns before beginning one line."
(interactive)
(let ((left (move-to-column left nil nil t))
(top (move-to-column top nil t))
(right (move-to-column right nil t))
(left (and (not (bolp)) (bolp)))
(top (and (not (eolp)) (bolp)))
(width (current-column))
(col (or (current-column) (current-column)))
(column-width (if left 'width col))
(col-width (if right 'width col))
(indent (current-column))
(indent-pt (current-column)))
(while (> column 0)
(move-to-column (org-table-left (car right) (car left)))
(if (and (numberp (car left))
(equal (org-table-current-line-position) (point-max)))
(goto-char (or (and (bolp) (org-get-heading t))
(line-beginning-position))))
(let ((left-column
(save-excursion
(goto-char left-column)
(and (>= (current-column) bolp-column) indent-pt)
(+ 4 (current-column))))))
(setq left-column bolp-column))))
(defun org-table-align-right (width col)
"Align two tables, given by `org-table-columns'. WIDTH and COL specify
the width of the left edge of the table in columns.
For a fixed center of a table, the table will be aligned relative to
the buffer centered on the current column. The default is to align relative to
the column that is most recently used by the buffer at the beginning of
the buffer. (For example, if the buffer was set to current-column
at the start of the buffer, the column would align to left in that case.)
So an object of a table may be centered like this. The only difference is that
the first non-empty line of a table column is not in the buffer."
(interactive (list (org-read-only-string "Enter column: " org-table-columns)))
(if (not (and (> (current-column) width)
(or (equal width (window-width))
(> columns (1- (length org-table-last-field)))
(or (equal width (window-width))
(not (equal width (window-height))))))
(let ((left (- width))
(column (+ left (window-width)))
(col
======== SAMPLE 157 ========
buffers-mode)
(setq res (cadr res)))
(dolist (rhs (sort (copy-alist rhs) (lambda (x y) (and (integerp x) (integerp y) y))))
(let ((res (concat (car res) (car rhs)))) ; Xref
(should (equal (cdr res) res)))))
(ert-deftest test_nulllist ()
(should (equal (sort (cadr 'vec) '(nil)) '(nil . 0)))
(should (equal (sort (cadr 'vec) '(nil . 1)), '(1 1 . 0)))
(should (equal (sort (cadr 'vec) '(nil . 1)) '(nil . 0)))
(should (equal (sort (cars 'vec) '(nil . 1))))
(should (equal (cadr 'vec) '(nil . 1 . 0)))
(should (equal (cars 'vec) nil))
(should (equal (cadr (cddr 'vec))) 0))
;;; test_let_mutex_macro.el ends here
<|endoftext|>;;; tramp-connection.el --- tests for connection functions
;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Test for https://debbugs.gnu.org/16802.
;;; Code:
(ert-deftest tramp-connection-test-with-remote ()
"Check connection function `withremote'."
(skip-unless (tramp--test-enabled))
(skip-unless (not (tramp--test-windows-nt-and-y-deny-p
(tramp--test-call-process nil nil "bar" "-u" "bar" "echo echo $user1$1"
"$1")
tramp--test-windows-nt-and-y-deny-p))
(setq tramp-connection-properties nil)
;; Allow remote operations on `process-name'.
(should (string-equal
(apply #'format-message
"remote connection is "
(tramp-shell-quote-argument
,method "PRIVMSG")))))
;; Ensure temporary files are deleted before using the `withremote'.
(let ((tmpfile (tramp--test-make-tramp-connection proc nil 5)))
(with-current-buffer (tramp-get-connection-buffer tmpfile)
(should (buffer-string))
(should-error (with-tramp-connection-property proc (current-buffer)))
;; If `hosts' is nil, use the local IP address.
(should (string-equal (make-tramp-connection
(format "ssh:%s@%s:%s" "local" "hostname" tramp-local
======== SAMPLE 158 ========
buffers is set.
(defun org-src-block-indent-template ()
"Indent the current source block as a block.
Return nil if the point is not at the beginning of an indented
headline or section. Return the value of `point'."
(cond ((equal org-src-block-indent-template "") (org--beginning-of-indentation))
((eq org-src-block-indent-template 'heading)
(+ (org-entry-get nil :heading)
(if (or (member org-src-block-indent-template org-after-block-indent)
(member org-src-block-indent-template
'("" ".." ".." ".." ".." "..")))
(org-src-block-comment-line ".." ".." "..") t)
(org-src-line-beginning-position nil)
"\\>" org-end-align-at))
(t
(org-remove-indentation (org-element-property :contents-end text))
t)))))
(defun org-src-indented-line (&optional n)
"Return the indentation of the current line.
N means point starts at the beginning of the current line. Return
nil if point is not at the beginning of an indented headline or section."
(save-excursion
(let ((point nil))
(org-back-to-heading)
(skip-chars-backward " \t0-9")
(org-remove-indentation (if (bolp) (char-before) (point))))))
(defun org-remove-indentation (fmt)
(save-excursion
(if (looking-at "(\\* +")
(delete-char -1)
(delete-char 1)
(if (or regexp (search-forward "\\.* +")
(< (point) (progn (forward-line 1) (point)))
;; We have to re-type "\\*" when at the beginning of a comment
;; to leave point after the "!" character.
(setq fmt (format "%s" (substitute-command-keys
(or (org-element-rest-tag-keys
(org-element-parse-tree))
"\\>")))
(if (eq fmt 0) "\\*")
(replace-match "\\1" nil t)
(when (string-match "\\1" fmt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment