* [PATCH 1/5] Hide drawers after displaying an entry using org-clock-goto.
2008-03-16 16:27 [PATCH 0/5] Various patches James TD Smith
@ 2008-03-16 16:28 ` James TD Smith
2008-03-16 16:29 ` [PATCH 2/5] Add a way to set a user-defined function to generate descriptions for links James TD Smith
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: James TD Smith @ 2008-03-16 16:28 UTC (permalink / raw)
To: emacs-orgmode
From: James TD Smith <ahktenzero@usa.net>
---
org.el | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/org.el b/org.el
index 4fe79d7..8fe8edd 100644
--- a/org.el
+++ b/org.el
@@ -18715,6 +18715,7 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
(goto-char org-clock-marker)
(org-show-entry)
(org-back-to-heading)
+ (org-cycle-hide-drawers 'children)
(recenter))
(defvar org-clock-file-total-minutes nil
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/5] Add a way to set a user-defined function to generate descriptions for links.
2008-03-16 16:27 [PATCH 0/5] Various patches James TD Smith
2008-03-16 16:28 ` [PATCH 1/5] Hide drawers after displaying an entry using org-clock-goto James TD Smith
@ 2008-03-16 16:29 ` James TD Smith
2008-04-09 15:15 ` Carsten Dominik
2008-03-16 16:29 ` [PATCH 3/5] Some improvements to org-table-export James TD Smith
` (3 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: James TD Smith @ 2008-03-16 16:29 UTC (permalink / raw)
To: emacs-orgmode
From: James TD Smith <ahktenzero@usa.net>
Below is an example which uses w3m to retrieve the titles of web pages to use as
link descriptions.
(require 'w3m)
(defun make-link-description (link desc)
"Link description generator for orgmode"
(cond ((string-match "https?:" link)
(with-temp-buffer
(w3m-retrieve link)
(goto-char (point-min))
(if (search-forward-regexp "<title>\\([^<]*\\)</title>" (point-max) t)
(url-unhex-string (match-string 1)))))
(t (or desc link))))
(setq org-make-link-description 'make-link-description)
---
org.el | 37 +++++++++++++++++++++++++++----------
1 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/org.el b/org.el
index 8fe8edd..021bd59 100644
--- a/org.el
+++ b/org.el
@@ -1209,6 +1209,15 @@ Changing this variable requires a restart of Emacs to become effective."
(const :tag "Tags" tag)
(const :tag "Timestamps" date)))
+(defcustom org-make-link-description nil
+ "Function to use to generate link descriptions from links. If
+nil the link location will be used. This function must take two
+parameters; the first is the link and the second the description
+org-insert-link has generated, and should return the description
+to use."
+ :group 'org-link
+ :type 'function)
+
(defgroup org-link-store nil
"Options concerning storing links in Org-mode"
:tag "Org Store Link"
@@ -12475,16 +12484,21 @@ be displayed in the buffer instead of the link.
If there is already a link at point, this command will allow you to edit link
and description parts.
-With a \\[universal-argument] prefix, prompts for a file to link to. The file name can be
-selected using completion. The path to the file will be relative to
-the current directory if the file is in the current directory or a
-subdirectory. Otherwise, the link will be the absolute path as
-completed in the minibuffer (i.e. normally ~/path/to/file).
-
-With two \\[universal-argument] prefixes, enforce an absolute path even if the file
-is in the current directory or below.
-With three \\[universal-argument] prefixes, negate the meaning of
-`org-keep-stored-link-after-insertion'."
+With a \\[universal-argument] prefix, prompts for a file to link
+to. The file name can be selected using completion. The path to
+the file will be relative to the current directory if the file is
+in the current directory or a subdirectory. Otherwise, the link
+will be the absolute path as completed in the minibuffer (i.e.
+normally ~/path/to/file).
+
+With two \\[universal-argument] prefixes, enforce an absolute
+path even if the file is in the current directory or below. With
+three \\[universal-argument] prefixes, negate the meaning of
+`org-keep-stored-link-after-insertion'.
+
+If `org-make-link-description' is non-nil, this function will be
+called with the link target, and the result will be the default
+link description."
(interactive "P")
(let* ((wcf (current-window-configuration))
(region (if (org-region-active-p)
@@ -12605,6 +12619,9 @@ With three \\[universal-argument] prefixes, negate the meaning of
(if (equal desc origpath)
(setq desc path))))
+ (if org-make-link-description
+ (setq desc (funcall org-make-link-description link desc)))
+
(setq desc (read-string "Description: " desc))
(unless (string-match "\\S-" desc) (setq desc nil))
(if remove (apply 'delete-region remove))
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/5] Add a way to set a user-defined function to generate descriptions for links.
2008-03-16 16:29 ` [PATCH 2/5] Add a way to set a user-defined function to generate descriptions for links James TD Smith
@ 2008-04-09 15:15 ` Carsten Dominik
0 siblings, 0 replies; 12+ messages in thread
From: Carsten Dominik @ 2008-04-09 15:15 UTC (permalink / raw)
To: James TD Smith; +Cc: emacs-orgmode
Applied, but with renaming org-make-link-description to org-make-link-
description-function.
Thanks.
- Carsten
On Mar 16, 2008, at 5:29 PM, James TD Smith wrote:
> From: James TD Smith <ahktenzero@usa.net>
>
> Below is an example which uses w3m to retrieve the titles of web
> pages to use as
> link descriptions.
>
> (require 'w3m)
>
> (defun make-link-description (link desc)
> "Link description generator for orgmode"
> (cond ((string-match "https?:" link)
> (with-temp-buffer
> (w3m-retrieve link)
> (goto-char (point-min))
> (if (search-forward-regexp "<title>\\([^<]*\\)</title>" (point-
> max) t)
> (url-unhex-string (match-string 1)))))
> (t (or desc link))))
>
> (setq org-make-link-description 'make-link-description)
>
> ---
>
> org.el | 37 +++++++++++++++++++++++++++----------
> 1 files changed, 27 insertions(+), 10 deletions(-)
>
>
> diff --git a/org.el b/org.el
> index 8fe8edd..021bd59 100644
> --- a/org.el
> +++ b/org.el
> @@ -1209,6 +1209,15 @@ Changing this variable requires a restart of
> Emacs to become effective."
> (const :tag "Tags" tag)
> (const :tag "Timestamps" date)))
>
> +(defcustom org-make-link-description nil
> + "Function to use to generate link descriptions from links. If
> +nil the link location will be used. This function must take two
> +parameters; the first is the link and the second the description
> +org-insert-link has generated, and should return the description
> +to use."
> + :group 'org-link
> + :type 'function)
> +
> (defgroup org-link-store nil
> "Options concerning storing links in Org-mode"
> :tag "Org Store Link"
> @@ -12475,16 +12484,21 @@ be displayed in the buffer instead of the
> link.
> If there is already a link at point, this command will allow you to
> edit link
> and description parts.
>
> -With a \\[universal-argument] prefix, prompts for a file to link
> to. The file name can be
> -selected using completion. The path to the file will be relative to
> -the current directory if the file is in the current directory or a
> -subdirectory. Otherwise, the link will be the absolute path as
> -completed in the minibuffer (i.e. normally ~/path/to/file).
> -
> -With two \\[universal-argument] prefixes, enforce an absolute path
> even if the file
> -is in the current directory or below.
> -With three \\[universal-argument] prefixes, negate the meaning of
> -`org-keep-stored-link-after-insertion'."
> +With a \\[universal-argument] prefix, prompts for a file to link
> +to. The file name can be selected using completion. The path to
> +the file will be relative to the current directory if the file is
> +in the current directory or a subdirectory. Otherwise, the link
> +will be the absolute path as completed in the minibuffer (i.e.
> +normally ~/path/to/file).
> +
> +With two \\[universal-argument] prefixes, enforce an absolute
> +path even if the file is in the current directory or below. With
> +three \\[universal-argument] prefixes, negate the meaning of
> +`org-keep-stored-link-after-insertion'.
> +
> +If `org-make-link-description' is non-nil, this function will be
> +called with the link target, and the result will be the default
> +link description."
> (interactive "P")
> (let* ((wcf (current-window-configuration))
> (region (if (org-region-active-p)
> @@ -12605,6 +12619,9 @@ With three \\[universal-argument] prefixes,
> negate the meaning of
> (if (equal desc origpath)
> (setq desc path))))
>
> + (if org-make-link-description
> + (setq desc (funcall org-make-link-description link desc)))
> +
> (setq desc (read-string "Description: " desc))
> (unless (string-match "\\S-" desc) (setq desc nil))
> (if remove (apply 'delete-region remove))
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/5] Some improvements to org-table-export
2008-03-16 16:27 [PATCH 0/5] Various patches James TD Smith
2008-03-16 16:28 ` [PATCH 1/5] Hide drawers after displaying an entry using org-clock-goto James TD Smith
2008-03-16 16:29 ` [PATCH 2/5] Add a way to set a user-defined function to generate descriptions for links James TD Smith
@ 2008-03-16 16:29 ` James TD Smith
2008-04-09 15:59 ` Carsten Dominik
2008-03-16 16:30 ` [PATCH 4/5] Add a new sort option, which sorts items by todo keyword James TD Smith, James TD Smith
` (2 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: James TD Smith @ 2008-03-16 16:29 UTC (permalink / raw)
To: emacs-orgmode
From: James TD Smith <ahktenzero@usa.net>
Specify the file to export to as parameter or property
Use the export mechanisms from orgtbl instead of the simple export.
Specify the table output format in property.
---
org.el | 91 +++++++++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 64 insertions(+), 27 deletions(-)
diff --git a/org.el b/org.el
index 021bd59..dee8471 100644
--- a/org.el
+++ b/org.el
@@ -965,6 +965,13 @@ table, obtained by prompting the user."
(list (symbol :tag "Major mode")
(string :tag "Format"))))
+(defcustom org-table-export-default "orgtbl-to-generic :splice t :sep \"\t\""
+ "Default export parameters for org-table-export. These can be
+ overridden on for a specific table by setting the
+ TABLE_EXPORT_FORMAT parameter. See orgtbl-export for the
+ different export transforms and available parameters."
+ :group 'org-table)
+
(defgroup org-table-settings nil
"Settings for tables in Org-mode."
:tag "Org Table Settings"
@@ -975,6 +982,7 @@ table, obtained by prompting the user."
:group 'org-table-settings
:type 'string)
+
(defcustom org-table-number-regexp
"^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\|nan\\)$"
"Regular expression for recognizing numbers in table columns.
@@ -8568,41 +8576,70 @@ are found, lines will be split on whitespace into fields."
(insert-file-contents file)
(org-table-convert-region beg (+ (point) (- (point-max) pm)) arg)))
-(defun org-table-export ()
+(defun org-table-export (&optional target)
"Export table as a tab-separated file.
-Such a file can be imported into a spreadsheet program like Excel."
+Such a file can be imported into a spreadsheet program like
+Excel. If TARGET is set, the table is exported to that file. If
+the property TABLE_EXPORT_FILE is set on the entry the table is
+in, the table will be exported to that file. Otherwise the user
+is prompted for a file to write the table to.
+
+If the TABLE_EXPORT_FORMAT property is set, the contents of this
+property will control export format in the same way as radio
+tables in OrgTbl mode.
+"
(interactive)
(let* ((beg (org-table-begin))
(end (org-table-end))
- (table (buffer-substring beg end))
- (file (read-file-name "Export table to: "))
+ (txt (buffer-substring-no-properties beg end))
+ (file (or target (org-entry-get beg "TABLE_EXPORT_FILE")
+ (read-file-name "Export table to: ")))
+ (format (or (org-entry-get beg "TABLE_EXPORT_FORMAT")
+ org-table-export-default))
buf)
(unless (or (not (file-exists-p file))
(y-or-n-p (format "Overwrite file %s? " file)))
(error "Abort"))
- (with-current-buffer (find-file-noselect file)
- (setq buf (current-buffer))
- (erase-buffer)
- (fundamental-mode)
- (insert table)
- (goto-char (point-min))
- (while (re-search-forward "^[ \t]*|[ \t]*" nil t)
- (replace-match "" t t)
- (end-of-line 1))
- (goto-char (point-min))
- (while (re-search-forward "[ \t]*|[ \t]*$" nil t)
- (replace-match "" t t)
- (goto-char (min (1+ (point)) (point-max))))
- (goto-char (point-min))
- (while (re-search-forward "^-[-+]*$" nil t)
- (replace-match "")
- (if (looking-at "\n")
- (delete-char 1)))
- (goto-char (point-min))
- (while (re-search-forward "[ \t]*|[ \t]*" nil t)
- (replace-match "\t" t t))
- (save-buffer))
- (kill-buffer buf)))
+ (message format)
+
+ (if (string-match "\\([^ \t\r\n]+\\)\\( +.*\\)?" format)
+ (let* ((transform (intern (match-string 1 format)))
+ (params (if (match-end 2)
+ (read (concat "(" (match-string 2 format) ")"))))
+ (skip (plist-get params :skip))
+ (skipcols (plist-get params :skipcols))
+ (lines (nthcdr (or skip 0) (org-split-string txt "[ \t]*\n[ \t]*")))
+ (lines (org-table-clean-before-export lines))
+ (i0 (if org-table-clean-did-remove-column 2 1))
+ (table (mapcar
+ (lambda (x)
+ (if (string-match org-table-hline-regexp x)
+ 'hline
+ (org-remove-by-index
+ (org-split-string (org-trim x) "\\s-*|\\s-*")
+ skipcols i0)))
+ lines))
+ (fun (if (= i0 2) 'cdr 'identity))
+ (org-table-last-alignment
+ (org-remove-by-index (funcall fun org-table-last-alignment)
+ skipcols i0))
+ (org-table-last-column-widths
+ (org-remove-by-index (funcall fun org-table-last-column-widths)
+ skipcols i0)))
+
+ (unless (fboundp transform)
+ (error "No such transformation function %s" transform))
+ (setq txt (funcall transform table params))
+
+ (with-current-buffer (find-file-noselect file)
+ (setq buf (current-buffer))
+ (erase-buffer)
+ (fundamental-mode)
+ (insert txt "\n")
+ (save-buffer))
+ (kill-buffer buf)
+ (message "Export done."))
+ (error "TABLE_EXPORT_FORMAT invalid"))))
(defvar org-table-aligned-begin-marker (make-marker)
"Marker at the beginning of the table last aligned.
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5] Some improvements to org-table-export
2008-03-16 16:29 ` [PATCH 3/5] Some improvements to org-table-export James TD Smith
@ 2008-04-09 15:59 ` Carsten Dominik
0 siblings, 0 replies; 12+ messages in thread
From: Carsten Dominik @ 2008-04-09 15:59 UTC (permalink / raw)
To: James TD Smith; +Cc: emacs-orgmode
Also this is a fine addition, thank you very much.
- Carsten
On Mar 16, 2008, at 5:29 PM, James TD Smith wrote:
> From: James TD Smith <ahktenzero@usa.net>
>
> Specify the file to export to as parameter or property
> Use the export mechanisms from orgtbl instead of the simple export.
> Specify the table output format in property.
>
> ---
>
> org.el | 91 ++++++++++++++++++++++++++++++++++++++++++++
> +-------------------
> 1 files changed, 64 insertions(+), 27 deletions(-)
>
>
> diff --git a/org.el b/org.el
> index 021bd59..dee8471 100644
> --- a/org.el
> +++ b/org.el
> @@ -965,6 +965,13 @@ table, obtained by prompting the user."
> (list (symbol :tag "Major mode")
> (string :tag "Format"))))
>
> +(defcustom org-table-export-default "orgtbl-to-generic :splice
> t :sep \"\t\""
> + "Default export parameters for org-table-export. These can be
> + overridden on for a specific table by setting the
> + TABLE_EXPORT_FORMAT parameter. See orgtbl-export for the
> + different export transforms and available parameters."
> + :group 'org-table)
> +
> (defgroup org-table-settings nil
> "Settings for tables in Org-mode."
> :tag "Org Table Settings"
> @@ -975,6 +982,7 @@ table, obtained by prompting the user."
> :group 'org-table-settings
> :type 'string)
>
> +
> (defcustom org-table-number-regexp
> "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|\\(0[xX]\\)[0-9a-fA-
> F]+\\|nan\\)$"
> "Regular expression for recognizing numbers in table columns.
> @@ -8568,41 +8576,70 @@ are found, lines will be split on whitespace
> into fields."
> (insert-file-contents file)
> (org-table-convert-region beg (+ (point) (- (point-max) pm))
> arg)))
>
> -(defun org-table-export ()
> +(defun org-table-export (&optional target)
> "Export table as a tab-separated file.
> -Such a file can be imported into a spreadsheet program like Excel."
> +Such a file can be imported into a spreadsheet program like
> +Excel. If TARGET is set, the table is exported to that file. If
> +the property TABLE_EXPORT_FILE is set on the entry the table is
> +in, the table will be exported to that file. Otherwise the user
> +is prompted for a file to write the table to.
> +
> +If the TABLE_EXPORT_FORMAT property is set, the contents of this
> +property will control export format in the same way as radio
> +tables in OrgTbl mode.
> +"
> (interactive)
> (let* ((beg (org-table-begin))
> (end (org-table-end))
> - (table (buffer-substring beg end))
> - (file (read-file-name "Export table to: "))
> + (txt (buffer-substring-no-properties beg end))
> + (file (or target (org-entry-get beg "TABLE_EXPORT_FILE")
> + (read-file-name "Export table to: ")))
> + (format (or (org-entry-get beg "TABLE_EXPORT_FORMAT")
> + org-table-export-default))
> buf)
> (unless (or (not (file-exists-p file))
> (y-or-n-p (format "Overwrite file %s? " file)))
> (error "Abort"))
> - (with-current-buffer (find-file-noselect file)
> - (setq buf (current-buffer))
> - (erase-buffer)
> - (fundamental-mode)
> - (insert table)
> - (goto-char (point-min))
> - (while (re-search-forward "^[ \t]*|[ \t]*" nil t)
> - (replace-match "" t t)
> - (end-of-line 1))
> - (goto-char (point-min))
> - (while (re-search-forward "[ \t]*|[ \t]*$" nil t)
> - (replace-match "" t t)
> - (goto-char (min (1+ (point)) (point-max))))
> - (goto-char (point-min))
> - (while (re-search-forward "^-[-+]*$" nil t)
> - (replace-match "")
> - (if (looking-at "\n")
> - (delete-char 1)))
> - (goto-char (point-min))
> - (while (re-search-forward "[ \t]*|[ \t]*" nil t)
> - (replace-match "\t" t t))
> - (save-buffer))
> - (kill-buffer buf)))
> + (message format)
> +
> + (if (string-match "\\([^ \t\r\n]+\\)\\( +.*\\)?" format)
> + (let* ((transform (intern (match-string 1 format)))
> + (params (if (match-end 2)
> + (read (concat "(" (match-string 2 format) ")"))))
> + (skip (plist-get params :skip))
> + (skipcols (plist-get params :skipcols))
> + (lines (nthcdr (or skip 0) (org-split-string txt "[ \t]*
> \n[ \t]*")))
> + (lines (org-table-clean-before-export lines))
> + (i0 (if org-table-clean-did-remove-column 2 1))
> + (table (mapcar
> + (lambda (x)
> + (if (string-match org-table-hline-regexp x)
> + 'hline
> + (org-remove-by-index
> + (org-split-string (org-trim x) "\\s-*|\\s-*")
> + skipcols i0)))
> + lines))
> + (fun (if (= i0 2) 'cdr 'identity))
> + (org-table-last-alignment
> + (org-remove-by-index (funcall fun org-table-last-alignment)
> + skipcols i0))
> + (org-table-last-column-widths
> + (org-remove-by-index (funcall fun org-table-last-column-widths)
> + skipcols i0)))
> +
> + (unless (fboundp transform)
> + (error "No such transformation function %s" transform))
> + (setq txt (funcall transform table params))
> +
> + (with-current-buffer (find-file-noselect file)
> + (setq buf (current-buffer))
> + (erase-buffer)
> + (fundamental-mode)
> + (insert txt "\n")
> + (save-buffer))
> + (kill-buffer buf)
> + (message "Export done."))
> + (error "TABLE_EXPORT_FORMAT invalid"))))
>
> (defvar org-table-aligned-begin-marker (make-marker)
> "Marker at the beginning of the table last aligned.
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/5] Add a new sort option, which sorts items by todo keyword
2008-03-16 16:27 [PATCH 0/5] Various patches James TD Smith
` (2 preceding siblings ...)
2008-03-16 16:29 ` [PATCH 3/5] Some improvements to org-table-export James TD Smith
@ 2008-03-16 16:30 ` James TD Smith, James TD Smith
2008-04-09 15:40 ` Carsten Dominik
2008-03-16 16:31 ` [PATCH 5/5] clipboard handling in remember templats James TD Smith
2008-03-16 18:29 ` [PATCH 4/5] Various patches James TD Smith
5 siblings, 1 reply; 12+ messages in thread
From: James TD Smith, James TD Smith @ 2008-03-16 16:30 UTC (permalink / raw)
To: emacs-orgmode
This is a somewhat simple implementation which just uses the position of the
keyword in org-todo-keywords-1, so if you have multiple sequences containing the
same todo keyword you may not get the ordering you expect.
---
org.el | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/org.el b/org.el
index dee8471..d67024f 100644
--- a/org.el
+++ b/org.el
@@ -982,7 +982,6 @@ table, obtained by prompting the user."
:group 'org-table-settings
:type 'string)
-
(defcustom org-table-number-regexp
"^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\|nan\\)$"
"Regular expression for recognizing numbers in table columns.
@@ -6993,7 +6992,7 @@ WITH-CASE, the sorting considers case as well."
(message
(if plain-list-p
"Sort %s: [a]lpha [n]umeric [t]ime [f]unc A/N/T/F means reversed:"
- "Sort %s: [a]lpha [n]umeric [t]ime [p]riority p[r]operty [f]unc A/N/T/P/F means reversed:")
+ "Sort %s: [a]lpha [n]umeric [t]ime [p]riority p[r]operty [f]unc keyword [o]rder A/N/T/P/F/O means reversed:")
what)
(setq sorting-type (read-char-exclusive))
@@ -7084,6 +7083,10 @@ WITH-CASE, the sorting considers case as well."
org-default-priority))
((= dcst ?r)
(or (org-entry-get nil property) ""))
+ ((= dcst ?o)
+ (if (looking-at org-complex-heading-regexp)
+ (or (position (match-string 2) org-todo-keywords-1 :test 'string=)
+ 9999)))
((= dcst ?f)
(if getkey-func
(progn
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 4/5] Add a new sort option, which sorts items by todo keyword
2008-03-16 16:30 ` [PATCH 4/5] Add a new sort option, which sorts items by todo keyword James TD Smith, James TD Smith
@ 2008-04-09 15:40 ` Carsten Dominik
0 siblings, 0 replies; 12+ messages in thread
From: Carsten Dominik @ 2008-04-09 15:40 UTC (permalink / raw)
To: James TD Smith; +Cc: emacs-orgmode
Cool. I like this on a lot. And I don't have a good idea how to fix
the problem
with equal keywords in different sequences.
Accepted, thanks.
- Carsten
On Mar 16, 2008, at 5:30 PM, James TD Smith wrote:
> This is a somewhat simple implementation which just uses the
> position of the
> keyword in org-todo-keywords-1, so if you have multiple sequences
> containing the
> same todo keyword you may not get the ordering you expect.
> ---
>
> org.el | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
>
> diff --git a/org.el b/org.el
> index dee8471..d67024f 100644
> --- a/org.el
> +++ b/org.el
> @@ -982,7 +982,6 @@ table, obtained by prompting the user."
> :group 'org-table-settings
> :type 'string)
>
> -
> (defcustom org-table-number-regexp
> "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|\\(0[xX]\\)[0-9a-fA-
> F]+\\|nan\\)$"
> "Regular expression for recognizing numbers in table columns.
> @@ -6993,7 +6992,7 @@ WITH-CASE, the sorting considers case as well."
> (message
> (if plain-list-p
> "Sort %s: [a]lpha [n]umeric [t]ime [f]unc A/N/T/F means
> reversed:"
> - "Sort %s: [a]lpha [n]umeric [t]ime [p]riority p[r]operty [f]unc
> A/N/T/P/F means reversed:")
> + "Sort %s: [a]lpha [n]umeric [t]ime [p]riority p[r]operty [f]unc
> keyword [o]rder A/N/T/P/F/O means reversed:")
> what)
> (setq sorting-type (read-char-exclusive))
>
> @@ -7084,6 +7083,10 @@ WITH-CASE, the sorting considers case as well."
> org-default-priority))
> ((= dcst ?r)
> (or (org-entry-get nil property) ""))
> + ((= dcst ?o)
> + (if (looking-at org-complex-heading-regexp)
> + (or (position (match-string 2) org-todo-keywords-1 :test
> 'string=)
> + 9999)))
> ((= dcst ?f)
> (if getkey-func
> (progn
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 5/5] clipboard handling in remember templats
2008-03-16 16:27 [PATCH 0/5] Various patches James TD Smith
` (3 preceding siblings ...)
2008-03-16 16:30 ` [PATCH 4/5] Add a new sort option, which sorts items by todo keyword James TD Smith, James TD Smith
@ 2008-03-16 16:31 ` James TD Smith
2008-04-09 15:32 ` Carsten Dominik
2008-03-16 18:29 ` [PATCH 4/5] Various patches James TD Smith
5 siblings, 1 reply; 12+ messages in thread
From: James TD Smith @ 2008-03-16 16:31 UTC (permalink / raw)
To: emacs-orgmode
From: James TD Smith <ahktenzero@usa.net>
Fix the X clipboard handling so it works properly, and so it works in XEmacs,and
add a new % expansion for adding links.
This patch reverts the %c expansion to its original function (head of kill
ring), and adds three new % expansions as follows:
%x - Contents of the X clipboard. This is the first non-empty value from the
PRIMARY, SECONDARY and CLIPBOARD X clipboards.
%^C - This allows the user to choose between any of the clipboard values
available, the kill ring head, and the initial region if set.
%^L - Like %^C, but this inserts an org link using the selected value.
---
org.el | 56 +++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 41 insertions(+), 15 deletions(-)
diff --git a/org.el b/org.el
index d67024f..0e5fa6a 100644
--- a/org.el
+++ b/org.el
@@ -12509,7 +12509,7 @@ This command can be called in any mode to insert a link in Org-mode syntax."
(org-load-modules-maybe)
(org-run-like-in-org-mode 'org-insert-link))
-(defun org-insert-link (&optional complete-file)
+(defun org-insert-link (&optional complete-file link-location)
"Insert a link. At the prompt, enter the link.
Completion can be used to select a link previously stored with
@@ -12538,7 +12538,10 @@ three \\[universal-argument] prefixes, negate the meaning of
If `org-make-link-description' is non-nil, this function will be
called with the link target, and the result will be the default
-link description."
+link description.
+
+If the `link-location' parameter is non-nil, this value will be
+used as the link location instead of reading one interactively"
(interactive "P")
(let* ((wcf (current-window-configuration))
(region (if (org-region-active-p)
@@ -12546,7 +12549,8 @@ link description."
(remove (and region (list (region-beginning) (region-end))))
(desc region)
tmphist ; byte-compile incorrectly complains about this
- link entry file)
+ (link link-location)
+ entry file)
(cond
((org-in-regexp org-bracket-link-regexp 1)
;; We do have a link at point, and we are going to edit it.
@@ -12579,7 +12583,7 @@ link description."
(setq link (org-make-link
"file:" (match-string 1 (expand-file-name file)))))
(t (setq link (org-make-link "file:" file))))))
- (t
+ ((not link)
;; Read link, with completion for stored links.
(with-output-to-temp-buffer "*Org Links*"
(princ "Insert a link. Use TAB to complete valid link prefixes.\n")
@@ -13399,8 +13403,12 @@ RET at beg-of-buf -> Append to file as level 2 headline
char0))))))
(cddr (assoc char templates)))))
-(defvar x-last-selected-text)
-(defvar x-last-selected-text-primary)
+(defun org-get-x-clipboard (value)
+ (if (eq window-system 'x)
+ (let ((x (if org-xemacs-p
+ (get-selection-no-error value)
+ (x-selection-value value))))
+ (and (> (length x) 0) (set-text-properties 0 (length x) nil x) x))))
;;;###autoload
(defun org-remember-apply-template (&optional use-char skip-interactive)
@@ -13416,12 +13424,10 @@ to be run from that hook to function properly."
(nth 1 entry)
org-default-notes-file))
(headline (nth 2 entry))
- (v-c (or (and (eq window-system 'x)
- (fboundp 'x-cut-buffer-or-selection-value)
- (x-cut-buffer-or-selection-value))
- (org-bound-and-true-p x-last-selected-text)
- (org-bound-and-true-p x-last-selected-text-primary)
- (and (> (length kill-ring) 0) (current-kill 0))))
+ (v-c (and (> (length kill-ring) 0) (current-kill 0)))
+ (v-x (or (org-get-x-clipboard 'PRIMARY)
+ (org-get-x-clipboard 'CLIPBOARD)
+ (org-get-x-clipboard 'SECONDARY)))
(v-t (format-time-string (car org-time-stamp-formats) (org-current-time)))
(v-T (format-time-string (cdr org-time-stamp-formats) (org-current-time)))
(v-u (concat "[" (substring v-t 1 -1) "]"))
@@ -13431,6 +13437,11 @@ to be run from that hook to function properly."
(v-a (if (and (boundp 'annotation) annotation)
(if (equal annotation "[[]]") "" annotation)
""))
+ (clipboards (remove nil (list v-i
+ (org-get-x-clipboard 'PRIMARY)
+ (org-get-x-clipboard 'CLIPBOARD)
+ (org-get-x-clipboard 'SECONDARY)
+ v-c)))
(v-A (if (and v-a
(string-match "\\[\\(\\[.*?\\]\\)\\(\\[.*?\\]\\)?\\]" v-a))
(replace-match "[\\1[%^{Link description}]]" nil nil v-a)
@@ -13459,7 +13470,7 @@ to be run from that hook to function properly."
(or (cdr org-remember-previous-location) "???"))))
(insert tpl) (goto-char (point-min))
;; Simple %-escapes
- (while (re-search-forward "%\\([tTuUaiAc]\\)" nil t)
+ (while (re-search-forward "%\\([tTuUaiAcx]\\)" nil t)
(when (and initial (equal (match-string 0) "%i"))
(save-match-data
(let* ((lead (buffer-substring
@@ -13513,7 +13524,7 @@ to be run from that hook to function properly."
(org-set-local 'org-remember-default-headline headline))
;; Interactive template entries
(goto-char (point-min))
- (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGuUtT]\\)?" nil t)
+ (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGuUtTCL]\\)?" nil t)
(setq char (if (match-end 3) (match-string 3))
prompt (if (match-end 2) (match-string 2)))
(goto-char (match-beginning 0))
@@ -13544,7 +13555,22 @@ to be run from that hook to function properly."
(or (equal (char-before) ?:) (insert ":"))
(insert ins)
(or (equal (char-after) ?:) (insert ":")))))
- (char
+ ((equal char "C")
+ (cond ((= (length clipboards) 1) (insert (car clipboards)))
+ ((> (length clipboards) 1)
+ (insert (read-string "Clipboard/kill value: "
+ (car clipboards) '(clipboards . 1)
+ (car clipboards))))))
+ ((equal char "L")
+ (cond ((= (length clipboards) 1)
+ (org-insert-link 0 (car clipboards)))
+ ((> (length clipboards) 1)
+ (org-insert-link 0 (read-string "Clipboard/kill value: "
+ (car clipboards)
+ '(clipboards . 1)
+ (car clipboards))))))
+
+ (char
(setq org-time-was-given (equal (upcase char) char))
(setq time (org-read-date (equal (upcase char) "U") t nil
prompt))
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 5/5] clipboard handling in remember templats
2008-03-16 16:31 ` [PATCH 5/5] clipboard handling in remember templats James TD Smith
@ 2008-04-09 15:32 ` Carsten Dominik
2008-04-09 17:35 ` James TD Smith
0 siblings, 1 reply; 12+ messages in thread
From: Carsten Dominik @ 2008-04-09 15:32 UTC (permalink / raw)
To: James TD Smith; +Cc: emacs-orgmode
Hi James,
I am going to accept this patch, but I do have a question about it:
On Mar 16, 2008, at 5:31 PM, James TD Smith wrote:
> From: James TD Smith <ahktenzero@usa.net>
>
> Fix the X clipboard handling so it works properly, and so it works
> in XEmacs,and
> add a new % expansion for adding links.
>
> This patch reverts the %c expansion to its original function (head
> of kill
> ring), and adds three new % expansions as follows:
>
> %x - Contents of the X clipboard. This is the first non-empty value
> from the
> PRIMARY, SECONDARY and CLIPBOARD X clipboards.
>
> %^C - This allows the user to choose between any of the clipboard
> values
> available, the kill ring head, and the initial region if set.
>
> %^L - Like %^C, but this inserts an org link using the selected value.
> ---
>
> org.el | 56 +++++++++++++++++++++++++++++++++++++++++---------------
> 1 files changed, 41 insertions(+), 15 deletions(-)
[...]
> (cond
> ((org-in-regexp org-bracket-link-regexp 1)
> ;; We do have a link at point, and we are going to edit it.
> @@ -12579,7 +12583,7 @@ link description."
> (setq link (org-make-link
> "file:" (match-string 1 (expand-file-name file)))))
> (t (setq link (org-make-link "file:" file))))))
> - (t
> + ((not link)
> ;; Read link, with completion for stored links.
If you set it up like this, `link' will be overwritten be any link
found at point.
Is you intention not to make the new argument link-location *overrule*
anything
that might be at point?
So maybe the first alternative in the cond should be just (link), to
bypass any parsing....
- Carsten
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 5/5] clipboard handling in remember templats
2008-04-09 15:32 ` Carsten Dominik
@ 2008-04-09 17:35 ` James TD Smith
0 siblings, 0 replies; 12+ messages in thread
From: James TD Smith @ 2008-04-09 17:35 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode
On 2008-04-09 17:32:22(+0200), Carsten Dominik wrote:
> Hi James,
>
> I am going to accept this patch, but I do have a question about it:
>
> On Mar 16, 2008, at 5:31 PM, James TD Smith wrote:
>
> >From: James TD Smith <ahktenzero@usa.net>
> >
> >org.el | 56 +++++++++++++++++++++++++++++++++++++++++---------------
> >1 files changed, 41 insertions(+), 15 deletions(-)
>
> [...]
>
> > (cond
> > ((org-in-regexp org-bracket-link-regexp 1)
> > ;; We do have a link at point, and we are going to edit it.
> >@@ -12579,7 +12583,7 @@ link description."
> > (setq link (org-make-link
> > "file:" (match-string 1 (expand-file-name file)))))
> > (t (setq link (org-make-link "file:" file))))))
> >- (t
> >+ ((not link)
> > ;; Read link, with completion for stored links.
>
> If you set it up like this, `link' will be overwritten be any link found at point.
> Is you intention not to make the new argument link-location *overrule* anything
> that might be at point?
No, it should override any links at point.
> So maybe the first alternative in the cond should be just (link), to bypass any parsing....
Yes.
James
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/5] Various patches
2008-03-16 16:27 [PATCH 0/5] Various patches James TD Smith
` (4 preceding siblings ...)
2008-03-16 16:31 ` [PATCH 5/5] clipboard handling in remember templats James TD Smith
@ 2008-03-16 18:29 ` James TD Smith
5 siblings, 0 replies; 12+ messages in thread
From: James TD Smith @ 2008-03-16 18:29 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 95 bytes --]
One of my patches [4/5] appears to have gone missing.
I've attatched it to this email.
James
[-- Attachment #2: sort-todo-by-state --]
[-- Type: text/plain, Size: 1663 bytes --]
Add a new sort option, which sorts items by todo keyword in the order of the
From: James TD Smith <ahktenzero@usa.net>
todo sequence.
This is a somewhat simple implementation which just uses the position of the
keyword in org-todo-keywords-1, so if you have multiple sequences containing the
same todo keyword you may not get the ordering you expect.
---
org.el | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/org.el b/org.el
index dee8471..d67024f 100644
--- a/org.el
+++ b/org.el
@@ -982,7 +982,6 @@ table, obtained by prompting the user."
:group 'org-table-settings
:type 'string)
-
(defcustom org-table-number-regexp
"^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\|nan\\)$"
"Regular expression for recognizing numbers in table columns.
@@ -6993,7 +6992,7 @@ WITH-CASE, the sorting considers case as well."
(message
(if plain-list-p
"Sort %s: [a]lpha [n]umeric [t]ime [f]unc A/N/T/F means reversed:"
- "Sort %s: [a]lpha [n]umeric [t]ime [p]riority p[r]operty [f]unc A/N/T/P/F means reversed:")
+ "Sort %s: [a]lpha [n]umeric [t]ime [p]riority p[r]operty [f]unc keyword [o]rder A/N/T/P/F/O means reversed:")
what)
(setq sorting-type (read-char-exclusive))
@@ -7084,6 +7083,10 @@ WITH-CASE, the sorting considers case as well."
org-default-priority))
((= dcst ?r)
(or (org-entry-get nil property) ""))
+ ((= dcst ?o)
+ (if (looking-at org-complex-heading-regexp)
+ (or (position (match-string 2) org-todo-keywords-1 :test 'string=)
+ 9999)))
((= dcst ?f)
(if getkey-func
(progn
[-- Attachment #3: Type: text/plain, Size: 204 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply related [flat|nested] 12+ messages in thread