From 4bdf2ad22276502950290f02d4f8c82b83b5c44a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Bela=C3=AFche?= Date: Tue, 27 Dec 2011 20:30:39 +0100 Subject: [PATCH 01/36] The overall change is to add cell renaming, that is setting fancy names for cell symbols other than name matching "\\`[A-Z]+[0-9]+\\'" regexp . (ses-create-cell-variable): New defun. (ses-relocate-formula): Relocate formulas only for cells the symbols of which are not renamed, i.e. symbols whose names do not match regexp "\\`[A-Z]+[0-9]+\\'". (ses-relocate-all): Relocate values only for cells the symbols of which are not renamed. (ses-load): Create cells variables as the (ses-cell ...) are read, in order to check row col consistency with cell symbol name only for cells that are not renamed. (ses-replace-name-in-formula): New defun. (ses-rename-cell): New defun. (ses-call-printer-return, ses-cell-property-get) (ses-sym-rowcol, ses-printer-validate, ses-formula-record) (ses-create-cell-variable, ses-reset-header-string) (ses-cell-set-formula, ses-repair-cell-reference-all) (ses-self-reference-early-detection, ses-in-print-area, ses-set-curcell) (ses-check-curcell, ses-call-printer, ses-adjust-print-width) (ses-print-cell-new-width, ses-formula-references, ses-relocate-formula) (ses-aset-with-undo, ses-load, ses-truncate-cell) (ses-read-column-printer, ses-read-default-printer, ses-insert-row) (ses-delete-row, ses-delete-column, ses-append-row-jump-first-column) (ses-kill-override, ses-yank-pop, ses-yank-cells, ses-yank-tsf) (ses-yank-resize, ses-export-tab, ses-mark-row, ses-mark-column) (ses-renarrow-buffer, ses-insert-range, ses-insert-ses-range) (ses-safe-printer, ses-safe-formula, ses-warn-unsafe, ses--clean-!) (ses--clean-_, ses-range, ses-select, ses-center, ses-center-span) (ses-dashfill, ses-unsafe): Fix typos and reflow docstrings. --- lisp/ChangeLog | 34 ++++++ lisp/ses.el | 321 ++++++++++++++++++++++++++++++++----------------- 2 files changed, 242 insertions(+), 113 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 67615431b8f..29cb0334fb0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,37 @@ +2011-12-27 Vincent Belaïche + + * ses.el: The overall change is to add cell renaming, that is + setting fancy names for cell symbols other than name matching + "\\`[A-Z]+[0-9]+\\'" regexp . + (ses-create-cell-variable): New defun. + (ses-relocate-formula): Relocate formulas only for cells the + symbols of which are not renamed, i.e. symbols whose names do not + match regexp "\\`[A-Z]+[0-9]+\\'". + (ses-relocate-all): Relocate values only for cells the symbols of + which are not renamed. + (ses-load): Create cells variables as the (ses-cell ...) are read, + in order to check row col consistency with cell symbol name only + for cells that are not renamed. + (ses-replace-name-in-formula): New defun. + (ses-rename-cell): New defun. + (ses-call-printer-return, ses-cell-property-get) + (ses-sym-rowcol, ses-printer-validate, ses-formula-record) + (ses-create-cell-variable, ses-reset-header-string) + (ses-cell-set-formula, ses-repair-cell-reference-all) + (ses-self-reference-early-detection, ses-in-print-area, ses-set-curcell) + (ses-check-curcell, ses-call-printer, ses-adjust-print-width) + (ses-print-cell-new-width, ses-formula-references, ses-relocate-formula) + (ses-aset-with-undo, ses-load, ses-truncate-cell) + (ses-read-column-printer, ses-read-default-printer, ses-insert-row) + (ses-delete-row, ses-delete-column, ses-append-row-jump-first-column) + (ses-kill-override, ses-yank-pop, ses-yank-cells, ses-yank-tsf) + (ses-yank-resize, ses-export-tab, ses-mark-row, ses-mark-column) + (ses-renarrow-buffer, ses-insert-range, ses-insert-ses-range) + (ses-safe-printer, ses-safe-formula, ses-warn-unsafe, ses--clean-!) + (ses--clean-_, ses-range, ses-select, ses-center, ses-center-span) + (ses-dashfill, ses-unsafe): Fix typos and reflow docstrings. + + 2011-07-09 Leo Liu * register.el (insert-register): Restore accidental change on diff --git a/lisp/ses.el b/lisp/ses.el index 9b2048eae83..36764e92bbd 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -43,7 +43,7 @@ ;; working fine in most cases, however failed in some cases of several path ;; racing together. ;; -;; The current algorithm is based on Dijksta algorithm. The ``cycle length'' is +;; The current algorithm is based on Dijkstra's algorithm. The cycle length is ;; stored in some cell property. In order not to reset in all cells such ;; property at each update, the cycle length is stored in this property along ;; with some update attempt id that is incremented at each update. The current @@ -282,6 +282,9 @@ default printer and then modify its output.") ses--numcols ses--numrows ses--symbolic-formulas ses--data-marker ses--params-marker (ses--Dijkstra-attempt-nb . 0) ses--Dijkstra-weight-bound + ;; This list is useful to speed-up clean-up of symbols when + ;; an area containing renamed cell is deleted. + ses--renamed-cell-symb-list ;; Global variables that we override mode-line-process next-line-add-newlines transient-mark-mode) "Buffer-local variables used by SES.") @@ -327,7 +330,7 @@ need to be recalculated.") (defvar ses-call-printer-return nil "Set to t if last cell printer invoked by `ses-call-printer' requested -left-justification of the result. Set to error-signal if ses-call-printer +left-justification of the result. Set to error-signal if `ses-call-printer' encountered an error during printing. Otherwise nil.") (defvar ses-start-time nil @@ -394,7 +397,7 @@ functions refer to its value." val))))) (defmacro ses-cell-property-get (property-name row &optional col) - "Get property named PROPERTY-NAME From a CELL or a pair (ROW,COL). + "Get property named PROPERTY-NAME from a CELL or a pair (ROW,COL). When COL is omitted, CELL=ROW is a cell object. When COL is present ROW and COL are the integer coordinates of the cell of @@ -490,8 +493,8 @@ PROPERTY-NAME." `(aref ses--col-printers ,col)) (defmacro ses-sym-rowcol (sym) - "From a cell-symbol SYM, gets the cons (row . col). A1 => (0 . 0). Result -is nil if SYM is not a symbol that names a cell." + "From a cell-symbol SYM, gets the cons (row . col). A1 => (0 . 0). +Result is nil if SYM is not a symbol that names a cell." `(and (symbolp ,sym) (get ,sym 'ses-cell))) (defmacro ses-cell (sym value formula printer references) @@ -625,7 +628,7 @@ is a vector--if a symbol, the new vector is assigned as the symbol's value." (delete-region pos (point)))) (defun ses-printer-validate (printer) - "Signals an error if PRINTER is not a valid SES cell printer." + "Signal an error if PRINTER is not a valid SES cell printer." (or (not printer) (stringp printer) (functionp printer) @@ -642,7 +645,7 @@ checking that it is a valid printer function." (add-to-list 'ses-read-printer-history (prin1-to-string printer)))) (defun ses-formula-record (formula) - "If FORMULA is of the form 'symbol, adds it to the list of symbolic formulas + "If FORMULA is of the form 'symbol, add it to the list of symbolic formulas for this spreadsheet." (when (and (eq (car-safe formula) 'quote) (symbolp (cadr formula))) @@ -674,6 +677,17 @@ for this spreadsheet." (put sym 'ses-cell (cons xrow xcol)) (make-local-variable sym))))) +(defun ses-create-cell-variable (sym row col) + "Create a buffer-local variable `SYM' for cell at position (ROW, COL). + +SYM is the symbol for that variable, ROW and COL are integers for +row and column of the cell, with numbering starting from 0. + +Return nil in case of failure." + (unless (local-variable-p sym) + (make-local-variable sym) + (put sym 'ses-cell (cons row col)))) + ;; We do not delete the ses-cell properties for the cell-variables, in ;; case a formula that refers to this cell is in the kill-ring and is ;; later pasted back in. @@ -682,7 +696,10 @@ for this spreadsheet." (let (sym) (dotimes (row (1+ (- maxrow minrow))) (dotimes (col (1+ (- maxcol mincol))) - (setq sym (ses-create-cell-symbol (+ row minrow) (+ col mincol))) + (let ((xrow (+ row minrow)) (xcol (+ col mincol))) + (setq sym (if (and (< xrow ses--numrows) (< xcol ses--numcols)) + (ses-cell-symbol xrow xcol) + (ses-create-cell-symbol xrow xcol)))) (if (boundp sym) (push `(apply ses-set-with-undo ,sym ,(symbol-value sym)) buffer-undo-list)) @@ -691,7 +708,7 @@ for this spreadsheet." buffer-undo-list)) (defun ses-reset-header-string () - "Flags the header string for update. Upon undo, the header string will be + "Flag the header string for update. Upon undo, the header string will be updated again." (push '(apply ses-reset-header-string) buffer-undo-list) (setq ses--header-hscroll -1)) @@ -727,7 +744,7 @@ cell (ROW,COL). This is undoable. The cell's data will be updated through nil) ; Make coverage-tester happy. (defun ses-cell-set-formula (row col formula) - "Store a new formula for (ROW . COL) and enqueues the cell for + "Store a new formula for (ROW . COL) and enqueue the cell for recalculation via `post-command-hook'. Updates the reference lists for the cells that this cell refers to. Does not update cell value or reprint the cell. To avoid inconsistencies, this function is not interruptible, which @@ -812,9 +829,9 @@ means Emacs will crash if FORMULA contains a circular list." errors))))) (if errors (warn "---------------------------------------------------------------- -Some reference where corrupted. +Some references were corrupted. -The following is a list of where each element ELT is such +The following is a list where each element ELT is such that (car ELT) is the reference of cell CELL with corruption, and (cdr ELT) is a property list where @@ -922,8 +939,7 @@ the old and FORCE is nil." (ses-cell-set-formula row col nil)) (defcustom ses-self-reference-early-detection nil - "True if cycle detection is early for cells that refer to -themselves." + "True if cycle detection is early for cells that refer to themselves." :type 'boolean :group 'ses) @@ -980,7 +996,7 @@ if the cell's value is unchanged and FORCE is nil." (error "Circular references: %s" ses--deferred-recalc)) (message " ")) ;; Can't use save-excursion here: if the cell under point is updated, - ;; save-excusion's marker will move past the cell. + ;; save-excursion's marker will move past the cell. (goto-char pos))) @@ -989,7 +1005,7 @@ if the cell's value is unchanged and FORCE is nil." ;;---------------------------------------------------------------------------- (defun ses-in-print-area () - "Returns t if point is in print area of spreadsheet." + "Return t if point is in print area of spreadsheet." (<= (point) ses--data-marker)) ;; We turn off point-motion-hooks and explicitly position the cursor, in case @@ -1011,7 +1027,7 @@ if the cell's value is unchanged and FORCE is nil." (forward-char)))) (defun ses-set-curcell () - "Sets `ses--curcell' to the current cell symbol, or a cons (BEG,END) for a + "Set `ses--curcell' to the current cell symbol, or a cons (BEG,END) for a region, or nil if cursor is not at a cell." (if (or (not mark-active) deactivate-mark @@ -1030,10 +1046,10 @@ region, or nil if cursor is not at a cell." nil) (defun ses-check-curcell (&rest args) - "Signal an error if ses--curcell is inappropriate. The end marker is -appropriate if some argument is 'end. A range is appropriate if some -argument is 'range. A single cell is appropriate unless some argument is -'needrange." + "Signal an error if `ses--curcell' is inappropriate. +The end marker is appropriate if some argument is 'end. +A range is appropriate if some argument is 'range. +A single cell is appropriate unless some argument is 'needrange." (if (eq ses--curcell t) ;; curcell recalculation was postponed, but user typed ahead. (ses-set-curcell)) @@ -1143,7 +1159,7 @@ preceding cell has spilled over." (setq x (concat text (if (< maxcol ses--numcols) " " "\n"))) ;; We use set-text-properties to prevent a wacky print function from ;; inserting rogue properties, and to ensure that the keymap property is - ;; inherited (is it a bug that only unpropertied strings actually + ;; inherited (is it a bug that only unpropertized strings actually ;; inherit from surrounding text?) (set-text-properties 0 (length x) nil x) (insert-and-inherit x) @@ -1168,7 +1184,7 @@ preceding cell has spilled over." sig))) (defun ses-call-printer (printer &optional value) - "Invokes PRINTER (a string or parenthesized string or function-symbol or + "Invoke PRINTER (a string or parenthesized string or function-symbol or lambda of one argument) on VALUE. Result is the printed cell as a string. The variable `ses-call-printer-return' is set to t if the printer used parenthesis to request left-justification, or the error-signal if the @@ -1200,7 +1216,7 @@ printer signaled one (and \"%s\" is used as the default printer), else nil." (defun ses-adjust-print-width (col change) "Insert CHANGE spaces in front of column COL, or at end of line if COL=NUMCOLS. Deletes characters if CHANGE < 0. Caller should bind -inhibit-quit to t." +`inhibit-quit' to t." (let ((inhibit-read-only t) (blank (if (> change 0) (make-string change ?\s))) (at-end (= col ses--numcols))) @@ -1219,9 +1235,9 @@ inhibit-quit to t." (delete-char (- change)))))) (defun ses-print-cell-new-width (row col) - "Same as ses-print-cell, except if the cell's value is *skip*, the preceding -nonskipped cell is reprinted. This function is used when the width of -cell (ROW,COL) has changed." + "Same as `ses-print-cell', except if the cell's value is *skip*, +the preceding nonskipped cell is reprinted. This function is used +when the width of cell (ROW,COL) has changed." (if (not (eq (ses-cell-value row col) '*skip*)) (ses-print-cell row col) ;;Cell was skipped over - reprint previous @@ -1315,7 +1331,7 @@ Newlines in the data are escaped." (setq formula (cadr formula))) (if (eq (car-safe printer) 'ses-safe-printer) (setq printer (cadr printer))) - ;; This is noticably faster than (format "%S %S %S %S %S") + ;; This is noticeably faster than (format "%S %S %S %S %S") (setq text (concat "(ses-cell " (symbol-name sym) " " @@ -1344,7 +1360,7 @@ Newlines in the data are escaped." ;;---------------------------------------------------------------------------- (defun ses-formula-references (formula &optional result-so-far) - "Produce a list of symbols for cells that this formula's value + "Produce a list of symbols for cells that this FORMULA's value refers to. For recursive calls, RESULT-SO-FAR is the list being constructed, or t to get a wrong-type-argument error when the first reference is found." @@ -1371,7 +1387,7 @@ first reference is found." result-so-far) (defsubst ses-relocate-symbol (sym rowcol startrow startcol rowincr colincr) - "Relocate one symbol SYM, whichs corresponds to ROWCOL (a cons of ROW and + "Relocate one symbol SYM, which corresponds to ROWCOL (a cons of ROW and COL). Cells starting at (STARTROW,STARTCOL) are being shifted by (ROWINCR,COLINCR)." (let ((row (car rowcol)) @@ -1389,8 +1405,8 @@ by (ROWINCR,COLINCR)." (defun ses-relocate-formula (formula startrow startcol rowincr colincr) "Produce a copy of FORMULA where all symbols that refer to cells in row -STARTROW or above and col STARTCOL or above are altered by adding ROWINCR -and COLINCR. STARTROW and STARTCOL are 0-based. Example: +STARTROW or above, and col STARTCOL or above, are altered by adding ROWINCR +and COLINCR. STARTROW and STARTCOL are 0-based. Example: (ses-relocate-formula '(+ A1 B2 D3) 1 2 1 -1) => (+ A1 B2 C4) If ROWINCR or COLINCR is negative, references to cells being deleted are @@ -1400,7 +1416,8 @@ removed. Example: Sets `ses-relocate-return' to 'delete if cell-references were removed." (let (rowcol result) (if (or (atom formula) (eq (car formula) 'quote)) - (if (setq rowcol (ses-sym-rowcol formula)) + (if (and (setq rowcol (ses-sym-rowcol formula)) + (string-match "\\`[A-Z]+[0-9]+\\'" (symbol-name formula))) (ses-relocate-symbol formula rowcol startrow startcol rowincr colincr) formula) ; Pass through as-is. @@ -1508,14 +1525,15 @@ if the range was altered." the rectangle (MINROW,MINCOL)..(NUMROWS,NUMCOLS) by adding ROWINCR and COLINCR to each symbol." (let (reform) - (let (mycell newval) + (let (mycell newval xrow) (dotimes-with-progress-reporter (row ses--numrows) "Relocating formulas..." (dotimes (col ses--numcols) (setq ses-relocate-return nil mycell (ses-get-cell row col) newval (ses-relocate-formula (ses-cell-formula mycell) - minrow mincol rowincr colincr)) + minrow mincol rowincr colincr) + xrow (- row rowincr)) (ses-set-cell row col 'formula newval) (if (eq ses-relocate-return 'range) ;; This cell contains a (ses-range X Y) where a cell has been @@ -1531,8 +1549,22 @@ to each symbol." minrow mincol rowincr colincr)) (ses-set-cell row col 'references newval) (and (>= row minrow) (>= col mincol) - (ses-set-cell row col 'symbol - (ses-create-cell-symbol row col)))))) + (let ((sym (ses-cell-symbol row col)) + (xcol (- col colincr))) + (if (and + sym + (>= xrow 0) + (>= xcol 0) + (null (eq sym + (ses-create-cell-symbol xrow xcol)))) + ;; This is a renamed cell, do not update the cell + ;; name, but just update the coordinate property. + (put sym 'ses-cell (cons row col)) + (ses-set-cell row col 'symbol + (setq sym (ses-create-cell-symbol row col))) + (unless (and (boundp sym) (local-variable-p sym)) + (set (make-local-variable sym) nil) + (put sym 'ses-cell (cons row col)))))) ))) ;; Relocate the cell values. (let (oldval myrow mycol xrow xcol) (cond @@ -1545,11 +1577,17 @@ to each symbol." (setq mycol (+ col mincol) xrow (- myrow rowincr) xcol (- mycol colincr)) - (if (and (< xrow ses--numrows) (< xcol ses--numcols)) - (setq oldval (ses-cell-value xrow xcol)) - ;; Cell is off the end of the array. - (setq oldval (symbol-value (ses-create-cell-symbol xrow xcol)))) - (ses-set-cell myrow mycol 'value oldval)))) + (let ((sym (ses-cell-symbol myrow mycol)) + (xsym (ses-create-cell-symbol xrow xcol))) + ;; Make the value relocation only when if the cell is not + ;; a renamed cell. Otherwise this is not needed. + (and (eq sym xsym) + (ses-set-cell myrow mycol 'value + (if (and (< xrow ses--numrows) (< xcol ses--numcols)) + (ses-cell-value xrow xcol) + ;;Cell is off the end of the array + (symbol-value xsym)))))))) + ((and (wholenump rowincr) (wholenump colincr)) ;; Insertion of rows and/or columns. Run the loop backwards. (let ((disty (1- ses--numrows)) @@ -1618,7 +1656,8 @@ to each symbol." (makunbound sym))) (defun ses-aset-with-undo (array idx newval) - "Like aset, but undoable. Result is t if element has changed" + "Like `aset', but undoable. +Result is t if element has changed." (unless (equal (aref array idx) newval) (push `(apply ses-aset-with-undo ,array ,idx ,(aref array idx)) buffer-undo-list) @@ -1631,8 +1670,8 @@ to each symbol." ;;---------------------------------------------------------------------------- (defun ses-load () - "Parse the current buffer and sets up buffer-local variables. Does not -execute cell formulas or print functions." + "Parse the current buffer and set up buffer-local variables. +Does not execute cell formulas or print functions." (widen) ;; Read our global parameters, which should be a 3-element list. (goto-char (point-max)) @@ -1658,7 +1697,6 @@ execute cell formulas or print functions." (message "Upgrading from SES-1 file format"))) (or (= ses--file-format 2) (error "This file needs a newer version of the SES library code")) - (ses-create-cell-variable-range 0 (1- ses--numrows) 0 (1- ses--numcols)) ;; Initialize cell array. (setq ses--cells (make-vector ses--numrows nil)) (dotimes (row ses--numrows) @@ -1678,11 +1716,10 @@ execute cell formulas or print functions." (dotimes (row ses--numrows) (dotimes (col ses--numcols) (let* ((x (read (current-buffer))) - (rowcol (ses-sym-rowcol (car-safe (cdr-safe x))))) + (sym (car-safe (cdr-safe x)))) (or (and (looking-at "\n") (eq (car-safe x) 'ses-cell) - (eq row (car rowcol)) - (eq col (cdr rowcol))) + (ses-create-cell-variable sym row col)) (error "Cell-def error")) (eval x))) (or (looking-at "\n\n") @@ -2082,8 +2119,7 @@ to are recalculated first." (ses-jump-safe startcell))) (defun ses-truncate-cell () - "Reprint current cell, but without spillover into any following blank -cells." + "Reprint current cell, but without spillover into any following blank cells." (interactive "*") (ses-check-curcell) (let* ((rowcol (ses-sym-rowcol ses--curcell)) @@ -2273,7 +2309,7 @@ cells." (defun ses-read-printer (prompt default) "Common code for `ses-read-cell-printer', `ses-read-column-printer', and `ses-read-default-printer'. -PROMPT should end with \": \". Result is t if operation was cancelled." +PROMPT should end with \": \". Result is t if operation was canceled." (barf-if-buffer-read-only) (if (eq default t) (setq default "") @@ -2331,8 +2367,8 @@ right-justified) or a list of one string (will be left-justified)." (ses-print-cell row col)))) (defun ses-read-column-printer (col newval) - "Set the printer function for the current column. See -`ses-read-cell-printer' for input forms." + "Set the printer function for the current column. +See `ses-read-cell-printer' for input forms." (interactive (let ((col (cdr (ses-sym-rowcol ses--curcell)))) (ses-check-curcell) @@ -2348,8 +2384,8 @@ right-justified) or a list of one string (will be left-justified)." (ses-print-cell row col))))) (defun ses-read-default-printer (newval) - "Set the default printer function for cells that have no other. See -`ses-read-cell-printer' for input forms." + "Set the default printer function for cells that have no other. +See `ses-read-cell-printer' for input forms." (interactive (list (ses-read-printer "Default printer: " ses--default-printer))) (unless (eq newval t) @@ -2363,8 +2399,8 @@ right-justified) or a list of one string (will be left-justified)." ;;---------------------------------------------------------------------------- (defun ses-insert-row (count) - "Insert a new row before the current one. With prefix, insert COUNT rows -before current one." + "Insert a new row before the current one. +With prefix, insert COUNT rows before current one." (interactive "*p") (ses-check-curcell 'end) (or (> count 0) (signal 'args-out-of-range nil)) @@ -2416,8 +2452,8 @@ before current one." (ses-goto-print (1- ses--numrows) 0))) (defun ses-delete-row (count) - "Delete the current row. With prefix, Deletes COUNT rows starting from the -current one." + "Delete the current row. +With prefix, deletes COUNT rows starting from the current one." (interactive "*p") (ses-check-curcell) (or (> count 0) (signal 'args-out-of-range nil)) @@ -2509,8 +2545,8 @@ If COL is specified, the new column(s) get the specified WIDTH and PRINTER (ses-jump-safe ses--curcell)) (defun ses-delete-column (count) - "Delete the current column. With prefix, Deletes COUNT columns starting -from the current one." + "Delete the current column. +With prefix, deletes COUNT columns starting from the current one." (interactive "*p") (ses-check-curcell) (or (> count 0) (signal 'args-out-of-range nil)) @@ -2584,7 +2620,7 @@ inserts a new row if at bottom of print area. Repeat COUNT times." (forward-char))) (defun ses-append-row-jump-first-column () - "Insert a new row after current one and jumps to its first column." + "Insert a new row after current one and jump to its first column." (interactive "*") (ses-check-curcell) (ses-begin-change) @@ -2687,8 +2723,8 @@ the corresponding data cell." line) (defun ses-kill-override (beg end) - "Generic override for any commands that kill text. We clear the killed -cells instead of deleting them." + "Generic override for any commands that kill text. +We clear the killed cells instead of deleting them." (interactive "r") (ses-check-curcell 'needrange) ;; For some reason, the text-read-only error is not caught by `delete-region', @@ -2720,7 +2756,7 @@ When inserting cells, the formulas are usually relocated to keep the same relative references to neighboring cells. This is best if the formulas generally refer to other cells within the yanked text. You can use the C-u prefix to specify insertion without relocation, which is best when the -formulas refer to cells outsite the yanked text. +formulas refer to cells outside the yanked text. When inserting formulas, the text is treated as a string constant if it doesn't make sense as a sexp or would otherwise be considered a symbol. Use 'sym to @@ -2749,9 +2785,9 @@ as symbols." (defun ses-yank-pop (arg) "Replace just-yanked stretch of killed text with a different stretch. -This command is allowed only immediately after a `yank' or a `yank-pop', when -the region contains a stretch of reinserted previously-killed text. We -replace it with a different stretch of killed text. +This command is allowed only immediately after a `yank' or a `yank-pop', +when the region contains a stretch of reinserted previously-killed text. +We replace it with a different stretch of killed text. Unlike standard `yank-pop', this function uses `undo' to delete the previous insertion." (interactive "*p") @@ -2765,7 +2801,7 @@ previous insertion." (setq this-command 'yank)) (defun ses-yank-cells (text arg) - "If the TEXT has a proper set of 'ses attributes, inserts the text as + "If the TEXT has a proper set of 'ses attributes, insert the text as cells, else return nil. The cells are reprinted--the supplied text is ignored because the column widths, default printer, etc. at yank time might be different from those at kill-time. ARG is a list to indicate that @@ -2848,8 +2884,8 @@ cons of ROW and COL). Treat plain symbols as strings unless ARG is a list." (ses-cell-set-formula row col val)))) (defun ses-yank-tsf (text arg) - "If TEXT contains tabs and/or newlines, treats the tabs as -column-separators and the newlines as row-separators and inserts the text as + "If TEXT contains tabs and/or newlines, treat the tabs as +column-separators and the newlines as row-separators and insert the text as cell formulas--else return nil. Treat plain symbols as strings unless ARG is a list. Ignore a final newline." (if (or (not (string-match "[\t\n]" text)) @@ -2887,8 +2923,8 @@ is a list. Ignore a final newline." t))) (defun ses-yank-resize (needrows needcols) - "If this yank will require inserting rows and/or columns, asks for -confirmation and then inserts them. Result is (row,col) for top left of yank + "If this yank will require inserting rows and/or columns, ask for +confirmation and then insert them. Result is (row,col) for top left of yank spot, or error signal if user requests cancel." (ses-begin-change) (let ((rowcol (if ses--curcell @@ -2931,9 +2967,9 @@ newlines between rows. Result is placed in kill ring." (ses-export-tab t)) (defun ses-export-tab (want-formulas) - "Export the current range with tabs between columns and newlines between -rows. Result is placed in kill ring. The export is values unless -WANT-FORMULAS is non-nil. Newlines and tabs in the export text are escaped." + "Export the current range with tabs between columns and newlines between rows. +Result is placed in kill ring. The export is values unless WANT-FORMULAS +is non-nil. Newlines and tabs in the export text are escaped." (ses-check-curcell 'needrange) (let ((print-escape-newlines t) result item) @@ -2992,7 +3028,7 @@ The top row is row 1. Selecting row 0 displays the default header row." (ses-reset-header-string)) (defun ses-mark-row () - "Marks the entirety of current row as a range." + "Mark the entirety of current row as a range." (interactive) (ses-check-curcell 'range) (let ((row (car (ses-sym-rowcol (or (car-safe ses--curcell) ses--curcell))))) @@ -3002,7 +3038,7 @@ The top row is row 1. Selecting row 0 displays the default header row." (ses-goto-print row 0))) (defun ses-mark-column () - "Marks the entirety of current column as a range." + "Mark the entirety of current column as a range." (interactive) (ses-check-curcell 'range) (let ((col (cdr (ses-sym-rowcol (or (car-safe ses--curcell) ses--curcell)))) @@ -3046,13 +3082,14 @@ The top row is row 1. Selecting row 0 displays the default header row." (ses-goto-print row col))))) (defun ses-renarrow-buffer () - "Narrow the buffer so only the print area is visible. Use after \\[widen]." + "Narrow the buffer so only the print area is visible. +Use after \\[widen]." (interactive) (setq ses--deferred-narrow t)) (defun ses-sort-column (sorter &optional reverse) - "Sorts the range by a specified column. With prefix, sorts in -REVERSE order." + "Sort the range by a specified column. +With prefix, sorts in REVERSE order." (interactive "*sSort column: \nP") (ses-check-curcell 'needrange) (let ((min (ses-sym-rowcol (car ses--curcell))) @@ -3103,7 +3140,7 @@ REVERSE order." (ses-sort-column (ses-column-letter col) reverse)))) (defun ses-insert-range () - "Inserts into minibuffer the list of cells currently highlighted in the + "Insert into minibuffer the list of cells currently highlighted in the spreadsheet." (interactive "*") (let (x) @@ -3115,7 +3152,7 @@ spreadsheet." (insert (substring (prin1-to-string (nreverse x)) 1 -1)))) (defun ses-insert-ses-range () - "Inserts \"(ses-range x y)\" in the minibuffer to represent the currently + "Insert \"(ses-range x y)\" in the minibuffer to represent the currently highlighted range in the spreadsheet." (interactive "*") (let (x) @@ -3139,13 +3176,70 @@ highlighted range in the spreadsheet." (mouse-set-point event) (ses-insert-ses-range)) +(defun ses-replace-name-in-formula (formula old-name new-name) + (let ((new-formula formula)) + (unless (and (consp formula) + (eq (car-safe formula) 'quote)) + (while formula + (let ((elt (car-safe formula))) + (cond + ((consp elt) + (setcar formula (ses-replace-name-in-formula elt old-name new-name))) + ((and (symbolp elt) + (eq (car-safe formula) old-name)) + (setcar formula new-name)))) + (setq formula (cdr formula)))) + new-formula)) + +(defun ses-rename-cell (new-name) + "Rename current cell." + (interactive "*SEnter new name: ") + (ses-check-curcell) + (or + (and (local-variable-p new-name) + (ses-sym-rowcol new-name) + ;; this test is needed because ses-cell property of deleted cells + ;; is not deleted in case of subsequent undo + (memq new-name ses--renamed-cell-symb-list) + (error "Already a cell name")) + (and (boundp new-name) + (null (yes-or-no-p (format "`%S' is already bound outside this buffer, continue? " + new-name))) + (error "Already a bound cell name"))) + (let* ((rowcol (ses-sym-rowcol ses--curcell)) + (cell (ses-get-cell (car rowcol) (cdr rowcol)))) + (put new-name 'ses-cell rowcol) + (dolist (reference (ses-cell-references (car rowcol) (cdr rowcol))) + (let* ((rowcol (ses-sym-rowcol reference)) + (cell (ses-get-cell (car rowcol) (cdr rowcol)))) + (ses-cell-set-formula (car rowcol) + (cdr rowcol) + (ses-replace-name-in-formula + (ses-cell-formula cell) + ses--curcell + new-name)))) + (push new-name ses--renamed-cell-symb-list) + (set new-name (symbol-value ses--curcell)) + (aset cell 0 new-name) + (put ses--curcell 'ses-cell nil) + (makunbound ses--curcell) + (setq ses--curcell new-name) + (let* ((pos (point)) + (inhibit-read-only t) + (col (current-column)) + (end (save-excursion + (move-to-column (1+ col)) + (if (eolp) + (+ pos (ses-col-width col) 1) + (point))))) + (put-text-property pos end 'intangible new-name))) ) ;;---------------------------------------------------------------------------- ;; Checking formulas for safety ;;---------------------------------------------------------------------------- (defun ses-safe-printer (printer) - "Returns PRINTER if safe, or the substitute printer `ses-unsafe' otherwise." + "Return PRINTER if safe, or the substitute printer `ses-unsafe' otherwise." (if (or (stringp printer) (stringp (car-safe printer)) (not printer) @@ -3154,16 +3248,16 @@ highlighted range in the spreadsheet." 'ses-unsafe)) (defun ses-safe-formula (formula) - "Returns FORMULA if safe, or the substitute formula *unsafe* otherwise." + "Return FORMULA if safe, or the substitute formula *unsafe* otherwise." (if (ses-warn-unsafe formula 'unsafep) formula `(ses-unsafe ',formula))) (defun ses-warn-unsafe (formula checker) - "Applies CHECKER to FORMULA. If result is non-nil, asks user for -confirmation about FORMULA, which might be unsafe. Returns t if formula -is safe or user allows execution anyway. Always returns t if -`safe-functions' is t." + "Apply CHECKER to FORMULA. +If result is non-nil, asks user for confirmation about FORMULA, +which might be unsafe. Returns t if formula is safe or user allows +execution anyway. Always returns t if `safe-functions' is t." (if (eq safe-functions t) t (setq checker (funcall checker formula)) @@ -3178,13 +3272,13 @@ is safe or user allows execution anyway. Always returns t if ;;---------------------------------------------------------------------------- (defun ses--clean-! (&rest x) - "Clean by delq list X from any occurrence of `nil' or `*skip*'." + "Clean by `delq' list X from any occurrence of `nil' or `*skip*'." (delq nil (delq '*skip* x))) (defun ses--clean-_ (x y) "Clean list X by replacing by Y any occurrence of `nil' or `*skip*'. -This will change X by making setcar on its cons cells." +This will change X by making `setcar' on its cons cells." (let ((ret x) ret-elt) (while ret (setq ret-elt (car ret)) @@ -3194,7 +3288,7 @@ This will change X by making setcar on its cons cells." x) (defmacro ses-range (from to &rest rest) - "Expands to a list of cell-symbols for the range going from + "Expand to a list of cell-symbols for the range going from FROM up to TO. The range automatically expands to include any new row or column inserted into its middle. The SES library code specifically looks for the symbol `ses-range', so don't create an @@ -3204,11 +3298,11 @@ By passing in REST some flags one can configure the way the range is read and how it is formatted. In the sequel we assume that cells A1, B1, A2 B2 have respective values -1 2 3 and 4 for examplication. +1 2 3 and 4. Readout direction is specified by a `>v', '`>^', `', `v<', `^>', `^<' flag. For historical reasons, in absence -of such a flag, a default direction of `^<' is assumed. This +`v>', `v<', `^>', `^<' flag. For historical reasons, in absence +of such a flag, a default direction of `^<' is assumed. This way `(ses-range A1 B2 ^>)' will evaluate to `(1 3 2 4)', while `(ses-range A1 B2 >^)' will evaluate to (3 4 1 2). @@ -3221,18 +3315,18 @@ If the range is one column, then `v' can be used as a shorthand to A `!' flag will remove all cells whose value is nil or `*skip*'. A `_' flag will replace nil or `*skip*' by the value following -the `_' flag. If the `_' flag is the last argument, then they are +the `_' flag. If the `_' flag is the last argument, then they are replaced by integer 0. A `*', `*1' or `*2' flag will vectorize the range in the sense of -Calc. See info node `(Calc) Top'. Flag `*' will output either a +Calc. See info node `(Calc) Top'. Flag `*' will output either a vector or a matrix depending on the number of rows, `*1' will flatten the result to a one row vector, and `*2' will make a matrix whatever the number of rows. -Warning: interaction with Calc is expermimental and may produce -confusing results if you are not aware of Calc data format. Use -`math-format-value' as a printer for Calc objects." +Warning: interaction with Calc is experimental and may produce +confusing results if you are not aware of Calc data format. +Use `math-format-value' as a printer for Calc objects." (let (result-row result (prev-row -1) @@ -3319,10 +3413,10 @@ are ignored. Result is always floating-point, even if all args are integers." (/ (float (apply '+ list)) (length list))) (defmacro ses-select (fromrange test torange) - "Select cells in FROMRANGE that are `equal' to TEST. For each match, return -the corresponding cell from TORANGE. The ranges are macroexpanded but not -evaluated so they should be either (ses-range BEG END) or (list ...). The -TEST is evaluated." + "Select cells in FROMRANGE that are `equal' to TEST. +For each match, return the corresponding cell from TORANGE. +The ranges are macroexpanded but not evaluated so they should be +either (ses-range BEG END) or (list ...). The TEST is evaluated." (setq fromrange (cdr (macroexpand fromrange)) torange (cdr (macroexpand torange)) test (eval test)) @@ -3352,9 +3446,10 @@ TEST is evaluated." (defvar col) (defun ses-center (value &optional span fill) - "Print VALUE, centered within column. FILL is the fill character for -centering (default = space). SPAN indicates how many additional rightward -columns to include in width (default = 0)." + "Print VALUE, centered within column. +FILL is the fill character for centering (default = space). +SPAN indicates how many additional rightward columns to include +in width (default = 0)." (let ((printer (or (ses-col-printer col) ses--default-printer)) (width (ses-col-width col)) half) @@ -3373,8 +3468,8 @@ columns to include in width (default = 0)." (defun ses-center-span (value &optional fill) "Print VALUE, centered within the span that starts in the current column -and continues until the next nonblank column. FILL specifies the fill -character (default = space)." +and continues until the next nonblank column. +FILL specifies the fill character (default = space)." (let ((end (1+ col))) (while (and (< end ses--numcols) (memq (ses-cell-value row end) '(nil *skip*))) @@ -3382,8 +3477,8 @@ character (default = space)." (ses-center value (- end col 1) fill))) (defun ses-dashfill (value &optional span) - "Print VALUE centered using dashes. SPAN indicates how many rightward -columns to include in width (default = 0)." + "Print VALUE centered using dashes. +SPAN indicates how many rightward columns to include in width (default = 0)." (ses-center value span ?-)) (defun ses-dashfill-span (value) @@ -3397,7 +3492,7 @@ current column and continues until the next nonblank column." (ses-center-span value ?~)) (defun ses-unsafe (value) - "Substitute for an unsafe formula or printer" + "Substitute for an unsafe formula or printer." (error "Unsafe formula or printer")) ;;All standard printers are safe, including ses-unsafe! From 3f99e6e686e4a2db4b0c13679d211fdbb9b48dae Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 15 Feb 2012 09:38:21 -0500 Subject: [PATCH 02/36] * lisp/emacs-lisp/smie.el: Provide smarter auto-filling. (smie-auto-fill): New function. (smie-setup): Use it. --- lisp/ChangeLog | 6 ++++++ lisp/emacs-lisp/smie.el | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 29cb0334fb0..581ddc3788e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-02-15 Stefan Monnier + + * emacs-lisp/smie.el: Provide smarter auto-filling. + (smie-auto-fill): New function. + (smie-setup): Use it. + 2011-12-27 Vincent Belaïche * ses.el: The overall change is to add cell renaming, that is diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index cad7c8419b2..49ee051e62d 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -1539,6 +1539,38 @@ to which that point should be aligned, if we were to reindent it.") (save-excursion (indent-line-to indent)) (indent-line-to indent))))) +(defun smie-auto-fill () + (let ((fc (current-fill-column)) + (try-again nil)) + (while (and fc (> (current-column) fc)) + (cond + ((not (or (nth 8 (save-excursion + (syntax-ppss (line-beginning-position)))) + (nth 8 (syntax-ppss)))) + (save-excursion + (beginning-of-line) + (smie-indent-forward-token) + (let ((bsf (point)) + (gain 0) + curcol) + (while (<= (setq curcol (current-column)) fc) + ;; FIXME? `smie-indent-calculate' can (and often will) + ;; return a result that actually depends on the presence/absence + ;; of a newline, so the gain computed here may not be accurate, + ;; but in practice it seems to works well enough. + (let* ((newcol (smie-indent-calculate)) + (newgain (- curcol newcol))) + (when (> newgain gain) + (setq gain newgain) + (setq bsf (point)))) + (smie-indent-forward-token)) + (when (> gain 0) + (setq try-again) + (goto-char bsf) + (newline-and-indent))))) + (t (do-auto-fill)))))) + + (defun smie-setup (grammar rules-function &rest keywords) "Setup SMIE navigation and indentation. GRAMMAR is a grammar table generated by `smie-prec2->grammar'. @@ -1549,6 +1581,7 @@ KEYWORDS are additional arguments, which can use the following keywords: (set (make-local-variable 'smie-rules-function) rules-function) (set (make-local-variable 'smie-grammar) grammar) (set (make-local-variable 'indent-line-function) 'smie-indent-line) + (set (make-local-variable 'normal-auto-fill-function) 'smie-auto-fill) (set (make-local-variable 'forward-sexp-function) 'smie-forward-sexp-command) (while keywords From 8eb5d48f36bbb758d46a867c52fbc23d7ad7d71f Mon Sep 17 00:00:00 2001 From: Philipp Haselwarter Date: Sun, 25 Mar 2012 14:37:24 -0400 Subject: [PATCH 03/36] * lisp/newcomment.el (comment-inline-offset): New custom var. (comment-indent): Use it. Fixes: debbugs:11090 --- lisp/ChangeLog | 5 +++++ lisp/newcomment.el | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 581ddc3788e..729795b9bab 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-03-25 Philipp Haselwarter (tiny change) + + * newcomment.el (comment-inline-offset): New custom var (bug#11090). + (comment-indent): Use it. + 2012-02-15 Stefan Monnier * emacs-lisp/smie.el: Provide smarter auto-filling. diff --git a/lisp/newcomment.el b/lisp/newcomment.el index a1d77ccc6e0..2d5608cb225 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -268,6 +268,19 @@ makes the comment easier to read. Default is 1. nil means 0." :type '(choice string integer (const nil)) :group 'comment) +;;;###autoload +(defcustom comment-inline-offset 1 + "Inline comments have to be preceded by at least this many spaces. +This is usefull when style-conventions require a certain minimal offset. +Python's PEP8 for example recommends two spaces, so you could do: + +\(add-hook 'python-mode-hook + (lambda nil (set (make-local-variable 'comment-inline-offset) 2))) + +See `comment-padding' for whole-line comments." + :type 'integer + :group 'comment) + ;;;###autoload (defcustom comment-multi-line nil "Non-nil means `comment-indent-new-line' continues comments. @@ -685,7 +698,7 @@ If CONTINUE is non-nil, use the `comment-continue' markers if any." (save-excursion (skip-chars-backward " \t") (unless (bolp) - (setq indent (max indent (1+ (current-column)))))) + (setq indent (max indent (+ (current-column) comment-inline-offset))))) ;; If that's different from comment's current position, change it. (unless (= (current-column) indent) (delete-region (point) (progn (skip-chars-backward " \t") (point))) From 98fb480ee31bf74cf554044f60f21df16566dd7f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 25 Mar 2012 14:41:06 -0400 Subject: [PATCH 04/36] * lisp/newcomment.el (comment-inline-offset): Don't autoload. (comment-choose-indent): Obey comment-inline-offset. --- lisp/ChangeLog | 5 +++++ lisp/newcomment.el | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 729795b9bab..d6e8d259ae3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-03-25 Stefan Monnier + + * newcomment.el (comment-inline-offset): Don't autoload. + (comment-choose-indent): Obey comment-inline-offset. + 2012-03-25 Philipp Haselwarter (tiny change) * newcomment.el (comment-inline-offset): New custom var (bug#11090). diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 2d5608cb225..bac218e4e91 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -268,7 +268,6 @@ makes the comment easier to read. Default is 1. nil means 0." :type '(choice string integer (const nil)) :group 'comment) -;;;###autoload (defcustom comment-inline-offset 1 "Inline comments have to be preceded by at least this many spaces. This is usefull when style-conventions require a certain minimal offset. @@ -598,7 +597,7 @@ Point is expected to be at the start of the comment." (save-excursion (end-of-line) (current-column))))) (other nil) (min (save-excursion (skip-chars-backward " \t") - (1+ (current-column))))) + (+ comment-inline-offset (current-column))))) ;; Fix up the range. (if (< max min) (setq max min)) ;; Don't move past the fill column. @@ -698,7 +697,8 @@ If CONTINUE is non-nil, use the `comment-continue' markers if any." (save-excursion (skip-chars-backward " \t") (unless (bolp) - (setq indent (max indent (+ (current-column) comment-inline-offset))))) + (setq indent (max indent + (+ (current-column) comment-inline-offset))))) ;; If that's different from comment's current position, change it. (unless (= (current-column) indent) (delete-region (point) (progn (skip-chars-backward " \t") (point))) From 4be3075ec8cde1561817ffe9f7a0869841ffe38c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Mart=C3=ADn?= Date: Mon, 16 Apr 2012 19:06:58 +0200 Subject: [PATCH 05/36] ispell.el: Fix last Changelog entry. utf-8 will be enabled if possible. --- lisp/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7ebeea0a9dd..cae46908b0e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,7 @@ 2012-04-12 Agustín Martín Domingo * ispell.el (ispell-set-spellchecker-params): Post-process - `ispell-dictionary-alist' to use [:alpha:] if possible. + `ispell-dictionary-alist' to use [:alpha:] and utf-8 if possible. 2012-04-16 Chong Yidong From 3851314bd40e31c30fdd4ad7ec1dd8ad19c8030e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Mart=C3=ADn?= Date: Mon, 16 Apr 2012 19:32:02 +0200 Subject: [PATCH 06/36] (ispell-dictionary-base-alist): Revert to original XEmacs friendly default value. Having [:alpha:] here is no longer needed. If possible [:alpha:] will be set in `ispell-set-spellchecker-params' (and will always be for Emacs). --- lisp/ChangeLog | 3 +++ lisp/textmodes/ispell.el | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cae46908b0e..a0f42ba6ff7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,9 @@ * ispell.el (ispell-set-spellchecker-params): Post-process `ispell-dictionary-alist' to use [:alpha:] and utf-8 if possible. + (ispell-dictionary-base-alist): Revert to original XEmacs + friendly version for default. [:alpha:] will be added in + `ispell-set-spellchecker-params' if needed 2012-04-16 Chong Yidong diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index cfb1a2b3607..53822694698 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -574,12 +574,12 @@ re-start Emacs." (defvar ispell-dictionary-base-alist - '((nil + '((nil ; default ;; The default dictionary. It may be English.aff, or any other ;; dictionary depending on locale and such things. We should probably ;; ask ispell what dictionary it's using, but until we do that, let's - ;; just use an approximate regexp. - "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-B") nil iso-8859-1) + ;; just use a minimal regexp. [:alpha:] will later be set if possible. + "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1) ("american" ; Yankee English "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1) ("brasileiro" ; Brazilian mode From 9b9b2ef28d8a85ca46ce12b344ea9d267b283aac Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 14:32:59 -0400 Subject: [PATCH 07/36] * configure.in: Remove X libs workaround for old autoconf. --- ChangeLog | 4 ++++ configure.in | 9 --------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a72290284b..fb0ce63727b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-04-16 Glenn Morris + + * configure.in: Remove X libs workaround for old autoconf. + 2012-04-12 Ken Brown * configure.in: Warn that Cygwin 1.5 is unsupported. (Bug#10398) diff --git a/configure.in b/configure.in index bd8e3d62299..e0ac2ab1bad 100644 --- a/configure.in +++ b/configure.in @@ -1421,15 +1421,6 @@ else window_system=x11 fi -## Workaround for bug in autoconf <= 2.62. -## http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01551.html -## No need to do anything special for these standard directories. -if test -n "${x_libraries}" && test x"${x_libraries}" != xNONE; then - - x_libraries=`echo :${x_libraries}: | sed -e 's|:/usr/lib64:|:|g' -e 's|:/lib64:|:|g' -e 's|^:||' -e 's|:$||'` - -fi - LD_SWITCH_X_SITE_AUX= LD_SWITCH_X_SITE_AUX_RPATH= if test "${x_libraries}" != NONE; then From 94ee8db5e0a8bfa2aa68859782960b7140dae935 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 14:41:38 -0400 Subject: [PATCH 08/36] * lisp/frame.el (automatic-hscrolling): Make this alias obsolete. --- lisp/ChangeLog | 4 ++++ lisp/frame.el | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a0f42ba6ff7..97d626f9505 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2012-04-16 Glenn Morris + + * frame.el (automatic-hscrolling): Make this alias obsolete. + 2012-04-12 Agustín Martín Domingo * ispell.el (ispell-set-spellchecker-params): Post-process diff --git a/lisp/frame.el b/lisp/frame.el index 79e1243c7af..1ee9d966ef1 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -1651,7 +1651,8 @@ terminals, cursor blinking is controlled by the terminal." ;; Misc. -(defvaralias 'automatic-hscrolling 'auto-hscroll-mode) +;; Only marked as obsolete in 24.2. +(define-obsolete-variable-alias 'automatic-hscrolling 'auto-hscroll-mode "22.1") (make-variable-buffer-local 'show-trailing-whitespace) From 6b955486f5d3527479536b760a926ecea0447a80 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 14:46:46 -0400 Subject: [PATCH 09/36] Replace a use of eval-after-load * lisp/woman.el: Remove eval-after-load for tar-mode. * lisp/tar-mode.el (tar-mode-map): Add woman binding and menu entry. (woman-tar-extract-file): Autoload it. --- lisp/ChangeLog | 4 ++++ lisp/tar-mode.el | 5 +++++ lisp/woman.el | 10 +--------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 97d626f9505..ee34ce1827e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2012-04-16 Glenn Morris + * woman.el: Remove eval-after-load for tar-mode. + * tar-mode.el (tar-mode-map): Add woman binding and menu entry. + (woman-tar-extract-file): Autoload it. + * frame.el (automatic-hscrolling): Make this alias obsolete. 2012-04-12 Agustín Martín Domingo diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index 3eb2be15698..7c95f47e0fb 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -549,6 +549,7 @@ MODE should be an integer which is a file mode value." (define-key map "R" 'tar-rename-entry) (define-key map "u" 'tar-unflag) (define-key map "v" 'tar-view) + (define-key map "w" 'woman-tar-extract-file) (define-key map "x" 'tar-expunge) (define-key map "\177" 'tar-unflag-backwards) (define-key map "E" 'tar-extract-other-window) @@ -566,6 +567,8 @@ MODE should be an integer which is a file mode value." (define-key map [menu-bar immediate] (cons "Immediate" (make-sparse-keymap "Immediate"))) + (define-key map [menu-bar immediate woman] + '("Read Man Page (WoMan)" . woman-tar-extract-file)) (define-key map [menu-bar immediate view] '("View This File" . tar-view)) (define-key map [menu-bar immediate display] @@ -677,6 +680,8 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'. (fundamental-mode) (signal (car err) (cdr err))))) +(autoload 'woman-tar-extract-file "woman" + "In tar mode, run the WoMan man-page browser on this file." t) (define-minor-mode tar-subfile-mode "Minor mode for editing an element of a tar-file. diff --git a/lisp/woman.el b/lisp/woman.el index c76399a96e5..98ab27716a1 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -1,6 +1,6 @@ ;;; woman.el --- browse UN*X manual pages `wo (without) man' -;; Copyright (C) 2000-2012 Free Software Foundation, Inc. +;; Copyright (C) 2000-2012 Free Software Foundation, Inc. ;; Author: Francis J. Wright ;; Maintainer: FSF @@ -1595,14 +1595,6 @@ Also make each path-info component into a list. (woman-process-buffer) (goto-char (point-min))))) -;; There is currently no `tar-mode-hook' so use ... -(eval-after-load "tar-mode" - '(progn - (define-key tar-mode-map "w" 'woman-tar-extract-file) - (define-key-after (lookup-key tar-mode-map [menu-bar immediate]) - [woman] '("Read Man Page (WoMan)" . woman-tar-extract-file) 'view))) - - (defvar woman-last-file-name nil "The full pathname of the last file formatted by WoMan.") From 5934c3782fcfb59498d415a74fe3df902cf99d0e Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 14:48:46 -0400 Subject: [PATCH 10/36] Set lisp/vc/vc-hg.el maintainer to FSF. Ref: http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-03/msg00325.html --- lisp/vc/vc-hg.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 52e8051342d..a2728268816 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2006-2012 Free Software Foundation, Inc. ;; Author: Ivan Kanis +;; Maintainer: FSF ;; Keywords: vc tools ;; Package: vc From 5a0978ce61cc768c55d621d3f17e6f2c035caebc Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 14:53:06 -0400 Subject: [PATCH 11/36] picture.el small cleanup * lisp/textmodes/picture.el (picture-desired-column) (picture-update-desired-column): Convert comments to doc-strings. (picture-substitute): Remove function. (picture-mode-map): Initialize in the defvar. --- lisp/ChangeLog | 5 ++ lisp/textmodes/picture.el | 129 +++++++++++++++++++------------------- 2 files changed, 69 insertions(+), 65 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ee34ce1827e..3bed71495e5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2012-04-16 Glenn Morris + * textmodes/picture.el (picture-desired-column) + (picture-update-desired-column): Convert comments to doc-strings. + (picture-substitute): Remove function. + (picture-mode-map): Initialize in the defvar. + * woman.el: Remove eval-after-load for tar-mode. * tar-mode.el (tar-mode-map): Add woman binding and menu entry. (woman-tar-extract-file): Autoload it. diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index 9e8cbb216d1..3e2ab7892da 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el @@ -63,15 +63,17 @@ ;; Picture Movement Commands -;; When a cursor is on a wide-column character (e.g. Chinese, -;; Japanese, Korean), this variable tells the desired current column -;; which may be different from (current-column). -(defvar picture-desired-column 0) +(defvar picture-desired-column 0 + "Desired current column for Picture mode. +When a cursor is on a wide-column character (e.g. Chinese, +Japanese, Korean), this may may be different from `current-column'.") + -;; If the value of picture-desired-column is far from the current -;; column, or if the arg ADJUST-TO-CURRENT is non-nil, set it to the -;; current column. Return the current column. (defun picture-update-desired-column (adjust-to-current) + "Maybe update `picture-desired-column'. +If the value of `picture-desired-column' is more than one column +from `current-column', or if the argument ADJUST-TO-CURRENT is +non-nil, set it to the current column. Return `current-column'." (let ((current-column (current-column))) (if (or adjust-to-current (< picture-desired-column (1- current-column)) @@ -606,64 +608,61 @@ Leaves the region surrounding the rectangle." (defalias 'picture-delete-char 'delete-char) -(defvar picture-mode-map nil) - -(defun picture-substitute (oldfun newfun) - (define-key picture-mode-map (vector 'remap oldfun) newfun)) - -(if (not picture-mode-map) - (progn - (setq picture-mode-map (make-keymap)) - (picture-substitute 'self-insert-command 'picture-self-insert) - (picture-substitute 'completion-separator-self-insert-command - 'picture-self-insert) - (picture-substitute 'completion-separator-self-insert-autofilling - 'picture-self-insert) - (picture-substitute 'forward-char 'picture-forward-column) - (picture-substitute 'backward-char 'picture-backward-column) - (picture-substitute 'delete-char 'picture-clear-column) - ;; There are two possibilities for what is normally on DEL. - (picture-substitute 'backward-delete-char-untabify 'picture-backward-clear-column) - (picture-substitute 'delete-backward-char 'picture-backward-clear-column) - (picture-substitute 'kill-line 'picture-clear-line) - (picture-substitute 'open-line 'picture-open-line) - (picture-substitute 'newline 'picture-newline) - (picture-substitute 'newline-and-indent 'picture-duplicate-line) - (picture-substitute 'next-line 'picture-move-down) - (picture-substitute 'previous-line 'picture-move-up) - (picture-substitute 'move-beginning-of-line 'picture-beginning-of-line) - (picture-substitute 'move-end-of-line 'picture-end-of-line) - (picture-substitute 'mouse-set-point 'picture-mouse-set-point) - - (define-key picture-mode-map "\C-c\C-d" 'picture-delete-char) - (define-key picture-mode-map "\e\t" 'picture-toggle-tab-state) - (define-key picture-mode-map "\t" 'picture-tab) - (define-key picture-mode-map "\e\t" 'picture-tab-search) - (define-key picture-mode-map "\C-c\t" 'picture-set-tab-stops) - (define-key picture-mode-map "\C-c\C-k" 'picture-clear-rectangle) - (define-key picture-mode-map "\C-c\C-w" 'picture-clear-rectangle-to-register) - (define-key picture-mode-map "\C-c\C-y" 'picture-yank-rectangle) - (define-key picture-mode-map "\C-c\C-x" 'picture-yank-rectangle-from-register) - (define-key picture-mode-map "\C-c\C-r" 'picture-draw-rectangle) - (define-key picture-mode-map "\C-c\C-c" 'picture-mode-exit) - (define-key picture-mode-map "\C-c\C-f" 'picture-motion) - (define-key picture-mode-map "\C-c\C-b" 'picture-motion-reverse) - (define-key picture-mode-map "\C-c<" 'picture-movement-left) - (define-key picture-mode-map "\C-c>" 'picture-movement-right) - (define-key picture-mode-map "\C-c^" 'picture-movement-up) - (define-key picture-mode-map "\C-c." 'picture-movement-down) - (define-key picture-mode-map "\C-c`" 'picture-movement-nw) - (define-key picture-mode-map "\C-c'" 'picture-movement-ne) - (define-key picture-mode-map "\C-c/" 'picture-movement-sw) - (define-key picture-mode-map "\C-c\\" 'picture-movement-se) - (define-key picture-mode-map [(control ?c) left] 'picture-movement-left) - (define-key picture-mode-map [(control ?c) right] 'picture-movement-right) - (define-key picture-mode-map [(control ?c) up] 'picture-movement-up) - (define-key picture-mode-map [(control ?c) down] 'picture-movement-down) - (define-key picture-mode-map [(control ?c) home] 'picture-movement-nw) - (define-key picture-mode-map [(control ?c) prior] 'picture-movement-ne) - (define-key picture-mode-map [(control ?c) end] 'picture-movement-sw) - (define-key picture-mode-map [(control ?c) next] 'picture-movement-se))) +(defvar picture-mode-map + (let ((map (make-keymap))) + (define-key map [remap self-insert-command] 'picture-self-insert) + (define-key map [remap self-insert-command] 'picture-self-insert) + (define-key map [remap completion-separator-self-insert-command] + 'picture-self-insert) + (define-key map [remap completion-separator-self-insert-autofilling] + 'picture-self-insert) + (define-key map [remap forward-char] 'picture-forward-column) + (define-key map [remap backward-char] 'picture-backward-column) + (define-key map [remap delete-char] 'picture-clear-column) + ;; There are two possibilities for what is normally on DEL. + (define-key map [remap backward-delete-char-untabify] + 'picture-backward-clear-column) + (define-key map [remap delete-backward-char] 'picture-backward-clear-column) + (define-key map [remap kill-line] 'picture-clear-line) + (define-key map [remap open-line] 'picture-open-line) + (define-key map [remap newline] 'picture-newline) + (define-key map [remap newline-and-indent] 'picture-duplicate-line) + (define-key map [remap next-line] 'picture-move-down) + (define-key map [remap previous-line] 'picture-move-up) + (define-key map [remap move-beginning-of-line] 'picture-beginning-of-line) + (define-key map [remap move-end-of-line] 'picture-end-of-line) + (define-key map [remap mouse-set-point] 'picture-mouse-set-point) + (define-key map "\C-c\C-d" 'picture-delete-char) + (define-key map "\e\t" 'picture-toggle-tab-state) + (define-key map "\t" 'picture-tab) + (define-key map "\e\t" 'picture-tab-search) + (define-key map "\C-c\t" 'picture-set-tab-stops) + (define-key map "\C-c\C-k" 'picture-clear-rectangle) + (define-key map "\C-c\C-w" 'picture-clear-rectangle-to-register) + (define-key map "\C-c\C-y" 'picture-yank-rectangle) + (define-key map "\C-c\C-x" 'picture-yank-rectangle-from-register) + (define-key map "\C-c\C-r" 'picture-draw-rectangle) + (define-key map "\C-c\C-c" 'picture-mode-exit) + (define-key map "\C-c\C-f" 'picture-motion) + (define-key map "\C-c\C-b" 'picture-motion-reverse) + (define-key map "\C-c<" 'picture-movement-left) + (define-key map "\C-c>" 'picture-movement-right) + (define-key map "\C-c^" 'picture-movement-up) + (define-key map "\C-c." 'picture-movement-down) + (define-key map "\C-c`" 'picture-movement-nw) + (define-key map "\C-c'" 'picture-movement-ne) + (define-key map "\C-c/" 'picture-movement-sw) + (define-key map "\C-c\\" 'picture-movement-se) + (define-key map [(control ?c) left] 'picture-movement-left) + (define-key map [(control ?c) right] 'picture-movement-right) + (define-key map [(control ?c) up] 'picture-movement-up) + (define-key map [(control ?c) down] 'picture-movement-down) + (define-key map [(control ?c) home] 'picture-movement-nw) + (define-key map [(control ?c) prior] 'picture-movement-ne) + (define-key map [(control ?c) end] 'picture-movement-sw) + (define-key map [(control ?c) next] 'picture-movement-se) + map) + "Keymap used in `picture-mode'.") (defcustom picture-mode-hook nil "If non-nil, its value is called on entry to Picture mode. From 20f0c46dcdb597702fbb444729ec35411c036352 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 15:01:30 -0400 Subject: [PATCH 12/36] * lisp/progmodes/perl-mode.el (c-macro-expand): Remove unnecessary autoload (it is in loaddefs.el). --- lisp/ChangeLog | 3 +++ lisp/progmodes/perl-mode.el | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3bed71495e5..24b564b6d70 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2012-04-16 Glenn Morris + * progmodes/perl-mode.el (c-macro-expand): + Remove unnecessary autoload (it is in loaddefs.el). + * textmodes/picture.el (picture-desired-column) (picture-update-desired-column): Convert comments to doc-strings. (picture-substitute): Remove function. diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index aab5f8f65a4..cfca438a44b 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -1,6 +1,6 @@ ;;; perl-mode.el --- Perl code editing commands for GNU Emacs -;; Copyright (C) 1990, 1994, 2001-2012 Free Software Foundation, Inc. +;; Copyright (C) 1990, 1994, 2001-2012 Free Software Foundation, Inc. ;; Author: William F. Mann ;; Maintainer: FSF @@ -133,11 +133,6 @@ map) "Keymap used in Perl mode.") -(autoload 'c-macro-expand "cmacexp" - "Display the result of expanding all C macros occurring in the region. -The expansion is entirely correct because it uses the C preprocessor." - t) - (defvar perl-mode-syntax-table (let ((st (make-syntax-table (standard-syntax-table)))) (modify-syntax-entry ?\n ">" st) From 68892d275b8dff830ba48e271d8dc71ba84b2b14 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 15:02:59 -0400 Subject: [PATCH 13/36] * lisp/play/yow.el (yow-file): Use expand-file-name rather than concat. Remove old comment. --- lisp/ChangeLog | 2 ++ lisp/play/yow.el | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 24b564b6d70..68225f1bec8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2012-04-16 Glenn Morris + * play/yow.el (yow-file): Use expand-file-name rather than concat. + * progmodes/perl-mode.el (c-macro-expand): Remove unnecessary autoload (it is in loaddefs.el). diff --git a/lisp/play/yow.el b/lisp/play/yow.el index fa32fdf8272..864f49709fe 100644 --- a/lisp/play/yow.el +++ b/lisp/play/yow.el @@ -1,6 +1,6 @@ ;;; yow.el --- quote random zippyisms -;; Copyright (C) 1993-1995, 2000-2012 Free Software Foundation, Inc. +;; Copyright (C) 1993-1995, 2000-2012 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Author: Richard Mlynarik @@ -24,10 +24,6 @@ ;;; Commentary: ;; Important pinheadery for GNU Emacs. -;; -;; See cookie1.el for implementation. Note --- the `n' argument of yow -;; from the 18.xx implementation is no longer; we only support *random* -;; random access now. ;;; Code: @@ -38,7 +34,7 @@ :prefix "yow-" :group 'games) -(defcustom yow-file (concat data-directory "yow.lines") +(defcustom yow-file (expand-file-name data-directory "yow.lines") "File containing pertinent pinhead phrases." :type 'file :group 'yow) From e3ad7552dbc58b73350c543dd4e44d33b22ea26a Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 15:04:27 -0400 Subject: [PATCH 14/36] * cookie1.el (cookie-snarf): Explicit error if input file cannot be read. --- lisp/ChangeLog | 3 +++ lisp/play/cookie1.el | 2 ++ 2 files changed, 5 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 68225f1bec8..398d74b124f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2012-04-16 Glenn Morris + * play/cookie1.el (cookie-snarf): + Give an explicit error if input file cannot be read. + * play/yow.el (yow-file): Use expand-file-name rather than concat. * progmodes/perl-mode.el (c-macro-expand): diff --git a/lisp/play/cookie1.el b/lisp/play/cookie1.el index 06bd962d925..cbf29a26a71 100644 --- a/lisp/play/cookie1.el +++ b/lisp/play/cookie1.el @@ -96,6 +96,8 @@ of load, ENDMSG at the end." "Reads in the PHRASE-FILE, returns it as a vector of strings. Emit STARTMSG and ENDMSG before and after. Caches the result; second and subsequent calls on the same file won't go to disk." + (or (file-readable-p phrase-file) + (error "Cannot read file `%s'" phrase-file)) (let ((sym (intern-soft phrase-file cookie-cache))) (and sym (not (equal (symbol-function sym) (nth 5 (file-attributes phrase-file)))) From 175c5e4861127e7ce6659efefa03ab0cfad8f048 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 15:06:02 -0400 Subject: [PATCH 15/36] Fix comment typo --- lisp/mail/feedmail.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el index 4e76e5cdb64..f35560841e2 100644 --- a/lisp/mail/feedmail.el +++ b/lisp/mail/feedmail.el @@ -1586,7 +1586,7 @@ messages to make sure it works as expected." ;; feedmail-buffer-to-binmail, feedmail-buffer-to-sendmail, and -;; feedmail-buffer-to-smptmail are the only things provided for values +;; feedmail-buffer-to-smtpmail are the only things provided for values ;; for the variable feedmail-buffer-eating-function. It's pretty easy ;; to write your own, though. (defun feedmail-buffer-to-binmail (prepped errors-to addr-listoid) From 5261b92ebe71d21e8d36f65f4555a1f90c088281 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 15:09:19 -0400 Subject: [PATCH 16/36] * lisp/gnus/nndraft.el (nndraft-request-list): Fix declaration. --- lisp/gnus/ChangeLog | 4 ++++ lisp/gnus/nndraft.el | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 23e800e0f3f..52f140d9192 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,7 @@ +2012-04-16 Glenn Morris + + * nndraft.el (nndraft-request-list): Fix declaration. + 2012-04-14 Lars Magne Ingebrigtsen * gnus-msg.el (gnus-inews-insert-gcc): Don't do the alist stuff when we diff --git a/lisp/gnus/nndraft.el b/lisp/gnus/nndraft.el index 1800d0c02de..da50720ebbe 100644 --- a/lisp/gnus/nndraft.el +++ b/lisp/gnus/nndraft.el @@ -37,7 +37,8 @@ (require 'mm-util) (eval-when-compile (require 'cl)) -(declare-function nndraft-request-list "nnmh" (&rest args)) +;; The nnoo-import at the end, I think. +(declare-function nndraft-request-list "nndraft" (&rest args) t) (nnoo-declare nndraft nnmh) From b1aa797c7a2dbb910c9bd59c1d1e647bfe9a9d85 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 15:13:44 -0400 Subject: [PATCH 17/36] * configure.in (NS_HAVE_NSINTEGER): Remove unnecessary variable. --- ChangeLog | 2 ++ configure.in | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index fb0ce63727b..8d551e06f85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2012-04-16 Glenn Morris + * configure.in (NS_HAVE_NSINTEGER): Remove unnecessary variable. + * configure.in: Remove X libs workaround for old autoconf. 2012-04-12 Ken Brown diff --git a/configure.in b/configure.in index e0ac2ab1bad..fd1327ed2a9 100644 --- a/configure.in +++ b/configure.in @@ -1541,13 +1541,12 @@ fail; AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes], [AC_MSG_ERROR([`--with-ns' was specified, but the include files are missing or cannot be compiled.])]) - NS_HAVE_NSINTEGER=yes AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [NSInteger i;])], ns_have_nsinteger=yes, ns_have_nsinteger=no) - if test $ns_have_nsinteger = no; then - NS_HAVE_NSINTEGER=no + if test $ns_have_nsinteger = yes; then + AC_DEFINE(NS_HAVE_NSINTEGER, 1, [Define to 1 if `NSInteger' is defined.]) fi fi AC_SUBST(TEMACS_LDFLAGS2) @@ -2595,9 +2594,6 @@ if test "${HAVE_NS}" = "yes"; then ## Extra CFLAGS applied to src/*.m files. GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGSWARN -DGSDIAGNOSE" fi - if test "${NS_HAVE_NSINTEGER}" = "yes"; then - AC_DEFINE(NS_HAVE_NSINTEGER, 1, [Define to 1 if `NSInteger' is defined.]) - fi # We also have mouse menus. HAVE_MENUS=yes OTHER_FILES=ns-app From 0e829eabcd269467345002ad3d7e3b40e3fbd550 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 15:18:36 -0400 Subject: [PATCH 18/36] * lisp/calendar/cal-tex.el (cal-tex-end-document): Trivial clarification. --- lisp/ChangeLog | 2 ++ lisp/calendar/cal-tex.el | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 398d74b124f..49509ae5624 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2012-04-16 Glenn Morris + * calendar/cal-tex.el (cal-tex-end-document): Trivial clarification. + * play/cookie1.el (cookie-snarf): Give an explicit error if input file cannot be read. diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el index 14899431e2a..0ae2b38eaf6 100644 --- a/lisp/calendar/cal-tex.el +++ b/lisp/calendar/cal-tex.el @@ -1,6 +1,6 @@ ;;; cal-tex.el --- calendar functions for printing calendars with LaTeX -;; Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc. +;; Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc. ;; Author: Steve Fisk ;; Edward M. Reingold @@ -1588,8 +1588,7 @@ informative header, and run HOOK." (cal-tex-e-document) (or (and cal-tex-preamble-extra (string-match "inputenc" cal-tex-preamble-extra)) - (not (re-search-backward "[^[:ascii:]]" nil 'move)) - (progn + (when (re-search-backward "[^[:ascii:]]" nil 'move) (goto-char (point-min)) (when (search-forward "documentclass" nil t) (forward-line 1) From bf350d6a5988d8098f88c39788b50a7a1701918a Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 15:20:42 -0400 Subject: [PATCH 19/36] * lisp/emacs-lisp/cl-extra.el (*random-state*): Remove unnecessary declaration. --- lisp/ChangeLog | 3 +++ lisp/emacs-lisp/cl-extra.el | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 49509ae5624..8e85dd3c8c8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2012-04-16 Glenn Morris + * emacs-lisp/cl-extra.el (*random-state*): + Remove unnecessary declaration. + * calendar/cal-tex.el (cal-tex-end-document): Trivial clarification. * play/cookie1.el (cookie-snarf): diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 9ac5ce7d2f0..9a3d8cf705b 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -1,6 +1,6 @@ ;;; cl-extra.el --- Common Lisp features, part 2 -;; Copyright (C) 1993, 2000-2012 Free Software Foundation, Inc. +;; Copyright (C) 1993, 2000-2012 Free Software Foundation, Inc. ;; Author: Dave Gillespie ;; Keywords: extensions @@ -430,7 +430,6 @@ With two arguments, return rounding and remainder of their quotient." ;; Random numbers. -(defvar *random-state*) ;;;###autoload (defun random* (lim &optional state) "Return a random nonnegative number less than LIM, an integer or float. From 389c3aa7b2d5d4fca9281c5530bb8d307a167bbc Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 15:21:32 -0400 Subject: [PATCH 20/36] Header comment trivial fix --- lisp/emacs-lisp/ert-x.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index 257d0528cbc..a7916354c91 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2008, 2010-2012 Free Software Foundation, Inc. ;; Author: Lennart Borgman (lennart O borgman A gmail O com) -;; Author: Christian Ohler +;; Christian Ohler ;; This file is part of GNU Emacs. From 9d217643e091b06a020e4f3c751401cc7802ebf4 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 15:22:32 -0400 Subject: [PATCH 21/36] ChangeLog fix --- lisp/ChangeLog | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8e85dd3c8c8..9b136de8961 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1343,10 +1343,6 @@ * term/x-win.el (x-initialize-window-system): Reduce default for x-selection-timeout to 5 seconds (Bug#8869). -2012-02-24 Thierry Volpiatto - - * files.el (file-subdir-of-p): Fix typo. - 2012-02-24 Thierry Volpiatto * files.el (files-equal-p, file-subdir-of-p): New functions. From 099e72021d771b307875f1c4fc6dd1aedd786089 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 15:25:59 -0400 Subject: [PATCH 22/36] * eieio-opt.el (describe-class, describe-generic): Autoload trivia. --- lisp/ChangeLog | 3 +++ lisp/emacs-lisp/eieio-opt.el | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9b136de8961..8f790ab0dc5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2012-04-16 Glenn Morris + * emacs-lisp/eieio-opt.el (describe-class, describe-generic): + Autoload trivia. + * emacs-lisp/cl-extra.el (*random-state*): Remove unnecessary declaration. diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el index 10816aaa43c..a899839f68a 100644 --- a/lisp/emacs-lisp/eieio-opt.el +++ b/lisp/emacs-lisp/eieio-opt.el @@ -72,8 +72,7 @@ Argument CH-PREFIX is another character prefix to display." ;;; CLASS COMPLETION / DOCUMENTATION -;;;###autoload -(defalias 'describe-class 'eieio-describe-class) +;;;###autoload(defalias 'describe-class 'eieio-describe-class) ;;;###autoload (defun eieio-describe-class (class &optional headerfcn) @@ -305,8 +304,7 @@ are not abstract." ;;; METHOD COMPLETION / DOC (defalias 'describe-method 'eieio-describe-generic) -;;;###autoload -(defalias 'describe-generic 'eieio-describe-generic) +;;;###autoload(defalias 'describe-generic 'eieio-describe-generic) (defalias 'eieio-describe-method 'eieio-describe-generic) ;;;###autoload From f45f90f33151dc74ef541cba4fe87565215382a0 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Tue, 17 Apr 2012 03:28:57 +0800 Subject: [PATCH 23/36] * lisp/progmodes/python.el: Trivial cleanup. --- lisp/ChangeLog | 4 ++++ lisp/progmodes/python.el | 10 +--------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8f790ab0dc5..801a5e74804 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2012-04-16 Leo Liu + + * progmodes/python.el: Trivial cleanup. + 2012-04-16 Glenn Morris * emacs-lisp/eieio-opt.el (describe-class, describe-generic): diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 09b89993626..6f8758ebec1 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -69,11 +69,7 @@ (require 'comint) (require 'ansi-color) -(eval-when-compile - (require 'compile) - (require 'hippie-exp)) - -(autoload 'comint-mode "comint") +(eval-when-compile (require 'compile)) (defgroup python nil "Silly walks in the Python language." @@ -1488,8 +1484,6 @@ Don't save anything for STR matching `inferior-python-filter-regexp'." res) (t (concat res s))))) -(autoload 'comint-check-proc "comint") - (defvar python-version-checked nil) (defun python-check-version (cmd) "Check that CMD runs a suitable version of Python." @@ -1684,8 +1678,6 @@ value to determine defaults." "Caches (directory . file) pair used in the last `python-load-file' command. Used for determining the default in the next one.") -(autoload 'comint-get-source "comint") - (defun python-load-file (file-name) "Load a Python file FILE-NAME into the inferior Python process. If the file has extension `.py' import or reload it as a module. From 1197ecfa84c35f9497a340845595e7e1040e455d Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 16:13:38 -0400 Subject: [PATCH 24/36] two-column.el small cleanup * lisp/textmodes/two-column.el: Move custom options to the start. (frame-width): Remove compat definition. (2C-associate-buffer, 2C-dissociate): Use with-current-buffer rather than save-excursion. (2C-dissociate): Force a mode-line update. (2C-autoscroll): Use ignore-errors. --- lisp/ChangeLog | 7 ++ lisp/textmodes/two-column.el | 210 ++++++++++++++--------------------- 2 files changed, 91 insertions(+), 126 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 801a5e74804..906adf26971 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -4,6 +4,13 @@ 2012-04-16 Glenn Morris + * textmodes/two-column.el: Move custom options to the start. + (frame-width): Remove compat definition. + (2C-associate-buffer, 2C-dissociate): + Use with-current-buffer rather than save-excursion. + (2C-dissociate): Force a mode-line update. + (2C-autoscroll): Use ignore-errors. + * emacs-lisp/eieio-opt.el (describe-class, describe-generic): Autoload trivia. diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el index 40cbbc59292..8a4fe4f87fd 100644 --- a/lisp/textmodes/two-column.el +++ b/lisp/textmodes/two-column.el @@ -124,15 +124,51 @@ ;;; Code: +(defgroup two-column nil + "Minor mode for editing of two-column text." + :prefix "2C-" + :group 'frames) + +(defcustom 2C-mode-line-format + '("-%*- %15b --" (-3 . "%p") "--%[(" mode-name + minor-mode-alist "%n" mode-line-process ")%]%-") + "Value of `mode-line-format' for a buffer in two-column minor mode." + :type 'sexp + :group 'two-column) + +(defcustom 2C-other-buffer-hook 'text-mode + "Hook run in new buffer when it is associated with current one." + :type 'function + :group 'two-column) + +(defcustom 2C-separator "" + "A string inserted between the two columns when merging. +This gets set locally by \\[2C-split]." + :type 'string + :group 'two-column) +(put '2C-separator 'permanent-local t) + +(defcustom 2C-window-width 40 + "The width of the first column. (Must be at least `window-min-width'.) +This value is local for every buffer that sets it." + :type 'integer + :group 'two-column) +(make-variable-buffer-local '2C-window-width) +(put '2C-window-width 'permanent-local t) + +(defcustom 2C-beyond-fill-column 4 + "Base for calculating `fill-column' for a buffer in two-column minor mode. +The value of `fill-column' becomes `2C-window-width' for this buffer +minus this value." + :type 'integer + :group 'two-column) + +(defcustom 2C-autoscroll t + "If non-nil, Emacs attempts to keep the two column's buffers aligned." + :type 'boolean + :group 'two-column) + - -;; Lucid patch -(or (fboundp 'frame-width) - (fset 'frame-width 'screen-width)) - - -;;;;; Set up keymap ;;;;; - (defvar 2C-mode-map (let ((map (make-sparse-keymap))) (define-key map "2" '2C-two-columns) @@ -142,8 +178,6 @@ map) "Keymap for commands for setting up two-column mode.") - - ;;;###autoload (autoload '2C-command "two-column" () t 'keymap) (fset '2C-command 2C-mode-map) @@ -154,7 +188,6 @@ ;;;###autoload (global-set-key [f2] '2C-command) - (defvar 2C-minor-mode-map (let ((map (make-sparse-keymap))) (define-key map "1" '2C-merge) @@ -167,7 +200,6 @@ map) "Keymap for commands for use in two-column mode.") - (setq minor-mode-map-alist (cons (cons '2C-mode (let ((map (make-sparse-keymap))) @@ -181,15 +213,8 @@ map (current-global-map)) map)) minor-mode-map-alist)) + -;;;;; variable declarations ;;;;; - -(defgroup two-column nil - "Minor mode for editing of two-column text." - :prefix "2C-" - :group 'frames) - - ;; Markers seem to be the only buffer-id not affected by renaming a buffer. ;; This nevertheless loses when a buffer is killed. The variable-name is ;; required by `describe-mode'. @@ -198,62 +223,8 @@ (make-variable-buffer-local '2C-mode) (put '2C-mode 'permanent-local t) - - (setq minor-mode-alist (cons '(2C-mode " 2C") minor-mode-alist)) - - -;; rearranged, so that the pertinent info will show in 40 columns -(defcustom 2C-mode-line-format - '("-%*- %15b --" (-3 . "%p") "--%[(" mode-name - minor-mode-alist "%n" mode-line-process ")%]%-") - "Value of `mode-line-format' for a buffer in two-column minor mode." - :type 'sexp - :group 'two-column) - - -(defcustom 2C-other-buffer-hook 'text-mode - "Hook run in new buffer when it is associated with current one." - :type 'function - :group 'two-column) - - -(defcustom 2C-separator "" - "A string inserted between the two columns when merging. -This gets set locally by \\[2C-split]." - :type 'string - :group 'two-column) -(put '2C-separator 'permanent-local t) - - - -(defcustom 2C-window-width 40 - "The width of the first column. (Must be at least `window-min-width') -This value is local for every buffer that sets it." - :type 'integer - :group 'two-column) -(make-variable-buffer-local '2C-window-width) -(put '2C-window-width 'permanent-local t) - - - -(defcustom 2C-beyond-fill-column 4 - "Base for calculating `fill-column' for a buffer in two-column minor mode. -The value of `fill-column' becomes `2C-window-width' for this buffer -minus this value." - :type 'integer - :group 'two-column) - - - -(defcustom 2C-autoscroll t - "If non-nil, Emacs attempts to keep the two column's buffers aligned." - :type 'boolean - :group 'two-column) - - - (defvar 2C-autoscroll-start nil) (make-variable-buffer-local '2C-autoscroll-start) @@ -276,7 +247,6 @@ minus this value." (if req (error "You must first set two-column minor mode")))) - ;; function for setting up two-column minor mode in a buffer associated ;; with the buffer pointed to by the marker other. (defun 2C-mode (other) @@ -320,7 +290,6 @@ The appearance of the screen can be customized by the variables (run-hooks '2C-mode-hook)) - ;;;###autoload (defun 2C-two-columns (&optional buffer) "Split current window vertically for two-column editing. @@ -356,7 +325,6 @@ first and the associated buffer to its right." (other-window -1))))) - ;;;###autoload (defun 2C-associate-buffer () "Associate another buffer with this one in two-column minor mode. @@ -368,9 +336,8 @@ accepting the proposed default buffer. (let ((b1 (current-buffer)) (b2 (or (2C-other) (read-buffer "Associate buffer: " (other-buffer))))) - (save-excursion - (setq 2C-mode nil) - (set-buffer b2) + (setq 2C-mode nil) + (with-current-buffer b2 (and (2C-other) (not (eq b1 (2C-other))) (error "Buffer already associated with buffer `%s'" @@ -382,7 +349,6 @@ accepting the proposed default buffer. (2C-two-columns b2))) - ;;;###autoload (defun 2C-split (arg) "Split a two-column text at point, into two buffers in two-column minor mode. @@ -454,32 +420,28 @@ First column's text sSs Second column's text (move-to-column column))))) - - (defun 2C-dissociate () "Turn off two-column minor mode in current and associated buffer. If the associated buffer is unmodified and empty, it is killed." (interactive) - (let ((buffer (current-buffer))) - (save-excursion - (and (2C-other) - (set-buffer (2C-other)) - (or (not (2C-other)) - (eq buffer (2C-other))) - (if (and (not (buffer-modified-p)) - (eobp) (bobp)) - (kill-buffer nil) - (kill-local-variable '2C-mode) - (kill-local-variable '2C-window-width) - (kill-local-variable '2C-separator) - (kill-local-variable 'mode-line-format) - (kill-local-variable 'fill-column)))) - (kill-local-variable '2C-mode) - (kill-local-variable '2C-window-width) - (kill-local-variable '2C-separator) - (kill-local-variable 'mode-line-format) - (kill-local-variable 'fill-column))) - + (let ((buffer (current-buffer)) + (other (2C-other))) + (if other + (with-current-buffer other + (when (or (not (2C-other)) (eq buffer (2C-other))) + (if (and (not (buffer-modified-p)) (zerop (buffer-size))) + (kill-buffer) + (kill-local-variable '2C-mode) + (kill-local-variable '2C-window-width) + (kill-local-variable '2C-separator) + (kill-local-variable 'mode-line-format) + (kill-local-variable 'fill-column)))))) + (kill-local-variable '2C-mode) + (kill-local-variable '2C-window-width) + (kill-local-variable '2C-separator) + (kill-local-variable 'mode-line-format) + (kill-local-variable 'fill-column) + (force-mode-line-update)) ;; this doesn't use yank-rectangle, so that the first column can @@ -578,7 +540,6 @@ on, this also realigns the two buffers." (message "Autoscrolling is off."))) - (defun 2C-autoscroll () (if 2C-autoscroll ;; catch a mouse scroll on non-selected scrollbar @@ -590,27 +551,25 @@ on, this also realigns the two buffers." (select-window (car (car (cdr last-command-event))))) ;; In some cases scrolling causes an error, but post-command-hook ;; shouldn't, and should always stay in the original window - (condition-case () - (and (or 2C-autoscroll-start (2C-toggle-autoscroll t) nil) - (/= (window-start) 2C-autoscroll-start) - (2C-other) - (get-buffer-window (2C-other)) - (let ((lines (count-lines (window-start) - 2C-autoscroll-start))) - (if (< (window-start) 2C-autoscroll-start) - (setq lines (- lines))) - (setq 2C-autoscroll-start (window-start)) - (select-window (get-buffer-window (2C-other))) - ;; make sure that other buffer has enough lines - (save-excursion - (insert-char - ?\n (- lines (count-lines (window-start) - (goto-char (point-max))) - -1))) - (scroll-up lines) - (setq 2C-autoscroll-start (window-start)))) - (error)))))) - + (ignore-errors + (and (or 2C-autoscroll-start (2C-toggle-autoscroll t) nil) + (/= (window-start) 2C-autoscroll-start) + (2C-other) + (get-buffer-window (2C-other)) + (let ((lines (count-lines (window-start) + 2C-autoscroll-start))) + (if (< (window-start) 2C-autoscroll-start) + (setq lines (- lines))) + (setq 2C-autoscroll-start (window-start)) + (select-window (get-buffer-window (2C-other))) + ;; make sure that other buffer has enough lines + (save-excursion + (insert-char + ?\n (- lines (count-lines (window-start) + (goto-char (point-max))) + -1))) + (scroll-up lines) + (setq 2C-autoscroll-start (window-start))))))))) (defun 2C-enlarge-window-horizontally (arg) @@ -628,7 +587,6 @@ on, this also realigns the two buffers." (2C-enlarge-window-horizontally (- arg))) - (provide 'two-column) ;;; two-column.el ends here From f53a85a90a16970fe9dc15294a2ebdb984369c97 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 19:07:19 -0400 Subject: [PATCH 25/36] Fix thinko in previous yow.el change --- lisp/play/yow.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/play/yow.el b/lisp/play/yow.el index 864f49709fe..cb02a839cde 100644 --- a/lisp/play/yow.el +++ b/lisp/play/yow.el @@ -34,7 +34,7 @@ :prefix "yow-" :group 'games) -(defcustom yow-file (expand-file-name data-directory "yow.lines") +(defcustom yow-file (expand-file-name "yow.lines" data-directory) "File containing pertinent pinhead phrases." :type 'file :group 'yow) From 121b8917ec329a6bbc292ad02f5c4e39d164fff5 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 19:57:09 -0400 Subject: [PATCH 26/36] Replace independent implementations of string-prefix-p * vc/vc.el (vc-string-prefix-p): * vc/pcvs-util.el (cvs-string-prefix-p): * textmodes/tex-mode.el (latex-string-prefix-p, tex-string-prefix-p): * mpc.el (mpc-string-prefix-p): Make all of these into obsolete aliases for string-prefix-p. Update callers. * vc/pcvs.el, vc/vc-dispatcher.el, vc/vc-dir.el: Update callers. --- lisp/ChangeLog | 8 ++++++++ lisp/mpc.el | 9 +++------ lisp/textmodes/tex-mode.el | 15 ++++++--------- lisp/vc/pcvs-util.el | 4 +--- lisp/vc/pcvs.el | 14 +++++++------- lisp/vc/vc-dir.el | 14 +++++++------- lisp/vc/vc-dispatcher.el | 3 +-- lisp/vc/vc.el | 12 ++++-------- 8 files changed, 37 insertions(+), 42 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 906adf26971..280bfe769a2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -4,6 +4,14 @@ 2012-04-16 Glenn Morris + * vc/vc.el (vc-string-prefix-p): + * vc/pcvs-util.el (cvs-string-prefix-p): + * textmodes/tex-mode.el (latex-string-prefix-p, tex-string-prefix-p): + * mpc.el (mpc-string-prefix-p): + Make all of these into obsolete aliases for string-prefix-p. + Update callers. + * vc/pcvs.el, vc/vc-dispatcher.el, vc/vc-dir.el: Update callers. + * textmodes/two-column.el: Move custom options to the start. (frame-width): Remove compat definition. (2C-associate-buffer, 2C-dissociate): diff --git a/lisp/mpc.el b/lisp/mpc.el index 614f2bd6806..d2203a4deab 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -1,6 +1,6 @@ ;;; mpc.el --- A client for the Music Player Daemon -*- coding: utf-8; lexical-binding: t -*- -;; Copyright (C) 2006-2012 Free Software Foundation, Inc. +;; Copyright (C) 2006-2012 Free Software Foundation, Inc. ;; Author: Stefan Monnier ;; Keywords: multimedia @@ -184,10 +184,7 @@ numerically rather than lexicographically." (abs res)) res)))))))) -(defun mpc-string-prefix-p (str1 str2) - ;; FIXME: copied from pcvs-util.el. - "Tell whether STR1 is a prefix of STR2." - (eq t (compare-strings str2 nil (length str1) str1 nil nil))) +(define-obsolete-function-alias 'mpc-string-prefix-p 'string-prefix-p "24.2") ;; This can speed up mpc--song-search significantly. The table may grow ;; very large, tho. It's only bounded by the fact that it gets flushed @@ -1690,7 +1687,7 @@ Return non-nil if a selection was deactivated." (process-put (mpc-proc) prop (delq nil (mapcar (lambda (x) - (if (mpc-string-prefix-p name x) + (if (string-prefix-p name x) nil x)) new))))) (mpc-tagbrowser-refresh))) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 9472d7df879..af00531137a 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -1492,8 +1492,8 @@ Puts point on a blank line between them." (defvar latex-complete-bibtex-cache nil) -(defun latex-string-prefix-p (str1 str2) - (eq t (compare-strings str1 nil nil str2 0 (length str1)))) +(define-obsolete-function-alias 'latex-string-prefix-p + 'string-prefix-p "24.2") (defvar bibtex-reference-key) (declare-function reftex-get-bibfile-list "reftex-cite.el" ()) @@ -1507,7 +1507,7 @@ Puts point on a blank line between them." keys) (if (and (eq (car latex-complete-bibtex-cache) (reftex-get-bibfile-list)) - (latex-string-prefix-p (nth 1 latex-complete-bibtex-cache) + (string-prefix-p (nth 1 latex-complete-bibtex-cache) key)) ;; Use the cache. (setq keys (nth 2 latex-complete-bibtex-cache)) @@ -2051,10 +2051,7 @@ IN can be either a string (with the same % escapes in it) indicating OUT describes the output file and is either a %-escaped string or nil to indicate that there is no output file.") -;; defsubst* gives better byte-code than defsubst. -(defsubst* tex-string-prefix-p (str1 str2) - "Return non-nil if STR1 is a prefix of STR2" - (eq t (compare-strings str2 nil (length str1) str1 nil nil))) +(define-obsolete-function-alias 'tex-string-prefix-p 'string-prefix-p "24.2") (defun tex-guess-main-file (&optional all) "Find a likely `tex-main-file'. @@ -2069,7 +2066,7 @@ of the current buffer." (with-current-buffer buf (when (and (cond ((null all) (equal dir default-directory)) - ((eq all 'sub) (tex-string-prefix-p default-directory dir)) + ((eq all 'sub) (string-prefix-p default-directory dir)) (t)) (stringp tex-main-file)) (throw 'found (expand-file-name tex-main-file))))) @@ -2078,7 +2075,7 @@ of the current buffer." (with-current-buffer buf (when (and (cond ((null all) (equal dir default-directory)) - ((eq all 'sub) (tex-string-prefix-p default-directory dir)) + ((eq all 'sub) (string-prefix-p default-directory dir)) (t)) buffer-file-name ;; (or (easy-mmode-derived-mode-p 'latex-mode) diff --git a/lisp/vc/pcvs-util.el b/lisp/vc/pcvs-util.el index b300247e552..a3c525cb896 100644 --- a/lisp/vc/pcvs-util.el +++ b/lisp/vc/pcvs-util.el @@ -182,9 +182,7 @@ arguments. If ARGS is not a list, no argument will be passed." (if oneline (line-end-position) (point-max)))) (file-error nil))) -(defun cvs-string-prefix-p (str1 str2) - "Tell whether STR1 is a prefix of STR2." - (eq t (compare-strings str2 nil (length str1) str1 nil nil))) +(define-obsolete-function-alias 'cvs-string-prefix-p 'string-prefix-p "24.2") ;;;; ;;;; file names diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el index 9ba65cda143..6aec24755b5 100644 --- a/lisp/vc/pcvs.el +++ b/lisp/vc/pcvs.el @@ -432,8 +432,8 @@ If non-nil, NEW means to create a new buffer no matter what." (case cvs-reuse-cvs-buffer (always t) (subdir - (or (cvs-string-prefix-p default-directory dir) - (cvs-string-prefix-p dir default-directory))) + (or (string-prefix-p default-directory dir) + (string-prefix-p dir default-directory))) (samedir (string= default-directory dir))) (return buffer))))) ;; we really have to create a new buffer: @@ -887,7 +887,7 @@ RM-MSGS if non-nil means remove messages." (eq (cvs-fileinfo->type last-fi) 'DIRCHANGE) (not (when first-dir (setq first-dir nil) t)) (or (eq rm-dirs 'all) - (not (cvs-string-prefix-p + (not (string-prefix-p (cvs-fileinfo->dir last-fi) (cvs-fileinfo->dir fi))) (and (eq type 'DIRCHANGE) (eq rm-dirs 'empty)) @@ -1839,7 +1839,7 @@ Signal an error if there is no backup file." (setq buffer-file-name (expand-file-name buffer-file-name)) (let (ret) (dolist (fi (or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." "")))) - (when (cvs-string-prefix-p + (when (string-prefix-p (expand-file-name (cvs-fileinfo->full-name fi) dir) buffer-file-name) (setq ret t))) @@ -2261,7 +2261,7 @@ With prefix argument, prompt for cvs flags." (defun cvs-dir-member-p (fileinfo dir) "Return true if FILEINFO represents a file in directory DIR." (and (not (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE)) - (cvs-string-prefix-p dir (cvs-fileinfo->dir fileinfo)))) + (string-prefix-p dir (cvs-fileinfo->dir fileinfo)))) (defun cvs-execute-single-file (fi extractor program constant-args) "Internal function for `cvs-execute-single-file-list'." @@ -2392,7 +2392,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'." (set-buffer cvs-buf) ;; look for a corresponding pcl-cvs buffer (when (and (eq major-mode 'cvs-mode) - (cvs-string-prefix-p default-directory dir)) + (string-prefix-p default-directory dir)) (let ((subdir (substring dir (length default-directory)))) (set-buffer buffer) (set (make-local-variable 'cvs-buffer) cvs-buf) @@ -2423,7 +2423,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'." (set-buffer cvs-buf) ;; look for a corresponding pcl-cvs buffer (when (and (eq major-mode 'cvs-mode) - (cvs-string-prefix-p default-directory file)) + (string-prefix-p default-directory file)) (let* ((file (substring file (length default-directory))) (fi (cvs-create-fileinfo (if (string= "0" version) diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 33611b4eafd..4c32eea2f72 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -1,6 +1,6 @@ ;;; vc-dir.el --- Directory status display under VC -;; Copyright (C) 2007-2012 Free Software Foundation, Inc. +;; Copyright (C) 2007-2012 Free Software Foundation, Inc. ;; Author: Dan Nicolaescu ;; Keywords: vc tools @@ -556,7 +556,7 @@ If a prefix argument is given, move by that many lines." (let ((data (ewoc-data crt)) (dir (vc-dir-node-directory crt))) (and (vc-dir-fileinfo->directory data) - (vc-string-prefix-p dir argdir) + (string-prefix-p dir argdir) (vc-dir-fileinfo->marked data) (setq found data)))) found)) @@ -818,7 +818,7 @@ child files." data) (while (and (setq crt (ewoc-next vc-ewoc crt)) - (vc-string-prefix-p dir + (string-prefix-p dir (progn (setq data (ewoc-data crt)) (vc-dir-node-directory crt)))) @@ -846,7 +846,7 @@ If it is a file, return the corresponding cons for the file itself." data) (while (and (setq crt (ewoc-next vc-ewoc crt)) - (vc-string-prefix-p dir (progn + (string-prefix-p dir (progn (setq data (ewoc-data crt)) (vc-dir-node-directory crt)))) (unless (vc-dir-fileinfo->directory data) @@ -878,10 +878,10 @@ If it is a file, return the corresponding cons for the file itself." children dname) ;; Find DIR - (while (and crt (not (vc-string-prefix-p + (while (and crt (not (string-prefix-p dirname (vc-dir-node-directory crt)))) (setq crt (ewoc-next vc-ewoc crt))) - (while (and crt (vc-string-prefix-p + (while (and crt (string-prefix-p dirname (setq dname (vc-dir-node-directory crt)))) (let ((data (ewoc-data crt))) @@ -915,7 +915,7 @@ If it is a file, return the corresponding cons for the file itself." (if (not (derived-mode-p 'vc-dir-mode)) (push status-buf drop) (let ((ddir default-directory)) - (when (vc-string-prefix-p ddir file) + (when (string-prefix-p ddir file) (if (file-directory-p file) (progn (vc-dir-resync-directory-files file) diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index ec1b127dd19..95c15030953 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el @@ -537,13 +537,12 @@ editing!" (kill-buffer (current-buffer))))) (declare-function vc-dir-resynch-file "vc-dir" (&optional fname)) -(declare-function vc-string-prefix-p "vc" (prefix string)) (defun vc-resynch-buffers-in-directory (directory &optional keep noquery reset-vc-info) "Resync all buffers that visit files in DIRECTORY." (dolist (buffer (buffer-list)) (let ((fname (buffer-file-name buffer))) - (when (and fname (vc-string-prefix-p directory fname)) + (when (and fname (string-prefix-p directory fname)) (with-current-buffer buffer (vc-resynch-buffer fname keep noquery reset-vc-info)))))) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 4cbbf47c2d6..ab7e587eb79 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1,6 +1,6 @@ ;;; vc.el --- drive a version-control system from within Emacs -;; Copyright (C) 1992-1998, 2000-2012 Free Software Foundation, Inc. +;; Copyright (C) 1992-1998, 2000-2012 Free Software Foundation, Inc. ;; Author: FSF (see below for full credits) ;; Maintainer: Andre Spiegel @@ -847,7 +847,7 @@ been updated to their corresponding values." (if (file-directory-p file) (dolist (buffer (buffer-list)) (let ((fname (buffer-file-name buffer))) - (when (and fname (vc-string-prefix-p file fname)) + (when (and fname (string-prefix-p file fname)) (push fname flist)))) (push file flist))) ,form @@ -900,7 +900,7 @@ use." (lambda (arg) (message "arg %s" arg) (and (file-directory-p arg) - (vc-string-prefix-p (expand-file-name arg) def-dir))))))) + (string-prefix-p (expand-file-name arg) def-dir))))))) (let ((default-directory repo-dir)) (vc-call-backend bk 'create-repo)) (throw 'found bk)))) @@ -2809,11 +2809,7 @@ to provide the `find-revision' operation instead." ;; These things should probably be generally available - -(defun vc-string-prefix-p (prefix string) - (let ((lpref (length prefix))) - (and (>= (length string) lpref) - (eq t (compare-strings prefix nil nil string nil lpref))))) +(define-obsolete-function-alias 'vc-string-prefix-p 'string-prefix-p "24.2") (defun vc-file-tree-walk (dirname func &rest args) "Walk recursively through DIRNAME. From 41f03f4da76827e8611267ee5283a5df8071a617 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 20:04:53 -0400 Subject: [PATCH 27/36] Use auto-hscroll-mode rather than the alias automatic-hscrolling * lisp/mouse.el (mouse-drag-track): * lisp/speedbar.el (speedbar-frame-mode): Use auto-hscroll-mode rather than the alias automatic-hscrolling. --- lisp/ChangeLog | 6 ++++++ lisp/mouse.el | 8 ++++---- lisp/speedbar.el | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 280bfe769a2..599a69bb9c2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-04-17 Glenn Morris + + * mouse.el (mouse-drag-track): + * speedbar.el (speedbar-frame-mode): + Use auto-hscroll-mode rather than the alias automatic-hscrolling. + 2012-04-16 Leo Liu * progmodes/python.el: Trivial cleanup. diff --git a/lisp/mouse.el b/lisp/mouse.el index 2e119483797..3344bbec2cc 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1,6 +1,6 @@ ;;; mouse.el --- window system-independent mouse support -;; Copyright (C) 1993-1995, 1999-2012 Free Software Foundation, Inc. +;; Copyright (C) 1993-1995, 1999-2012 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: hardware, mouse @@ -805,8 +805,8 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by (= click-count 1))) ;; Suppress automatic hscrolling, because that is a nuisance ;; when setting point near the right fringe (but see below). - (automatic-hscrolling-saved automatic-hscrolling) - (automatic-hscrolling nil) + (auto-hscroll-mode-saved auto-hscroll-mode) + (auto-hscroll-mode nil) event end end-point) (setq mouse-selection-click-count click-count) @@ -838,7 +838,7 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by ;; Automatic hscrolling did not occur during the call to ;; `read-event'; but if the user subsequently drags the ;; mouse, go ahead and hscroll. - (let ((automatic-hscrolling automatic-hscrolling-saved)) + (let ((auto-hscroll-mode auto-hscroll-mode-saved)) (redisplay)) (setq end (event-end event) end-point (posn-point end)) diff --git a/lisp/speedbar.el b/lisp/speedbar.el index bb1debb4552..9065d9ed131 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -1,6 +1,6 @@ ;;; speedbar --- quick access to files and tags in a frame -;; Copyright (C) 1996-2012 Free Software Foundation, Inc. +;; Copyright (C) 1996-2012 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: file, tags, tools @@ -1022,7 +1022,7 @@ supported at a time. (set (make-local-variable 'dframe-delete-frame-function) 'speedbar-handle-delete-frame) ;; hscroll - (set (make-local-variable 'automatic-hscrolling) nil) ; Emacs 21 + (set (make-local-variable 'auto-hscroll-mode) nil) ;; reset the selection variable (setq speedbar-last-selected-file nil)) From 316411f0f20d409ec24ee892393f15701b05de1c Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 16 Apr 2012 21:29:58 -0400 Subject: [PATCH 28/36] Add functions to get system user names, group names Note from committer: I removed the part that adds grp.h to AC_CHECK_HEADERS and +#ifdef HAVE_GRP_H #include +#endif to src/dired.c, because the latter has unconditionally included grp.h since 2003, and uses it eg in stat_gname. * configure.in (AC_CHECK_FUNCS): Add getpwent, endpwent, getgrent, endgrent. * src/dired.c (Fsystem_users, Fsystem_groups): New functions. (syms_of_dired): Add them. Fixes: debbugs:7900 --- ChangeLog | 5 +++++ configure.in | 1 + src/ChangeLog | 5 +++++ src/dired.c | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8d551e06f85..a7da9e1ad5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-04-17 Dmitry Antipov + + * configure.in (AC_CHECK_FUNCS): + Add getpwent, endpwent, getgrent, endgrent. (Bug#7900) + 2012-04-16 Glenn Morris * configure.in (NS_HAVE_NSINTEGER): Remove unnecessary variable. diff --git a/configure.in b/configure.in index fd1327ed2a9..c9f0cd7688c 100644 --- a/configure.in +++ b/configure.in @@ -2736,6 +2736,7 @@ __fpending mblen mbrlen mbsinit strsignal setitimer ualarm \ sendto recvfrom getsockopt setsockopt getsockname getpeername \ gai_strerror mkstemp getline getdelim mremap fsync sync \ difftime mempcpy mblen mbrlen posix_memalign \ +getpwent endpwent getgrent endgrent \ cfmakeraw cfsetspeed copysign __executable_start) dnl Cannot use AC_CHECK_FUNCS diff --git a/src/ChangeLog b/src/ChangeLog index e321a70d4c3..bcb2edee96f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-04-17 Dmitry Antipov + + * dired.c (Fsystem_users, Fsystem_groups): New functions. (Bug#7900) + (syms_of_dired): Add them. + 2012-04-16 Paul Eggert Fix minor alloc.c problems found by static checking. diff --git a/src/dired.c b/src/dired.c index 9b0f94a0760..2c634b9ca6f 100644 --- a/src/dired.c +++ b/src/dired.c @@ -1015,6 +1015,45 @@ Comparison is in lexicographic order and case is significant. */) return Fstring_lessp (Fcar (f1), Fcar (f2)); } + +DEFUN ("system-users", Fsystem_users, Ssystem_users, 0, 0, 0, + doc: /* Return a list of user names currently registered in the system. +The value may be nil if not supported on this platform. */) + (void) +{ + Lisp_Object users = Qnil; +#if defined(HAVE_GETPWENT) && defined(HAVE_ENDPWENT) + struct passwd *pw; + + while ((pw = getpwent ())) + users = Fcons (DECODE_SYSTEM (build_string (pw->pw_name)), users); + + endpwent (); +#endif + if (EQ (users, Qnil)) + /* At least current user is always known. */ + users = Fcons (Vuser_real_login_name, Qnil); + return users; +} + +DEFUN ("system-groups", Fsystem_groups, Ssystem_groups, 0, 0, 0, + doc: /* Return a list of user group names currently registered in the system. +The value may be nil if not supported on this platform. */) + (void) +{ + Lisp_Object groups = Qnil; +#if defined(HAVE_GETGRENT) && defined(HAVE_ENDGRENT) + struct group *gr; + int length; + + while ((gr = getgrent ())) + groups = Fcons (DECODE_SYSTEM (build_string (gr->gr_name)), groups); + + endgrent (); +#endif + return groups; +} + void syms_of_dired (void) { @@ -1032,6 +1071,8 @@ syms_of_dired (void) defsubr (&Sfile_name_all_completions); defsubr (&Sfile_attributes); defsubr (&Sfile_attributes_lessp); + defsubr (&Ssystem_users); + defsubr (&Ssystem_groups); DEFVAR_LISP ("completion-ignored-extensions", Vcompletion_ignored_extensions, doc: /* Completion ignores file names ending in any string in this list. From e5a36063440039e18fe6db354693baf13ee7709c Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 21:35:15 -0400 Subject: [PATCH 29/36] * src/dired.c (Fsystem_users): Doc fix. * etc/NEWS: Mention system-users, system-groups. --- etc/NEWS | 3 +++ src/ChangeLog | 4 ++++ src/dired.c | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index 03ec5405803..2ac4b187381 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -32,6 +32,9 @@ been adding them there, put them somewhere else, eg site-lisp. * Changes in Emacs 24.2 +** New functions `system-users', `system-groups' return lists of the user +name, group names known to the system (where possible). + ** If your Emacs was built from a bzr checkout, the new variable `emacs-bzr-version' contains information about which bzr revision was used. diff --git a/src/ChangeLog b/src/ChangeLog index bcb2edee96f..8c0dcc9c044 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2012-04-17 Glenn Morris + + * dired.c (Fsystem_users): Doc fix. + 2012-04-17 Dmitry Antipov * dired.c (Fsystem_users, Fsystem_groups): New functions. (Bug#7900) diff --git a/src/dired.c b/src/dired.c index 2c634b9ca6f..eeae59d2801 100644 --- a/src/dired.c +++ b/src/dired.c @@ -1018,7 +1018,8 @@ Comparison is in lexicographic order and case is significant. */) DEFUN ("system-users", Fsystem_users, Ssystem_users, 0, 0, 0, doc: /* Return a list of user names currently registered in the system. -The value may be nil if not supported on this platform. */) +If we don't know how to determine that on this platform, just +return a list with one element, taken from `user-real-login-name'. */) (void) { Lisp_Object users = Qnil; From 30009afd5b72606149d13eba52cf1a3ab96e3cc5 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 16 Apr 2012 21:49:40 -0400 Subject: [PATCH 30/36] Add user, group name completion to dired Note from committer: I modified the original patch, by adding the new collection argument at the end of the argument list rather than in the middle. * dired-aux.el (dired-mark-read-string): Offer optional completion. (dired-do-chxxx): Complete chown, chgrp over users, groups. Fixes: debbugs:7900 --- lisp/ChangeLog | 5 +++++ lisp/dired-aux.el | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 599a69bb9c2..31caf9b6a34 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-04-17 Dmitry Antipov + + * dired-aux.el (dired-mark-read-string): Offer optional completion. + (dired-do-chxxx): Complete chown, chgrp over users, groups. (Bug#7900) + 2012-04-17 Glenn Morris * mouse.el (mouse-drag-track): diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 0795b0175a2..97ff0cbd07e 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -245,7 +245,11 @@ List has a form of (file-name full-file-name (attribute-list))." " (default now): " ": "))) (new-attribute (dired-mark-read-string prompt nil op-symbol - arg files default)) + arg files default + (cond ((eq op-symbol 'chown) + (system-users)) + ((eq op-symbol 'chgrp) + (system-groups))))) (operation (concat program " " new-attribute)) failures) (setq failures @@ -385,7 +389,7 @@ Uses the shell command coming from variables `lpr-command' and (dired-run-shell-command (dired-shell-stuff-it command file-list nil)))) (defun dired-mark-read-string (prompt initial op-symbol arg files - &optional default-value) + &optional default-value collection) "Read args for a Dired marked-files command, prompting with PROMPT. Return the user input (a string). @@ -399,9 +403,9 @@ of such values, available via history commands. Note that if the user enters empty input, this function returns the empty string, not DEFAULT-VALUE." (dired-mark-pop-up nil op-symbol files - 'read-from-minibuffer + 'completing-read (format prompt (dired-mark-prompt arg files)) - initial nil nil nil default-value)) + collection nil nil initial nil default-value nil)) ;;; Cleaning a directory: flagging some backups for deletion. From 12e10e61a507c695f6b21f19accb6d6bb7e7e156 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 21:52:00 -0400 Subject: [PATCH 31/36] * lisp/dired-aux.el (dired-mark-read-string): Doc fix. --- lisp/ChangeLog | 4 ++++ lisp/dired-aux.el | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 31caf9b6a34..4a9aee338ae 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2012-04-17 Glenn Morris + + * dired-aux.el (dired-mark-read-string): Doc fix. + 2012-04-17 Dmitry Antipov * dired-aux.el (dired-mark-read-string): Offer optional completion. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 97ff0cbd07e..8a499c47464 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -401,7 +401,10 @@ FILES should be a list of file names. DEFAULT-VALUE, if non-nil, should be a \"standard\" value or list of such values, available via history commands. Note that if the user enters empty input, this function returns the empty string, -not DEFAULT-VALUE." +not DEFAULT-VALUE. + +Optional argument COLLECTION is a collection of possible completions, +suitable for use by `completing-read'." (dired-mark-pop-up nil op-symbol files 'completing-read (format prompt (dired-mark-prompt arg files)) From fc72b15c777af496e9dcbc240f424135379ba955 Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Mon, 16 Apr 2012 19:46:22 -0700 Subject: [PATCH 32/36] Add perl-indent-parens-as-block option (tiny change) * lisp/progmodes/perl-mode.el (perl-indent-parens-as-block): New option. (perl-calculate-indent): Respect it. Fixes: debbugs:11118 --- etc/NEWS | 5 ++++- lisp/ChangeLog | 6 ++++++ lisp/progmodes/perl-mode.el | 15 +++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 2ac4b187381..5c2bb83e2a3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -70,7 +70,10 @@ channel keys found, if any. ** The `server-auth-key' variable can be used to set a permanent shared key for Emacs Server. - + +** In Perl mode, new option `perl-indent-parens-as-block' causes non-block +closing brackets to be aligned with the line of the opening bracket. + ** Obsolete packages: *** mailpost.el diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4a9aee338ae..90f48d2ab1e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-04-17 Peter Oliver (tiny change) + + * progmodes/perl-mode.el (perl-indent-parens-as-block): + New option (bug#11118). + (perl-calculate-indent): Respect it. + 2012-04-17 Glenn Morris * dired-aux.el (dired-mark-read-string): Doc fix. diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index cfca438a44b..9df9943cc00 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -506,6 +506,14 @@ If nil, continued arguments are aligned with the first argument." :type '(choice integer (const nil)) :group 'perl) +(defcustom perl-indent-parens-as-block nil + "Non-nil means that non-block ()-, {}- and []-groups are indented as blocks. +The closing bracket is aligned with the line of the opening bracket, +not the contents of the brackets." + :version "24.2" + :type 'boolean + :group 'perl) + (defcustom perl-tab-always-indent tab-always-indent "Non-nil means TAB in Perl mode always indents the current line. Otherwise it inserts a tab character if you type it past the first @@ -848,7 +856,8 @@ Optional argument PARSE-START should be the position of `beginning-of-defun'." (cond ((nth 3 state) 'noindent) ; In a quoted string? ((null containing-sexp) ; Line is at top level. (skip-chars-forward " \t\f") - (if (= (following-char) ?{) + (if (memq (following-char) + (if perl-indent-parens-as-block '(?\{ ?\( ?\[) '(?\{))) 0 ; move to beginning of line if it starts a function body ;; indent a little if this is a continuation line (perl-backward-to-noncomment) @@ -892,7 +901,9 @@ Optional argument PARSE-START should be the position of `beginning-of-defun'." 0 perl-continued-statement-offset) (current-column) (if (save-excursion (goto-char indent-point) - (looking-at "[ \t]*{")) + (looking-at + (if perl-indent-parens-as-block + "[ \t]*[{(\[]" "[ \t]*{"))) perl-continued-brace-offset 0))) ;; This line starts a new statement. ;; Position at last unclosed open. From 25a9a140faefdf1756b9bff1e879311f61b0de77 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 16 Apr 2012 20:08:05 -0700 Subject: [PATCH 33/36] NEWS placeholder --- etc/NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 5c2bb83e2a3..0d8c145b362 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -74,6 +74,8 @@ shared key for Emacs Server. ** In Perl mode, new option `perl-indent-parens-as-block' causes non-block closing brackets to be aligned with the line of the opening bracket. +** FIXME something happened to ses.el, 2012-04-17. + ** Obsolete packages: *** mailpost.el From d1721cc7c2647140e51713cbba28437046008551 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 17 Apr 2012 06:17:40 -0400 Subject: [PATCH 34/36] Auto-commit of generated files. --- autogen/config.in | 12 ++++++++++++ autogen/configure | 22 +++++----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/autogen/config.in b/autogen/config.in index e93bd7f325c..c64b048ade5 100644 --- a/autogen/config.in +++ b/autogen/config.in @@ -203,6 +203,12 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the 'dup2' function. */ #undef HAVE_DUP2 +/* Define to 1 if you have the `endgrent' function. */ +#undef HAVE_ENDGRENT + +/* Define to 1 if you have the `endpwent' function. */ +#undef HAVE_ENDPWENT + /* Define to 1 if you have the `euidaccess' function. */ #undef HAVE_EUIDACCESS @@ -254,6 +260,9 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the `getdomainname' function. */ #undef HAVE_GETDOMAINNAME +/* Define to 1 if you have the `getgrent' function. */ +#undef HAVE_GETGRENT + /* Define to 1 if you have the `gethostname' function. */ #undef HAVE_GETHOSTNAME @@ -278,6 +287,9 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the `getpt' function. */ #undef HAVE_GETPT +/* Define to 1 if you have the `getpwent' function. */ +#undef HAVE_GETPWENT + /* Define to 1 if you have the `getrlimit' function. */ #undef HAVE_GETRLIMIT diff --git a/autogen/configure b/autogen/configure index de24a151fca..dd889483229 100755 --- a/autogen/configure +++ b/autogen/configure @@ -9656,15 +9656,6 @@ else window_system=x11 fi -## Workaround for bug in autoconf <= 2.62. -## http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01551.html -## No need to do anything special for these standard directories. -if test -n "${x_libraries}" && test x"${x_libraries}" != xNONE; then - - x_libraries=`echo :${x_libraries}: | sed -e 's|:/usr/lib64:|:|g' -e 's|:/lib64:|:|g' -e 's|^:||' -e 's|:$||'` - -fi - LD_SWITCH_X_SITE_AUX= LD_SWITCH_X_SITE_AUX_RPATH= if test "${x_libraries}" != NONE; then @@ -9803,7 +9794,6 @@ else fi - NS_HAVE_NSINTEGER=yes cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -9821,8 +9811,10 @@ else ns_have_nsinteger=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ns_have_nsinteger = no; then - NS_HAVE_NSINTEGER=no + if test $ns_have_nsinteger = yes; then + +$as_echo "#define NS_HAVE_NSINTEGER 1" >>confdefs.h + fi fi @@ -13434,11 +13426,6 @@ $as_echo "#define NS_IMPL_GNUSTEP 1" >>confdefs.h ## Extra CFLAGS applied to src/*.m files. GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGSWARN -DGSDIAGNOSE" fi - if test "${NS_HAVE_NSINTEGER}" = "yes"; then - -$as_echo "#define NS_HAVE_NSINTEGER 1" >>confdefs.h - - fi # We also have mouse menus. HAVE_MENUS=yes OTHER_FILES=ns-app @@ -13967,6 +13954,7 @@ __fpending mblen mbrlen mbsinit strsignal setitimer ualarm \ sendto recvfrom getsockopt setsockopt getsockname getpeername \ gai_strerror mkstemp getline getdelim mremap fsync sync \ difftime mempcpy mblen mbrlen posix_memalign \ +getpwent endpwent getgrent endgrent \ cfmakeraw cfsetspeed copysign __executable_start do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` From d96a4f88299679f64c49f44d94fd61d0548b351e Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 17 Apr 2012 06:21:15 -0400 Subject: [PATCH 35/36] Auto-commit of loaddefs files. --- lisp/dired.el | 2 +- lisp/emacs-lisp/cl-loaddefs.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/dired.el b/lisp/dired.el index d322752e15f..77fe9cb7614 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3736,7 +3736,7 @@ Ask means pop up a menu for the user to select one of copy, move or link." ;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command ;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown ;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff -;;;;;; dired-diff) "dired-aux" "dired-aux.el" "58d623eb8e68e472e6164a1bcae83360") +;;;;;; dired-diff) "dired-aux" "dired-aux.el" "de7e4c64718c8ba8438a6397a460bf23") ;;; Generated autoloads from dired-aux.el (autoload 'dired-diff "dired-aux" "\ diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el index 5bb86628bb8..9e0099bb649 100644 --- a/lisp/emacs-lisp/cl-loaddefs.el +++ b/lisp/emacs-lisp/cl-loaddefs.el @@ -10,7 +10,7 @@ ;;;;;; ceiling* floor* isqrt lcm gcd cl-progv-before cl-set-frame-visible-p ;;;;;; cl-map-overlays cl-map-intervals cl-map-keymap-recursively ;;;;;; notevery notany every some mapcon mapcan mapl maplist map -;;;;;; cl-mapcar-many equalp coerce) "cl-extra" "cl-extra.el" "c172dda6770ce18b556561481bfefbb2") +;;;;;; cl-mapcar-many equalp coerce) "cl-extra" "cl-extra.el" "5a8a7f7ec2dc453113b8cbda577f2acb") ;;; Generated autoloads from cl-extra.el (autoload 'coerce "cl-extra" "\ From 197b6f3c605872bfeb7b2024d255142d8f579021 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Tue, 17 Apr 2012 19:05:22 +0200 Subject: [PATCH 36/36] lisp/server.el (server-ensure-safe-dir): Simplify. --- lisp/ChangeLog | 4 ++++ lisp/server.el | 42 +++++++++++++++++++----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 992fee42c28..d9aadbe0f22 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2012-04-17 Juanma Barranquero + + * server.el (server-ensure-safe-dir): Simplify. + 2012-04-17 Stefan Monnier * emacs-lisp/smie.el: Provide smarter auto-filling. diff --git a/lisp/server.el b/lisp/server.el index 058bc55d87d..c82a639eadf 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -520,31 +520,27 @@ Creates the directory if necessary and makes sure: ;; Check that it's safe for use. (let* ((uid (nth 2 attrs)) (w32 (eq system-type 'windows-nt)) - (safe (catch :safe - (unless (eq t (car attrs)) ; is a dir? - (throw :safe nil)) - (when (and w32 (zerop uid)) ; on FAT32? - (display-warning - 'server - (format "Using `%s' to store Emacs-server authentication files. + (safe (cond + ((not (eq t (car attrs))) nil) ; is a dir? + ((and w32 (zerop uid)) ; on FAT32? + (display-warning + 'server + (format "Using `%s' to store Emacs-server authentication files. Directories on FAT32 filesystems are NOT secure against tampering. See variable `server-auth-dir' for details." - (file-name-as-directory dir)) - :warning) - (throw :safe t)) - (unless (or (= uid (user-uid)) ; is the dir ours? - (and w32 - ;; Files created on Windows by - ;; Administrator (RID=500) have - ;; the Administrators (RID=544) - ;; group recorded as the owner. - (= uid 544) (= (user-uid) 500))) - (throw :safe nil)) - (when w32 ; on NTFS? - (throw :safe t)) - (unless (zerop (logand ?\077 (file-modes dir))) - (throw :safe nil)) - t))) + (file-name-as-directory dir)) + :warning) + t) + ((and (/= uid (user-uid)) ; is the dir ours? + (or (not w32) + ;; Files created on Windows by Administrator + ;; (RID=500) have the Administrators (RID=544) + ;; group recorded as the owner. + (/= uid 544) (/= (user-uid) 500))) + nil) + (w32 t) ; on NTFS? + (t ; else, check permissions + (zerop (logand ?\077 (file-modes dir))))))) (unless safe (error "The directory `%s' is unsafe" dir)))))