[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ELPA-diffs] /srv/bzr/emacs/elpa r394: * csv-mode.el (csv-kill-one-field
From: |
Stefan Monnier |
Subject: |
[ELPA-diffs] /srv/bzr/emacs/elpa r394: * csv-mode.el (csv-kill-one-field): Check for presence before deleting trailing |
Date: |
Wed, 24 Apr 2013 15:28:41 -0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 394
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14122
committer: Stefan Monnier <address@hidden>
branch nick: elpa
timestamp: Wed 2013-04-24 15:28:41 -0400
message:
* csv-mode.el (csv-kill-one-field): Check for presence before deleting
trailing
separator. Remove last arg and turn into a function.
(csv-kill-one-column, csv-kill-many-columns): Adjust callers.
modified:
packages/csv-mode/csv-mode.el
=== modified file 'packages/csv-mode/csv-mode.el'
--- a/packages/csv-mode/csv-mode.el 2012-10-22 21:58:24 +0000
+++ b/packages/csv-mode/csv-mode.el 2013-04-24 19:28:41 +0000
@@ -1,11 +1,11 @@
;;; csv-mode.el --- Major mode for editing comma/char separated values -*-
lexical-binding: t -*-
-;; Copyright (C) 2003, 2004, 2012 Free Software Foundation, Inc
+;; Copyright (C) 2003, 2004, 2012, 2013 Free Software Foundation, Inc
;; Author: Francis J. Wright <F.J.Wright at qmul.ac.uk>
;; Time-stamp: <23 August 2004>
;; URL: http://centaur.maths.qmul.ac.uk/Emacs/
-;; Version: 1.1
+;; Version: 1.2
;; Keywords: convenience
;; This package is free software; you can redistribute it and/or modify
@@ -844,21 +844,18 @@
(csv-kill-one-column (car fields)))))
(setq csv-killed-fields (nreverse csv-killed-fields)))
-(defmacro csv-kill-one-field (field killed-fields)
+(defun csv-kill-one-field (field)
"Kill field with index FIELD in current line.
-Save killed field by `push'ing onto KILLED-FIELDS.
-Assumes point is at beginning of line.
-Called by `csv-kill-one-column' and `csv-kill-many-columns'."
- `(progn
- ;; Move to start of field to kill:
- (csv-sort-skip-fields ,field)
- ;; Kill to end of field (cf. `kill-region'):
- (push (delete-and-extract-region
- (point)
- (progn (csv-end-of-field) (point)))
- ,killed-fields)
- (if (eolp) (delete-char -1) ; delete trailing separator at eol
- (delete-char 1)))) ; or following separator otherwise
+Return killed text. Assumes point is at beginning of line."
+ ;; Move to start of field to kill:
+ (csv-sort-skip-fields field)
+ ;; Kill to end of field (cf. `kill-region'):
+ (prog1 (delete-and-extract-region
+ (point)
+ (progn (csv-end-of-field) (point)))
+ (if (eolp)
+ (unless (bolp) (delete-char -1)) ; Delete trailing separator at eol
+ (delete-char 1)))) ; or following separator otherwise.
(defun csv-kill-one-column (field)
"Kill field with index FIELD in all lines in (narrowed) buffer.
@@ -867,7 +864,7 @@
Ignore blank and comment lines."
(while (not (eobp))
(or (csv-not-looking-at-record)
- (csv-kill-one-field field csv-killed-fields))
+ (push (csv-kill-one-field field) csv-killed-fields))
(forward-line)))
(defun csv-kill-many-columns (fields)
@@ -912,7 +909,7 @@
(setq field (car fields)
fields (cdr fields))
(beginning-of-line)
- (csv-kill-one-field field killed-fields))
+ (push (csv-kill-one-field field) killed-fields))
(push (mapconcat 'identity killed-fields (car csv-separators))
csv-killed-fields)))
(forward-line)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [ELPA-diffs] /srv/bzr/emacs/elpa r394: * csv-mode.el (csv-kill-one-field): Check for presence before deleting trailing,
Stefan Monnier <=