From mboxrd@z Thu Jan 1 00:00:00 1970 From: netty hacky Subject: Re: % (org-agenda-bulk-mark-regexp) in agenda view problems Date: Sat, 1 Oct 2011 15:14:56 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf307ca2be68758204ae4412ee Return-path: Received: from eggs.gnu.org ([140.186.70.92]:59361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RA7pi-0001aJ-Vu for emacs-orgmode@gnu.org; Sat, 01 Oct 2011 18:15:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RA7ph-0000Cv-KT for emacs-orgmode@gnu.org; Sat, 01 Oct 2011 18:14:58 -0400 Received: from mail-vx0-f169.google.com ([209.85.220.169]:47053) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RA7ph-0000Cp-BL for emacs-orgmode@gnu.org; Sat, 01 Oct 2011 18:14:57 -0400 Received: by vcbfo14 with SMTP id fo14so2571206vcb.0 for ; Sat, 01 Oct 2011 15:14:56 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Guerry Cc: emacs-orgmode@gnu.org --20cf307ca2be68758204ae4412ee Content-Type: text/plain; charset=ISO-8859-1 Hi Bastien, I found a third problem of org-agenda-bulk-mark-regexp, it does not work well on daily/weekly agenda view. Basically it chokes on lines that is not a regular headline, like date labels, dairy entries and grid lines. So to show I am not merely a leech on this list, I come up with my version here, most of the ugly code are to deal with the way org-agenda-bulk-mark works now (e.g., returning nil when successful): (defun org-agenda-bulk-mark-regexp (regexp) "Mark entries match REGEXP." (interactive "sMark entries matching regexp: ") (save-excursion (goto-char (point-min)) (let ((entries-marked 0)) (while (not (eobp)) (unless (and (not (get-char-property (point) 'invisible)) (not (org-get-at-bol 'org-agenda-diary-link)) (org-get-at-bol 'org-hd-marker) (let (txt-property) (setq txt-property (get-char-property (point) 'txt)) (string-match regexp txt-property)) (not (call-interactively 'org-agenda-bulk-mark)) (setq entries-marked (+ entries-marked 1))) (beginning-of-line 2))) (if (zerop entries-marked) (message "No entry matching this regexp.") (message "%d entries marked for bulk action" entries-marked))))) Thanks, Net On Sat, Oct 1, 2011 at 12:38 AM, netty hacky wrote: > Hi Bastien, > > I'm having two problems with the % command (org-agenda-bulk-mark-regexp) in > Org-mode agenda view. > > 1. If I use "." as the search string, I get "Wrong type argument: > number-or-marker-p, nil". And my workaround is to change the line "(let > (entries-marked)" in org-agenda.el to "(let ((entries-marked 0))". > > 2. If I use ".*" as the search string, I get "Wrong type argument: stringp, > nil". After some edebugging, I found the reason is that in > org-agenda-bulk-mark-regexp, re-search-forward moved the point to the end of > the line (since ".*" matches the whole line), causing (get-text-property > (point) 'txt) to return nil, in turn caused string-match to throw the > error. I think this may happen to other regexps, as long as the strings > matched include the last character in the line. I'm new to Emacs Lisp so > I'm not sure how to fix this one. > > Wondering why it seems only me having these two problems. > > I am using MacPorts' Emacs and Org-mode: > Emacs : GNU Emacs 23.3.1 (x86_64-apple-darwin10.8.0) > Package: Org-mode version 7.7 > > Thanks, > Net > > --20cf307ca2be68758204ae4412ee Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: base64 SGkgQmFzdGllbiw8YnI+PGJyPkkgZm91bmQgYSB0aGlyZCBwcm9ibGVtIG9mIG9yZy1hZ2VuZGEt YnVsay1tYXJrLXJlZ2V4cCwgaXQgZG9lcyBub3Qgd29yayB3ZWxsIG9uIGRhaWx5L3dlZWtseSBh Z2VuZGEgdmlldy6gIEJhc2ljYWxseSBpdCBjaG9rZXMgb24gbGluZXMgdGhhdCBpcyBub3QgYSBy ZWd1bGFyIGhlYWRsaW5lLCBsaWtlIGRhdGUgbGFiZWxzLCBkYWlyeSBlbnRyaWVzIGFuZC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