aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2011-08-12 15:14:29 +0200
committerJoakim Verona2011-08-12 15:14:29 +0200
commit3637e3bf04cc1e54850a877c6535a075caad7e5e (patch)
treeaf49dd7e29e5ab14e8890a96f99a780dbc4f494e
parent6a6f5bfa9fe12d08b0ed1ebab05884b9eb1b1454 (diff)
parent9d5cb6312b5e6ad61c7cdb5a1282d81e677899f2 (diff)
downloademacs-3637e3bf04cc1e54850a877c6535a075caad7e5e.tar.gz
emacs-3637e3bf04cc1e54850a877c6535a075caad7e5e.zip
dom traversal example
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/epa-file.el12
-rw-r--r--lisp/epa.el15
-rw-r--r--lisp/gnus/ChangeLog6
-rw-r--r--lisp/gnus/nnimap.el6
-rw-r--r--src/xwidget.c45
6 files changed, 83 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ad300b10f47..27515f767fb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12011-08-12 Daiki Ueno <ueno@unixuser.org>
2
3 * epa.el (epa-progress-callback-function): Fix the logic of
4 displaying progress.
5 * epa-file.el (epa-file-insert-file-contents): Make progress
6 display more user-friendly.
7 (epa-file-write-region): Ditto.
8
12011-08-10 Chong Yidong <cyd@stupidchicken.com> 92011-08-10 Chong Yidong <cyd@stupidchicken.com>
2 10
3 * subr.el (string-mark-left-to-right): New function. 11 * subr.el (string-mark-left-to-right): New function.
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index aa9915d8cfa..118f44854cf 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -137,8 +137,10 @@ encryption is used."
137 context 137 context
138 (cons #'epa-file-passphrase-callback-function 138 (cons #'epa-file-passphrase-callback-function
139 local-file)) 139 local-file))
140 (epg-context-set-progress-callback context 140 (epg-context-set-progress-callback
141 #'epa-progress-callback-function) 141 context
142 (cons #'epa-progress-callback-function
143 (format "Decrypting %s" file)))
142 (unwind-protect 144 (unwind-protect
143 (progn 145 (progn
144 (if replace 146 (if replace
@@ -211,8 +213,10 @@ encryption is used."
211 context 213 context
212 (cons #'epa-file-passphrase-callback-function 214 (cons #'epa-file-passphrase-callback-function
213 file)) 215 file))
214 (epg-context-set-progress-callback context 216 (epg-context-set-progress-callback
215 #'epa-progress-callback-function) 217 context
218 (cons #'epa-progress-callback-function
219 (format "Encrypting %s" file)))
216 (epg-context-set-armor context epa-armor) 220 (epg-context-set-armor context epa-armor)
217 (condition-case error 221 (condition-case error
218 (setq string 222 (setq string
diff --git a/lisp/epa.el b/lisp/epa.el
index d4f4fab2eed..e2fafc753d7 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -651,10 +651,17 @@ If SECRET is non-nil, list secret keys instead of public keys."
651 651
652(defun epa-progress-callback-function (_context what _char current total 652(defun epa-progress-callback-function (_context what _char current total
653 handback) 653 handback)
654 (message "%s%d%% (%d/%d)" (or handback 654 (let ((prompt (or handback
655 (concat what ": ")) 655 (format "Processing %s: " what))))
656 (if (> total 0) (floor (* (/ current (float total)) 100)) 0) 656 ;; According to gnupg/doc/DETAIL: a "total" of 0 indicates that
657 current total)) 657 ;; the total amount is not known. The condition TOTAL && CUR ==
658 ;; TOTAL may be used to detect the end of an operation.
659 (if (> total 0)
660 (if (= current total)
661 (message "%s...done" prompt)
662 (message "%s...%d%%" prompt
663 (floor (* (/ current (float total)) 100))))
664 (message "%s..." prompt))))
658 665
659;;;###autoload 666;;;###autoload
660(defun epa-decrypt-file (file) 667(defun epa-decrypt-file (file)
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index e13d2d594ca..7f4116d6636 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,9 @@
12011-08-11 Andrew Cohen <cohen@andy.bu.edu>
2
3 * nnimap.el (nnimap-transform-headers): BODYSTRUCTURE for messages of
4 type MESSAGE and subtype RFC822 is slightly different from those of
5 type TEXT.
6
12011-08-05 Andrew Cohen <cohen@andy.bu.edu> 72011-08-05 Andrew Cohen <cohen@andy.bu.edu>
2 8
3 * gnus-sum.el (gnus-summary-refer-article): Warp to article. This 9 * gnus-sum.el (gnus-summary-refer-article): Warp to article. This
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index f41f4af71b4..c940e06fbb6 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -218,7 +218,11 @@ textual parts.")
218 (while (and (consp structure) 218 (while (and (consp structure)
219 (not (stringp (car structure)))) 219 (not (stringp (car structure))))
220 (setq structure (car structure))) 220 (setq structure (car structure)))
221 (setq lines (nth 7 structure)))) 221 (setq lines (if (and
222 (equal (upcase (nth 0 structure)) "MESSAGE")
223 (equal (upcase (nth 1 structure)) "RFC822"))
224 (nth 9 structure)
225 (nth 7 structure)))))
222 (delete-region (line-beginning-position) (line-end-position)) 226 (delete-region (line-beginning-position) (line-end-position))
223 (insert (format "211 %s Article retrieved." article)) 227 (insert (format "211 %s Article retrieved." article))
224 (forward-line 1) 228 (forward-line 1)
diff --git a/src/xwidget.c b/src/xwidget.c
index 89cd859fdfc..7f78ffed5e7 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -734,7 +734,51 @@ void gtk_window_get_position (GtkWindow *window,
734 *root_y = 0; 734 *root_y = 0;
735} 735}
736 736
737DEFUN ("xwidget-webkit-dom-dump", Fxwidget_webkit_dom_dump, Sxwidget_webkit_dom_dump, 1, 1, 0,
738 doc: /* webkit dom dump*/
739 )
740 (Lisp_Object xwidget)
741{
742 struct xwidget* xw = XXWIDGET(xwidget);
743 xwidget_webkit_dom_dump(webkit_web_view_get_dom_document(xw->widget_osr));
744 return Qnil;
745}
737 746
747void
748xwidget_webkit_dom_dump(WebKitDOMNode* parent){
749 WebKitDOMNodeList* list;
750 int i;
751 int length;
752 WebKitDOMNode* attribute;
753 WebKitDOMNamedNodeMap* attrs;
754 printf("node:%d type:%d name:%s content:%s\n",
755 parent,
756 webkit_dom_node_get_node_type(parent),//1 element 3 text 8 comment 2 attribute
757 webkit_dom_node_get_local_name(parent),
758 webkit_dom_node_get_text_content(parent));
759
760 if(webkit_dom_node_has_attributes(parent)){
761 attrs = webkit_dom_node_get_attributes(parent);
762
763 length = webkit_dom_named_node_map_get_length(attrs);
764 for (int i = 0; i < length; i++) {
765 attribute = webkit_dom_named_node_map_item(attrs,i);
766 printf(" attr node:%d type:%d name:%s content:%s\n",
767 attribute,
768 webkit_dom_node_get_node_type(attribute),//1 element 3 text 8 comment
769 webkit_dom_node_get_local_name(attribute),
770 webkit_dom_node_get_text_content(attribute));
771 }
772 }
773 list = webkit_dom_node_get_child_nodes(parent);
774 length = webkit_dom_node_list_get_length(list);
775 WebKitDOMNode* child;
776 for (int i = 0; i < length; i++) {
777 child = webkit_dom_node_list_item(list, i);
778 //if(webkit_dom_node_has_child_nodes(child))
779 xwidget_webkit_dom_dump(child);
780 }
781}
738 782
739 783
740#endif 784#endif
@@ -912,6 +956,7 @@ syms_of_xwidget (void)
912 defsubr (&Sxwidget_disable_plugin_for_mime); 956 defsubr (&Sxwidget_disable_plugin_for_mime);
913 957
914 defsubr (&Sxwidget_send_keyboard_event); 958 defsubr (&Sxwidget_send_keyboard_event);
959 defsubr (&Sxwidget_webkit_dom_dump);
915 DEFSYM (Qxwidget ,"xwidget"); 960 DEFSYM (Qxwidget ,"xwidget");
916 961
917 DEFSYM (Qcxwidget ,":xwidget"); 962 DEFSYM (Qcxwidget ,":xwidget");