* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 Juanma Barranquero <lekktu@gmail.com>
+ * calculator.el (calculator): Mark unused argument.
+ (calculator-paste, calculator-quit, calculator-integer-p):
+ Use ignore-errors.
+ (calculator-string-to-number, calculator-decimal, calculator-exp)
+ (calculator-op-or-exp): Use string-match-p.
+
+ * dired.el (dired-buffer-more-recently-used-p): Declare.
+ (dired-insert-set-properties, dired-insert-old-subdirs):
+ Use ignore-errors.
+
+ * dired-aux.el (dired-compress): Use ignore-errors.
+ (dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
+ (dired-do-async-shell-command, dired-do-shell-command)
+ (dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
+ (dired-insert-subdir-validate): Use string-match-p.
+ (dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
+ (dired-add-entry): Use string-match-p, looking-at-p.
+ (dired-insert-subdir-newpos): Remove unused local variable.
+
+ * filenotify.el (file-notify-callback): Remove unused local variable.
+
+ * filesets.el (filesets-error): Mark unused argument.
+ (filesets-which-command-p, filesets-filter-dir-names)
+ (filesets-directory-files, filesets-get-external-viewer)
+ (filesets-ingroup-get-data): Use string-match-p.
+
+ * find-file.el (ff-other-file-name, ff-other-file-name)
+ (ff-find-the-other-file, ff-cc-hh-converter):
+ Remove unused local variables.
+ (ff-get-file-name): Use string-match-p.
+ (ff-all-dirs-under): Use ignore-errors.
+
+ * follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
+ (follow-select-if-visible): Remove unused local variable.
+
+ * forms.el (read-file-filter): Move declaration.
+ (forms--make-format, forms--make-parser, forms-insert-record):
+ Quote function with #'.
+ (forms--update): Use string-match-p. Quote function with #'.
+
+ * help-mode.el (help-dir-local-var-def): Mark unused argument.
+ (help-make-xrefs): Use looking-at-p.
+ (help-xref-on-pp): Use looking-at-p, ignore-errors.
+
+ * ibuffer.el (ibuffer-ext-visible-p): Declare.
+ (ibuffer-confirm-operation-on): Use string-match-p.
+
+ * msb.el (msb-item-handler, msb-dired-item-handler):
+ Mark unused arguments.
+
+ * ses.el (ses-decode-cell-symbol)
+ (ses-kill-override): Remove unused local variable.
+ (ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
+ (ses-load): Use ignore-errors, looking-at-p.
+ (ses-jump-safe): Use ignore-errors.
+ (ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
+
+ * tabify.el (untabify, tabify): Mark unused arguments.
+
+ * thingatpt.el (thing-at-point--bounds-of-well-formed-url):
+ Mark unused argument.
+ (bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
+ (thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
+
* emacs-lisp/timer.el (timer--time): Define setter with
gv-define-setter to avoid deprecation warning.
;; can't use 'noprompt, bug in electric.el
(lambda () 'noprompt)
nil
- (lambda (x y) (calculator-update-display))))
+ (lambda (_x _y) (calculator-update-display))))
(and calculator-buffer
(catch 'calculator-done (calculator-quit)))
(use-local-map old-l-map)
value)
(car (read-from-string
(cond ((equal "." str) "0.0")
- ((string-match "[eE][+-]?$" str) (concat str "0"))
- ((string-match "\\.[0-9]\\|[eE]" str) str)
- ((string-match "\\." str)
+ ((string-match-p "[eE][+-]?$" str) (concat str "0"))
+ ((string-match-p "\\.[0-9]\\|[eE]" str) str)
+ ((string-match-p "\\." str)
;; do this because Emacs reads "23." as an integer
(concat str "0"))
((stringp str) (concat str ".0"))
(or calculator-display-fragile
(not (numberp (car calculator-stack))))
(not (and calculator-curnum
- (string-match "[.eE]" calculator-curnum))))
+ (string-match-p "[.eE]" calculator-curnum))))
;; enter the period on the same condition as a digit, only if no
;; period or exponent entered yet
(progn
(if (and (or calculator-display-fragile
(not (numberp (car calculator-stack))))
(not (and calculator-curnum
- (string-match "[eE]" calculator-curnum))))
+ (string-match-p "[eE]" calculator-curnum))))
;; same condition as above, also no E so far
(progn
(calculator-clear-fragile)
(interactive)
(if (and (not calculator-display-fragile)
calculator-curnum
- (string-match "[eE]$" calculator-curnum))
+ (string-match-p "[eE]$" calculator-curnum))
(calculator-digit)
(calculator-op)))
(setq str (concat (or (match-string 1 str) "0")
(or (match-string 2 str) ".0")
(or (match-string 3 str) ""))))
- (condition-case nil (calculator-string-to-number str)
- (error nil)))))
+ (ignore-errors (calculator-string-to-number str)))))
(defun calculator-get-register (reg)
"Get a value from a register REG."
(interactive)
(set-buffer calculator-buffer)
(let ((inhibit-read-only t)) (erase-buffer))
- (if (not calculator-electric-mode)
- (progn
- (condition-case nil
- (while (get-buffer-window calculator-buffer)
- (delete-window (get-buffer-window calculator-buffer)))
- (error nil))
- (kill-buffer calculator-buffer)))
+ (unless calculator-electric-mode
+ (ignore-errors
+ (while (get-buffer-window calculator-buffer)
+ (delete-window (get-buffer-window calculator-buffer))))
+ (kill-buffer calculator-buffer))
(setq calculator-buffer nil)
(message "Calculator done.")
(if calculator-electric-mode (throw 'calculator-done nil)))
(defun calculator-integer-p (x)
"Non-nil if X is equal to an integer."
- (condition-case nil
- (= x (ftruncate x))
- (error nil)))
+ (ignore-errors (= x (ftruncate x))))
(defun calculator-expt (x y)
"Compute X^Y, dealing with errors appropriately."
- (condition-case
- nil
+ (condition-case nil
(expt x y)
(domain-error 0.0e+NaN)
(range-error
(if (eq op-symbol 'touch)
(list "-t" new-attribute)
(list new-attribute)))
- (if (string-match "gnu" system-configuration)
+ (if (string-match-p "gnu" system-configuration)
'("--") nil))
files))
(dired-do-redisplay arg);; moves point if ARG is an integer
;; We used to treat empty input as DEFAULT, but that is not
;; such a good idea (Bug#9361).
(error "No file mode specified"))
- ((string-match "^[0-7]+" modes)
+ ((string-match-p "^[0-7]+" modes)
(setq num-modes (string-to-number modes 8))))
(dolist (file files)
(goto-char (point-min))
(while (not (eobp))
(save-excursion
- (and (not (looking-at dired-re-dir))
+ (and (not (looking-at-p dired-re-dir))
(not (eolp))
(setq file (dired-get-filename nil t)) ; nil on non-file
(progn (end-of-line)
dired-file-version-alist)))))))
(defun dired-trample-file-versions (fn)
- (let* ((start-vn (string-match "\\.~[0-9]+~$" fn))
+ (let* ((start-vn (string-match-p "\\.~[0-9]+~$" fn))
base-version-list)
(and start-vn
(setq base-version-list ; there was a base version to which
(dired-read-shell-command "& on %s: " current-prefix-arg files)
current-prefix-arg
files)))
- (unless (string-match "&[ \t]*\\'" command)
+ (unless (string-match-p "&[ \t]*\\'" command)
(setq command (concat command " &")))
(dired-do-shell-command command arg file-list))
(dired-read-shell-command "! on %s: " current-prefix-arg files)
current-prefix-arg
files)))
- (let* ((on-each (not (string-match dired-star-subst-regexp command)))
- (no-subst (not (string-match dired-quark-subst-regexp command)))
- (star (string-match "\\*" command))
- (qmark (string-match "\\?" command)))
+ (let* ((on-each (not (string-match-p dired-star-subst-regexp command)))
+ (no-subst (not (string-match-p dired-quark-subst-regexp command)))
+ (star (string-match-p "\\*" command))
+ (qmark (string-match-p "\\?" command)))
;; Get confirmation for wildcards that may have been meant
;; to control substitution of a file name or the file name list.
(if (cond ((not (or on-each no-subst))
(substring command 0 (match-beginning 0))
command))
(stuff-it
- (if (or (string-match dired-star-subst-regexp command)
- (string-match dired-quark-subst-regexp command))
+ (if (or (string-match-p dired-star-subst-regexp command)
+ (string-match-p dired-quark-subst-regexp command))
(lambda (x)
(let ((retval command))
(while (string-match
(if new-file
(let ((start (point)))
;; Remove any preexisting entry for the name NEW-FILE.
- (condition-case nil
- (dired-remove-entry new-file)
- (error nil))
+ (ignore-errors (dired-remove-entry new-file))
(goto-char start)
;; Now replace the current line with an entry for NEW-FILE.
(dired-update-file-line new-file) nil)
;; See if any suffix rule matches this file name.
(while suffixes
(let (case-fold-search)
- (if (string-match (car (car suffixes)) file)
+ (if (string-match-p (car (car suffixes)) file)
(setq suffix (car suffixes) suffixes nil))
(setq suffixes (cdr suffixes))))
;; If so, compute desired new name.
;; Avoid calling ls for files that are going to be omitted anyway.
(let ((omit-re (dired-omit-regexp)))
(or (string= omit-re "")
- (not (string-match omit-re
- (cond
- ((eq 'no-dir dired-omit-localp)
- filename)
- ((eq t dired-omit-localp)
- (dired-make-relative filename))
- (t
- (dired-make-absolute
- filename
- (file-name-directory filename)))))))))
+ (not (string-match-p omit-re
+ (cond
+ ((eq 'no-dir dired-omit-localp)
+ filename)
+ ((eq t dired-omit-localp)
+ (dired-make-relative filename))
+ (t
+ (dired-make-absolute
+ filename
+ (file-name-directory filename)))))))))
;; Do it!
(progn
(setq filename (directory-file-name filename))
;; else try to find correct place to insert
(if (dired-goto-subdir directory)
(progn ;; unhide if necessary
- (if (looking-at "\r")
+ (if (looking-at-p "\r")
;; Point is at end of subdir line.
(dired-unhide-subdir))
;; found - skip subdir and `total' line
(and (not switches) cons (setq switches (cdr cons)))
(dired-insert-subdir-validate dirname switches)
;; case-fold-search is nil now, so we can test for capital `R':
- (if (setq switches-have-R (and switches (string-match "R" switches)))
+ (if (setq switches-have-R (and switches (string-match-p "R" switches)))
;; avoid duplicated subdirs
(setq mark-alist (dired-kill-tree dirname t)))
(if elt
(mapcar
(function
(lambda (x)
- (or (eq (null (string-match x real-switches))
- (null (string-match x dired-actual-switches)))
+ (or (eq (null (string-match-p x real-switches))
+ (null (string-match-p x dired-actual-switches)))
(error
"Can't have dirs with and without -%s switches together" x))))
;; all switches that make a difference to dired-get-filename:
(defun dired-insert-subdir-newpos (new-dir)
;; Find pos for new subdir, according to tree order.
;;(goto-char (point-max))
- (let ((alist dired-subdir-alist) elt dir pos new-pos)
+ (let ((alist dired-subdir-alist) elt dir new-pos)
(while alist
(setq elt (car alist)
alist (cdr alist)
(and selective-display
(save-excursion
(dired-goto-subdir dir)
- (looking-at "\r"))))
+ (looking-at-p "\r"))))
;;;###autoload
(defun dired-hide-subdir (arg)
;;; Code:
+(declare-function dired-buffer-more-recently-used-p
+ "dired-x" (buffer1 buffer2))
+
;;; Customizable variables
(defgroup dired nil
(save-excursion
(goto-char beg)
(while (< (point) end)
- (condition-case nil
- (if (not (dired-move-to-filename))
- (put-text-property (line-beginning-position)
- (1+ (line-end-position))
- 'invisible 'dired-hide-details-information)
- (put-text-property (+ (line-beginning-position) 1) (1- (point))
- 'invisible 'dired-hide-details-detail)
- (add-text-properties
- (point)
- (progn
- (dired-move-to-end-of-filename)
- (point))
- '(mouse-face
- highlight
- dired-filename t
- help-echo "mouse-2: visit this file in other window"))
- (when (< (+ (point) 4) (line-end-position))
- (put-text-property (+ (point) 4) (line-end-position)
- 'invisible 'dired-hide-details-link)))
- (error nil))
+ (ignore-errors
+ (if (not (dired-move-to-filename))
+ (put-text-property (line-beginning-position)
+ (1+ (line-end-position))
+ 'invisible 'dired-hide-details-information)
+ (put-text-property (+ (line-beginning-position) 1) (1- (point))
+ 'invisible 'dired-hide-details-detail)
+ (add-text-properties
+ (point)
+ (progn
+ (dired-move-to-end-of-filename)
+ (point))
+ '(mouse-face
+ highlight
+ dired-filename t
+ help-echo "mouse-2: visit this file in other window"))
+ (when (< (+ (point) 4) (line-end-position))
+ (put-text-property (+ (point) 4) (line-end-position)
+ 'invisible 'dired-hide-details-link))))
(forward-line 1))))
\f
;; Reverting a dired buffer
(setq elt (car old-subdir-alist)
old-subdir-alist (cdr old-subdir-alist)
dir (car elt))
- (condition-case ()
- (progn
- (dired-uncache dir)
- (dired-insert-subdir dir))
- (error nil))))))
+ (ignore-errors
+ (dired-uncache dir)
+ (dired-insert-subdir dir))))))
(defun dired-uncache (dir)
"Remove directory DIR from any directory cache."
\f
;;; Start of automatically extracted autoloads.
\f
-;;;### (autoloads nil "dired-aux" "dired-aux.el" "555c067fcab27f5a377536db407803ab")
+;;;### (autoloads nil "dired-aux" "dired-aux.el" "04b4cb6bde3220f55574eb1d99ac0d29")
;;; Generated autoloads from dired-aux.el
(autoload 'dired-diff "dired-aux" "\
(pending-event (assoc desc file-notify--pending-events))
(actions (nth 1 event))
(file (file-notify--event-file-name event))
- file1 cookie callback)
+ file1 callback)
;; Make actions a list.
(unless (consp actions) (setq actions (cons actions nil)))
(defun filesets-which-command-p (cmd)
"Call \"which CMD\" and return non-nil if the command was found."
- (when (string-match (format "\\(/[^/]+\\)?/%s" cmd)
- (filesets-which-command cmd))
+ (when (string-match-p (format "\\(/[^/]+\\)?/%s" cmd)
+ (filesets-which-command cmd))
cmd))
(defun filesets-message (level &rest args)
(require 'easymenu)
- (defun filesets-error (class &rest args)
+ (defun filesets-error (_class &rest args)
"`error' wrapper."
(error "%s" (mapconcat 'identity args " ")))
If NEGATIVE is non-nil, remove all directory names."
(filesets-filter-list lst
(lambda (x)
- (and (not (string-match "^\\.+/$" x))
+ (and (not (string-match-p "^\\.+/$" x))
(if negative
- (not (string-match "[:/\\]$" x))
- (string-match "[:/\\]$" x))))))
+ (not (string-match-p "[:/\\]$" x))
+ (string-match-p "[:/\\]$" x))))))
(defun filesets-conditional-sort (lst &optional access-fn)
"Return a sorted copy of LST, LST being a list of strings.
(dirs nil))
(dolist (this (file-name-all-completions "" dir))
(cond
- ((string-match "^\\.+/$" this)
+ ((string-match-p "^\\.+/$" this)
nil)
- ((string-match "[:/\\]$" this)
+ ((string-match-p "[:/\\]$" this)
(when (or (not match-dirs-flag)
(not pattern)
- (string-match pattern this))
+ (string-match-p pattern this))
(filesets-message 5 "Filesets: matched dir %S with pattern %S"
this pattern)
(setq dirs (cons this dirs))))
(t
(when (or (not pattern)
- (string-match pattern this))
+ (string-match-p pattern this))
(filesets-message 5 "Filesets: matched file %S with pattern %S"
this pattern)
(setq files (cons (if full-flag
(let ((filename (file-name-nondirectory file)))
(filesets-some
(lambda (entry)
- (when (and (string-match (nth 0 entry) filename)
+ (when (and (string-match-p (nth 0 entry) filename)
(filesets-eviewer-constraint-p entry))
entry))
filesets-external-viewers)))
(fn (or fun (lambda (a b)
(and (stringp a)
(stringp b)
- (string-match a b))))))
+ (string-match-p a b))))))
(filesets-some (lambda (x)
(if (funcall fn (car x) masterfile)
(nth pos x)
stub ;; name of the file without extension
alist ;; working copy of the list of file extensions
pathname ;; the pathname of the file or the #include line
- default-name ;; file we should create if none found
format ;; what we have to match
found ;; name of the file or buffer found - nil if none
- dirs ;; local value of ff-search-directories
- no-match) ;; whether we know about this kind of file
+ dirs) ;; local value of ff-search-directories
(message "Working...")
(cond
((and (not ff-ignore-include) fname)
- (setq default-name fname)
(setq found (ff-get-file-name dirs fname nil)))
;; let's just get the corresponding file
"/none.none"))
(setq fname (file-name-nondirectory pathname)
- no-match nil
match (car alist))
;; find the table entry corresponding to this file
(setq pos (ff-string-match (car match) fname)))
;; no point going on if we haven't found anything
- (if (not match)
- (setq no-match t)
+ (when match
;; otherwise, suffixes contains what we need
(setq suffixes (car (cdr match))
(progn
(setq suffixes (funcall action (buffer-file-name))
match (cons (car match) (list suffixes))
- stub nil
- default-name (car suffixes)))
+ stub nil))
;; otherwise build our filename stub
(cond
(setq format (concat "\\(.+\\)" (car match)))
(string-match format fname)
(setq stub (substring fname (match-beginning 1) (match-end 1)))
- ))
-
- ;; if we find nothing, we should try to get a file like this one
- (setq default-name
- (concat stub (car (car (cdr match))))))
+ )))
;; do the real work - find the file
(setq found
(setq buf (buffer-name (car blist)))
(while (and blist (not found))
- (if (string-match (concat filename "<[0-9]+>") buf)
+ (if (string-match-p (concat filename "<[0-9]+>") buf)
(setq found (buffer-file-name (car blist))))
(setq blist (cdr blist))
"Get all the directory files under directory HERE.
Exclude all files in the optional EXCLUDE list."
(if (file-directory-p here)
- (condition-case nil
- (progn
- (let ((files (directory-files here t))
- (dirlist (list))
- file)
- (while files
- (setq file (car files))
- (if (and
- (file-directory-p file)
- (not (member (ff-basename file) exclude)))
- (setq dirlist (cons file dirlist)))
- (setq files (cdr files)))
- (setq dirlist (reverse dirlist))))
- (error nil))
+ (ignore-errors
+ (let ((files (directory-files here t))
+ (dirlist (list))
+ file)
+ (while files
+ (setq file (car files))
+ (if (and
+ (file-directory-p file)
+ (not (member (ff-basename file) exclude)))
+ (setq dirlist (cons file dirlist)))
+ (setq files (cdr files)))
+ (setq dirlist (reverse dirlist))))
nil))
(defun ff-switch-file (f1 f2 file &optional in-other-window new-file)
Build up a new file list based possibly on part of the directory name
and the name of the file passed in."
(ff-string-match "\\(.*\\)/\\([^/]+\\)/\\([^.]+\\).\\([^/]+\\)$" arg)
- (let ((path (if (match-beginning 1)
- (substring arg (match-beginning 1) (match-end 1)) nil))
- (dire (if (match-beginning 2)
+ (let ((dire (if (match-beginning 2)
(substring arg (match-beginning 2) (match-end 2)) nil))
(file (if (match-beginning 3)
(substring arg (match-beginning 3) (match-end 3)) nil))
(declare-function comint-adjust-point "comint" (window))
(defvar comint-scroll-show-maximum-output)
-(defun follow-comint-scroll-to-bottom (&optional window)
+(defun follow-comint-scroll-to-bottom (&optional _window)
"Scroll the bottom-most window in the current Follow chain.
This is to be called by `comint-postoutput-scroll-to-bottom'."
(let* ((buffer (current-buffer))
(defun follow-select-if-visible (dest win-start-end)
"Select and return a window, if DEST is visible in it.
Return the selected window."
- (let (win win-end wse)
+ (let (win wse)
(while (and (not win) win-start-end)
;; Don't select a window that was just moved. This makes it
;; possible to later select the last window after a
;; `end-of-buffer' command.
(setq wse (car win-start-end))
(when (follow-pos-visible dest (car wse) win-start-end)
- (setq win (car wse)
- win-end (nth 2 wse))
+ (setq win (car wse))
(select-window win))
(setq win-start-end (cdr win-start-end)))
win))
(defvar forms--rw-face nil
"Face used to represent read-write data on the screen.")
\f
+(defvar read-file-filter) ; bound in forms--intuit-from-file
+
;;;###autoload
(defun forms-mode (&optional primary)
"Major mode to visit files in a field-structured manner using a form.
`(lambda (arg)
(let ((inhibit-read-only t))
,@(apply 'append
- (mapcar 'forms--make-format-elt-using-text-properties
+ (mapcar #'forms--make-format-elt-using-text-properties
forms-format-list))
;; Prevent insertion before the first text.
,@(if (numberp (car forms-format-list))
(setq forms--iif-start nil))
`(lambda (arg)
,@(apply 'append
- (mapcar 'forms--make-format-elt forms-format-list)))))
+ (mapcar #'forms--make-format-elt forms-format-list)))))
;; We have tallied the number of markers and dynamic texts,
;; so we can allocate the arrays now.
(goto-char (point-min))
,@(apply 'append
(mapcar
- 'forms--make-parser-elt
+ #'forms--make-parser-elt
(append forms-format-list (list nil)))))))))
(forms--debug 'forms--parser))
(setq forms--field nil)))
))
\f
-(defvar read-file-filter) ; bound in forms--intuit-from-file
-
(defun forms--intuit-from-file ()
"Get number of fields and a default form using the data file."
;; Build new record.
(setq forms--the-record-list (forms--parse-form))
(setq the-record
- (mapconcat 'identity forms--the-record-list forms-field-sep))
+ (mapconcat #'identity forms--the-record-list forms-field-sep))
- (if (string-match (regexp-quote forms-field-sep)
- (mapconcat 'identity forms--the-record-list ""))
+ (if (string-match-p (regexp-quote forms-field-sep)
+ (mapconcat #'identity forms--the-record-list ""))
(error "Field separator occurs in record - update refused"))
;; Handle multi-line fields, if allowed.
(forms--trans the-record "\n" forms-multi-line))
;; A final sanity check before updating.
- (if (string-match "\n" the-record)
+ (if (string-match-p "\n" the-record)
(error "Multi-line fields in this record - update refused"))
(with-current-buffer forms--file-buffer
(setq the-list (cdr (append the-fields nil))))
(setq the-list (make-list forms-number-of-fields "")))
- (setq the-record
- (mapconcat
- 'identity
- the-list
- forms-field-sep))
+ (setq the-record (mapconcat #'identity the-list forms-field-sep))
(with-current-buffer forms--file-buffer
(forms--goto-record ln)
(define-button-type 'help-dir-local-var-def
:supertype 'help-xref
- 'help-function (lambda (var &optional file)
+ 'help-function (lambda (_var &optional file)
;; FIXME: this should go to the point where the
;; local variable was defined.
(find-file file))
(while
(and (not (eobp))
;; Stop at a pair of blank lines.
- (not (looking-at "\n\\s-*\n")))
+ (not (looking-at-p "\n\\s-*\n")))
;; Skip a single blank line.
(and (eolp) (forward-line))
(end-of-line)
(save-restriction
(narrow-to-region from to)
(goto-char (point-min))
- (condition-case nil
- (while (not (eobp))
- (cond
- ((looking-at "\"") (forward-sexp 1))
- ((looking-at "#<") (search-forward ">" nil 'move))
- ((looking-at "\\(\\(\\sw\\|\\s_\\)+\\)")
- (let* ((sym (intern-soft (match-string 1)))
- (type (cond ((fboundp sym) 'help-function)
- ((or (memq sym '(t nil))
- (keywordp sym))
- nil)
- ((and sym
- (or (boundp sym)
- (get sym
- 'variable-documentation)))
- 'help-variable))))
- (when type (help-xref-button 1 type sym)))
- (goto-char (match-end 1)))
- (t (forward-char 1))))
- (error nil)))))))
+ (ignore-errors
+ (while (not (eobp))
+ (cond
+ ((looking-at-p "\"") (forward-sexp 1))
+ ((looking-at-p "#<") (search-forward ">" nil 'move))
+ ((looking-at "\\(\\(\\sw\\|\\s_\\)+\\)")
+ (let* ((sym (intern-soft (match-string 1)))
+ (type (cond ((fboundp sym) 'help-function)
+ ((or (memq sym '(t nil))
+ (keywordp sym))
+ nil)
+ ((and sym
+ (or (boundp sym)
+ (get sym
+ 'variable-documentation)))
+ 'help-variable))))
+ (when type (help-xref-button 1 type sym)))
+ (goto-char (match-end 1)))
+ (t (forward-char 1))))))))))
\f
;; Additional functions for (re-)creating types of help buffers.
(defvar ibuffer-tmp-hide-regexps)
(defvar ibuffer-tmp-show-regexps)
+(declare-function ibuffer-ext-visible-p "ibuf-ext"
+ (buf all &optional ibuffer-buf))
(declare-function ibuffer-mark-on-buffer "ibuf-ext"
(func &optional ibuffer-mark-on-buffer-mark group))
(declare-function ibuffer-generate-filter-groups "ibuf-ext"
(and (stringp (cadr err))
;; This definitely falls in the
;; ghetto hack category...
- (not (string-match "too small" (cadr err)))))
+ (not (string-match-p "too small" (cadr err)))))
(signal (car err) (cdr err))
(enlarge-window 3))))))
(select-window (next-window))
;;;
;;; Some example function to be used for `msb-item-handling-function'.
;;;
-(defun msb-item-handler (buffer &optional maxbuf)
+(defun msb-item-handler (_buffer &optional _maxbuf)
"Create one string item, concerning BUFFER, for the buffer menu.
The item looks like:
*% <buffer-name>
(error "Unknown type of `dired-directory' in buffer %s"
(buffer-name)))))
-(defun msb-dired-item-handler (buffer &optional maxbuf)
+(defun msb-dired-item-handler (_buffer &optional _maxbuf)
"Create one string item, concerning a dired BUFFER, for the buffer menu.
The item looks like:
*% <buffer-name>
(and (string-match "\\`\\([A-Z]+\\)\\([0-9]+\\)\\'" str)
(let* ((col-str (match-string-no-properties 1 str))
(col 0)
- (col-offset 0)
(col-base 1)
(col-idx (1- (length col-str)))
(row (1- (string-to-number (match-string-no-properties 2 str)))))
Return nil in case of failure."
(unless (local-variable-p sym)
(make-local-variable sym)
- (if (let (case-fold-search) (string-match "\\`[A-Z]+[0-9]+\\'" (symbol-name sym)))
+ (if (let (case-fold-search) (string-match-p "\\`[A-Z]+[0-9]+\\'" (symbol-name sym)))
(put sym 'ses-cell (cons row col))
(put sym 'ses-cell :ses-named)
(setq ses--named-cell-hashmap (or ses--named-cell-hashmap (make-hash-table :test 'eq)))
(let (rowcol result)
(if (or (atom formula) (eq (car formula) 'quote))
(if (and (setq rowcol (ses-sym-rowcol formula))
- (string-match "\\`[A-Z]+[0-9]+\\'" (symbol-name formula)))
+ (string-match-p "\\`[A-Z]+[0-9]+\\'" (symbol-name formula)))
(ses-relocate-symbol formula rowcol
startrow startcol rowincr colincr)
formula) ; Pass through as-is.
(search-backward ";; Local Variables:\n" nil t)
(backward-list 1)
(setq ses--params-marker (point-marker))
- (let ((params (condition-case nil (read (current-buffer)) (error nil))))
+ (let ((params (ignore-errors (read (current-buffer)))))
(or (and (= (safe-length params) 3)
(numberp (car params))
(numberp (cadr params))
;; Skip over print area, which we assume is correct.
(goto-char (point-min))
(forward-line ses--numrows)
- (or (looking-at ses-print-data-boundary)
+ (or (looking-at-p ses-print-data-boundary)
(error "Missing marker between print and data areas"))
(forward-char 1)
(setq ses--data-marker (point-marker))
(dotimes (col ses--numcols)
(let* ((x (read (current-buffer)))
(sym (car-safe (cdr-safe x))))
- (or (and (looking-at "\n")
+ (or (and (looking-at-p "\n")
(eq (car-safe x) 'ses-cell)
(ses-create-cell-variable sym row col))
(error "Cell-def error"))
(eval x)))
- (or (looking-at "\n\n")
+ (or (looking-at-p "\n\n")
(error "Missing blank line between rows")))
;; Load global parameters.
(let ((widths (read (current-buffer)))
(1value (eval head-row)))
;; Should be back at global-params.
(forward-char 1)
- (or (looking-at (replace-regexp-in-string "1" "[0-9]+"
- ses-initial-global-parameters))
+ (or (looking-at-p (replace-regexp-in-string "1" "[0-9]+"
+ ses-initial-global-parameters))
(error "Problem with column-defs or global-params"))
;; Check for overall newline count in definitions area.
(forward-line 3)
(defun ses-jump-safe (cell)
"Like `ses-jump', but no error if invalid cell."
- (condition-case nil
- (ses-jump cell)
- (error)))
+ (ignore-errors
+ (ses-jump cell)))
(defun ses-reprint-all (&optional nonarrow)
"Recreate the display area. Calls all printer functions. Narrows to
;; For some reason, the text-read-only error is not caught by `delete-region',
;; so we have to use subterfuge.
(let ((buffer-read-only t))
- (1value (condition-case x
+ (1value (condition-case nil
(noreturn (funcall (lookup-key (current-global-map)
(this-command-keys))
beg end))
(ses-col-printer (1- ses--numcols)))))
rowcol))
-(defun ses-export-tsv (beg end)
+(defun ses-export-tsv (_beg _end)
"Export values from the current range, with tabs between columns and
newlines between rows. Result is placed in kill ring."
(interactive "r")
(ses-export-tab nil))
-(defun ses-export-tsf (beg end)
+(defun ses-export-tsf (_beg _end)
"Export formulas from the current range, with tabs between columns and
newlines between rows. Result is placed in kill ring."
(interactive "r")
(let* ((x (ses-sym-rowcol ref))
(xcell (ses-get-cell (car x) (cdr x))))
(ses-cell-references-aset xcell
- (cons new-name (delq sym
+ (cons new-name (delq sym
(ses-cell-references xcell))))))
(push new-name ses--renamed-cell-symb-list)
(set new-name (symbol-value sym))
current column and continues until the next nonblank column."
(ses-center-span value ?~))
-(defun ses-unsafe (value)
+(defun ses-unsafe (_value)
"Substitute for an unsafe formula or printer."
(error "Unsafe formula or printer"))
;;; Code:
;;;###autoload
-(defun untabify (start end &optional arg)
+(defun untabify (start end &optional _arg)
"Convert all tabs in region to multiple spaces, preserving columns.
If called interactively with prefix ARG, convert for the entire
buffer.
\"^\\t* [ \\t]+\" is also useful, for tabifying only initial whitespace.")
;;;###autoload
-(defun tabify (start end &optional arg)
+(defun tabify (start end &optional _arg)
"Convert multiple spaces in region to tabs when possible.
A group of spaces is partially replaced by tabs
when this can be done without changing the column they end at.
(if (get thing 'bounds-of-thing-at-point)
(funcall (get thing 'bounds-of-thing-at-point))
(let ((orig (point)))
- (condition-case nil
- (save-excursion
- ;; Try moving forward, then back.
- (funcall ;; First move to end.
- (or (get thing 'end-op)
- (lambda () (forward-thing thing 1))))
- (funcall ;; Then move to beg.
- (or (get thing 'beginning-op)
- (lambda () (forward-thing thing -1))))
- (let ((beg (point)))
- (if (<= beg orig)
- ;; If that brings us all the way back to ORIG,
- ;; it worked. But END may not be the real end.
- ;; So find the real end that corresponds to BEG.
- ;; FIXME: in which cases can `real-end' differ from `end'?
- (let ((real-end
- (progn
- (funcall
- (or (get thing 'end-op)
- (lambda () (forward-thing thing 1))))
- (point))))
- (when (and (<= orig real-end) (< beg real-end))
- (cons beg real-end)))
- (goto-char orig)
- ;; Try a second time, moving backward first and then forward,
- ;; so that we can find a thing that ends at ORIG.
- (funcall ;; First, move to beg.
- (or (get thing 'beginning-op)
- (lambda () (forward-thing thing -1))))
- (funcall ;; Then move to end.
- (or (get thing 'end-op)
- (lambda () (forward-thing thing 1))))
- (let ((end (point))
- (real-beg
+ (ignore-errors
+ (save-excursion
+ ;; Try moving forward, then back.
+ (funcall ;; First move to end.
+ (or (get thing 'end-op)
+ (lambda () (forward-thing thing 1))))
+ (funcall ;; Then move to beg.
+ (or (get thing 'beginning-op)
+ (lambda () (forward-thing thing -1))))
+ (let ((beg (point)))
+ (if (<= beg orig)
+ ;; If that brings us all the way back to ORIG,
+ ;; it worked. But END may not be the real end.
+ ;; So find the real end that corresponds to BEG.
+ ;; FIXME: in which cases can `real-end' differ from `end'?
+ (let ((real-end
(progn
(funcall
- (or (get thing 'beginning-op)
- (lambda () (forward-thing thing -1))))
+ (or (get thing 'end-op)
+ (lambda () (forward-thing thing 1))))
(point))))
- (if (and (<= real-beg orig) (<= orig end) (< real-beg end))
- (cons real-beg end))))))
- (error nil)))))
+ (when (and (<= orig real-end) (< beg real-end))
+ (cons beg real-end)))
+ (goto-char orig)
+ ;; Try a second time, moving backward first and then forward,
+ ;; so that we can find a thing that ends at ORIG.
+ (funcall ;; First, move to beg.
+ (or (get thing 'beginning-op)
+ (lambda () (forward-thing thing -1))))
+ (funcall ;; Then move to end.
+ (or (get thing 'end-op)
+ (lambda () (forward-thing thing 1))))
+ (let ((end (point))
+ (real-beg
+ (progn
+ (funcall
+ (or (get thing 'beginning-op)
+ (lambda () (forward-thing thing -1))))
+ (point))))
+ (if (and (<= real-beg orig) (<= orig end) (< real-beg end))
+ (cons real-beg end))))))))))
;;;###autoload
(defun thing-at-point (thing &optional no-properties)
\[Internal function used by `bounds-of-thing-at-point'.]"
(save-excursion
(let ((opoint (point))
- (beg (condition-case nil
- (progn (up-list -1)
- (point))
- (error nil))))
- (condition-case nil
- (if beg
- (progn (forward-sexp)
- (cons beg (point)))
- ;; Are we are at the beginning of a top-level sexp?
- (forward-sexp)
- (let ((end (point)))
- (backward-sexp)
- (if (>= opoint (point))
- (cons opoint end))))
- (error nil)))))
+ (beg (ignore-errors
+ (up-list -1)
+ (point))))
+ (ignore-errors
+ (if beg
+ (progn (forward-sexp)
+ (cons beg (point)))
+ ;; Are we are at the beginning of a top-level sexp?
+ (forward-sexp)
+ (let ((end (point)))
+ (backward-sexp)
+ (if (>= opoint (point))
+ (cons opoint end))))))))
;; Defuns
(if found
(cons (match-beginning 1) (match-end 1))))))
-(defun thing-at-point--bounds-of-well-formed-url (beg end pt)
+(defun thing-at-point--bounds-of-well-formed-url (beg end _pt)
(save-excursion
(goto-char beg)
(let (url-beg paren-end regexp)
htb ret)
(while htbs
(setq htb (car htbs) htbs (cdr htbs))
- (condition-case nil
- (progn
- ;; errs: htb symbol may be unbound, or not a hash-table.
- ;; gnus-gethash is just a macro for intern-soft.
- (and (symbol-value htb)
- (intern-soft string (symbol-value htb))
- (setq ret string htbs nil))
- ;; If we made it this far, gnus is running, so ignore "heads":
- (setq heads nil))
- (error nil)))
+ (ignore-errors
+ ;; errs: htb symbol may be unbound, or not a hash-table.
+ ;; gnus-gethash is just a macro for intern-soft.
+ (and (symbol-value htb)
+ (intern-soft string (symbol-value htb))
+ (setq ret string htbs nil))
+ ;; If we made it this far, gnus is running, so ignore "heads":
+ (setq heads nil)))
(or ret (not heads)
(let ((head (string-match "\\`\\([[:lower:]]+\\)\\." string)))
(and head (setq head (substring string 0 (match-end 1)))
(car read-data))))
(defun form-at-point (&optional thing pred)
- (let ((sexp (condition-case nil
- (read-from-whole-string (thing-at-point (or thing 'sexp)))
- (error nil))))
+ (let ((sexp (ignore-errors
+ (read-from-whole-string (thing-at-point (or thing 'sexp))))))
(if (or (not pred) (funcall pred sexp)) sexp)))
;;;###autoload