aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorXue Fuqiao2013-12-26 06:27:00 +0800
committerXue Fuqiao2013-12-26 06:27:00 +0800
commit77bbf3713d459c45492e6daed68437edcf863a0c (patch)
tree0e2ea82f80e907cea52eb683a362504a3813a463 /lisp
parent3bc1e1880f232ccaea7c35a0c51bac61df9ac23c (diff)
parent83fa295c1236aba5a73d565082dcb58a32f3e446 (diff)
downloademacs-77bbf3713d459c45492e6daed68437edcf863a0c.tar.gz
emacs-77bbf3713d459c45492e6daed68437edcf863a0c.zip
Merge from mainline.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog54
-rw-r--r--lisp/net/eww.el20
-rw-r--r--lisp/net/shr.el34
-rw-r--r--lisp/progmodes/python.el112
-rw-r--r--lisp/window.el16
5 files changed, 163 insertions, 73 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 79244ec160c..45c2154db0e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,57 @@
12013-12-25 Lars Ingebrigtsen <larsi@gnus.org>
2
3 * net/shr.el (shr-visit-file): Remove debugging function.
4
52013-12-25 Fabián Ezequiel Gallina <fgallina@gnu.org>
6
7 * progmodes/python.el:
8 (python-nav--lisp-forward-sexp): New function.
9 (python-nav--lisp-forward-sexp-safe): Use it. Rename from
10 python-nav-lisp-forward-sexp-safe.
11 (python-nav--forward-sexp): New argument SAFE allows switching
12 forward sexp movement behavior for parens.
13 (python-nav-forward-sexp): Throw errors on unterminated parens
14 (Bug#16191).
15 (python-nav-backward-sexp, python-nav-forward-sexp-safe)
16 (python-nav-backward-sexp-safe): New functions.
17 (python-shell-buffer-substring): Use
18 `python-nav-forward-sexp-safe'.
19
202013-12-25 Lars Ingebrigtsen <larsi@gnus.org>
21
22 * net/shr.el (shr-find-fill-point): Don't break lines before a
23 quotation mark.
24 (shr-char-kinsoku-bol-p): The quotation mark isn't a kinsoky BOL char.
25 (shr-find-fill-point): Remove the special checks for the quotation
26 mark, since `shr-char-kinsoku-bol-p' should now return the right
27 thing.
28
292013-12-25 Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com>
30
31 * net/eww.el (eww-form-textarea): Use a different face for
32 textareas than text input since they have different keymaps
33 (bug#16142).
34
352013-12-24 Fabián Ezequiel Gallina <fgallina@gnu.org>
36
37 * progmodes/python.el (python-nav-beginning-of-statement): Speed
38 up (Bug#15295).
39
402013-12-24 Lars Ingebrigtsen <larsi@gnus.org>
41
42 * net/eww.el (eww-bookmark-browse): Use `quit-window' to restore
43 the window configuration.
44
452013-12-24 Eli Zaretskii <eliz@gnu.org>
46
47 * net/eww.el (eww-open-file): Ensure 3 slashes after "file:" when
48 we run on MS-Windows or MS-DOS.
49
502013-12-24 Martin Rudalics <rudalics@gmx.at>
51
52 * window.el (balance-windows-area): Call window-size instead of
53 window-height and window-width. Bug#16241.
54
12013-12-24 Lars Ingebrigtsen <larsi@gnus.org> 552013-12-24 Lars Ingebrigtsen <larsi@gnus.org>
2 56
3 * net/eww.el (eww-bookmark-quit): Remove. 57 * net/eww.el (eww-bookmark-quit): Remove.
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index b7f50c19321..25309d16951 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -115,6 +115,14 @@ See also `eww-form-checkbox-selected-symbol'."
115 :version "24.4" 115 :version "24.4"
116 :group 'eww) 116 :group 'eww)
117 117
118(defface eww-form-textarea
119 '((t (:background "#C0C0C0"
120 :foreground "black"
121 :box (:line-width 1))))
122 "Face for eww textarea inputs."
123 :version "24.4"
124 :group 'eww)
125
118(defvar eww-current-url nil) 126(defvar eww-current-url nil)
119(defvar eww-current-dom nil) 127(defvar eww-current-dom nil)
120(defvar eww-current-source nil) 128(defvar eww-current-source nil)
@@ -167,7 +175,10 @@ word(s) will be searched for via `eww-search-prefix'."
167(defun eww-open-file (file) 175(defun eww-open-file (file)
168 "Render a file using EWW." 176 "Render a file using EWW."
169 (interactive "fFile: ") 177 (interactive "fFile: ")
170 (eww (concat "file://" (expand-file-name file)))) 178 (eww (concat "file://"
179 (and (memq system-type '(windows-nt ms-dos))
180 "/")
181 (expand-file-name file))))
171 182
172(defun eww-render (status url &optional point) 183(defun eww-render (status url &optional point)
173 (let ((redirect (plist-get status :redirect))) 184 (let ((redirect (plist-get status :redirect)))
@@ -773,7 +784,7 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
773 (when (> pad 0) 784 (when (> pad 0)
774 (insert (make-string pad ? )))) 785 (insert (make-string pad ? ))))
775 (add-face-text-property (line-beginning-position) 786 (add-face-text-property (line-beginning-position)
776 (point) 'eww-form-text) 787 (point) 'eww-form-textarea)
777 (put-text-property (line-beginning-position) (point) 788 (put-text-property (line-beginning-position) (point)
778 'local-map eww-textarea-map) 789 'local-map eww-textarea-map)
779 (forward-line 1)) 790 (forward-line 1))
@@ -1083,8 +1094,6 @@ Differences in #targets are ignored."
1083;;; Bookmarks code 1094;;; Bookmarks code
1084 1095
1085(defvar eww-bookmarks nil) 1096(defvar eww-bookmarks nil)
1086(defvar eww-previous-window-configuration nil)
1087(make-variable-buffer-local 'eww-previous-window-configuration)
1088 1097
1089(defun eww-add-bookmark () 1098(defun eww-add-bookmark ()
1090 "Add the current page to the bookmarks." 1099 "Add the current page to the bookmarks."
@@ -1129,7 +1138,6 @@ Differences in #targets are ignored."
1129 (unless eww-bookmarks 1138 (unless eww-bookmarks
1130 (user-error "No bookmarks are defined")) 1139 (user-error "No bookmarks are defined"))
1131 (set-buffer (get-buffer-create "*eww bookmarks*")) 1140 (set-buffer (get-buffer-create "*eww bookmarks*"))
1132 (setq eww-previous-window-configuration (current-window-configuration))
1133 (eww-bookmark-mode) 1141 (eww-bookmark-mode)
1134 (let ((format "%-40s %s") 1142 (let ((format "%-40s %s")
1135 (inhibit-read-only t) 1143 (inhibit-read-only t)
@@ -1188,8 +1196,6 @@ Differences in #targets are ignored."
1188 (unless bookmark 1196 (unless bookmark
1189 (user-error "No bookmark on the current line")) 1197 (user-error "No bookmark on the current line"))
1190 (quit-window) 1198 (quit-window)
1191 (when eww-previous-window-configuration
1192 (set-window-configuration eww-previous-window-configuration))
1193 (eww-browse-url (plist-get bookmark :url)))) 1199 (eww-browse-url (plist-get bookmark :url))))
1194 1200
1195(defun eww-next-bookmark () 1201(defun eww-next-bookmark ()
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 5c30bd8ac67..5b8ab28c837 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -179,13 +179,6 @@ cid: URL as the argument.")
179 (goto-char begin) 179 (goto-char begin)
180 (shr-insert-document dom)))) 180 (shr-insert-document dom))))
181 181
182(defun shr-visit-file (file)
183 "Parse FILE as an HTML document, and render it in a new buffer."
184 (interactive "fHTML file name: ")
185 (with-temp-buffer
186 (insert-file-contents file)
187 (shr-render-buffer (current-buffer))))
188
189;;;###autoload 182;;;###autoload
190(defun shr-insert-document (dom) 183(defun shr-insert-document (dom)
191 "Render the parsed document DOM into the current buffer. 184 "Render the parsed document DOM into the current buffer.
@@ -414,7 +407,9 @@ size, and full-buffer size."
414;; of a line or the end of a line. 407;; of a line or the end of a line.
415(defmacro shr-char-kinsoku-bol-p (char) 408(defmacro shr-char-kinsoku-bol-p (char)
416 "Return non-nil if a line ought not to begin with CHAR." 409 "Return non-nil if a line ought not to begin with CHAR."
417 `(aref (char-category-set ,char) ?>)) 410 `(let ((char ,char))
411 (and (not (eq char ?'))
412 (aref (char-category-set char) ?>))))
418(defmacro shr-char-kinsoku-eol-p (char) 413(defmacro shr-char-kinsoku-eol-p (char)
419 "Return non-nil if a line ought not to end with CHAR." 414 "Return non-nil if a line ought not to end with CHAR."
420 `(aref (char-category-set ,char) ?<)) 415 `(aref (char-category-set ,char) ?<))
@@ -489,30 +484,19 @@ size, and full-buffer size."
489 (eq (following-char) ? ) 484 (eq (following-char) ? )
490 (shr-char-breakable-p (preceding-char)) 485 (shr-char-breakable-p (preceding-char))
491 (shr-char-breakable-p (following-char)) 486 (shr-char-breakable-p (following-char))
492 (if (eq (preceding-char) ?') 487 (and (shr-char-kinsoku-bol-p (preceding-char))
493 (not (memq (char-after (- (point) 2)) 488 (shr-char-breakable-p (following-char))
494 (list nil ?\n ? ))) 489 (not (shr-char-kinsoku-bol-p (following-char))))
495 (and (shr-char-kinsoku-bol-p (preceding-char))
496 (shr-char-breakable-p (following-char))
497 (not (shr-char-kinsoku-bol-p (following-char)))))
498 (shr-char-kinsoku-eol-p (following-char)))) 490 (shr-char-kinsoku-eol-p (following-char))))
499 (backward-char 1)) 491 (backward-char 1))
500 (if (and (not (or failed (eolp)))
501 (eq (preceding-char) ?'))
502 (while (not (or (setq failed (eolp))
503 (eq (following-char) ? )
504 (shr-char-breakable-p (following-char))
505 (shr-char-kinsoku-eol-p (following-char))))
506 (forward-char 1)))
507 (if failed 492 (if failed
508 ;; There's no breakable point, so we give it up. 493 ;; There's no breakable point, so we give it up.
509 (let (found) 494 (let (found)
510 (goto-char bp) 495 (goto-char bp)
511 (unless shr-kinsoku-shorten 496 (unless shr-kinsoku-shorten
512 (while (and (setq found (re-search-forward 497 (while (setq found (re-search-forward
513 "\\(\\c>\\)\\| \\|\\c<\\|\\c|" 498 "\\(\\c>\\)\\| \\|\\c<\\|\\c|"
514 (line-end-position) 'move)) 499 (line-end-position) 'move)))
515 (eq (preceding-char) ?')))
516 (if (and found (not (match-beginning 1))) 500 (if (and found (not (match-beginning 1)))
517 (goto-char (match-beginning 0))))) 501 (goto-char (match-beginning 0)))))
518 (or 502 (or
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index aeee179c7e7..0646eade780 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1279,15 +1279,21 @@ nested definitions."
1279(defun python-nav-beginning-of-statement () 1279(defun python-nav-beginning-of-statement ()
1280 "Move to start of current statement." 1280 "Move to start of current statement."
1281 (interactive "^") 1281 (interactive "^")
1282 (while (and (or (back-to-indentation) t) 1282 (back-to-indentation)
1283 (not (bobp)) 1283 (let* ((ppss (syntax-ppss))
1284 (when (or 1284 (context-point
1285 (save-excursion 1285 (or
1286 (forward-line -1) 1286 (python-syntax-context 'paren ppss)
1287 (python-info-line-ends-backslash-p)) 1287 (python-syntax-context 'string ppss))))
1288 (python-syntax-context 'string) 1288 (cond ((bobp))
1289 (python-syntax-context 'paren)) 1289 (context-point
1290 (forward-line -1)))) 1290 (goto-char context-point)
1291 (python-nav-beginning-of-statement))
1292 ((save-excursion
1293 (forward-line -1)
1294 (python-info-line-ends-backslash-p))
1295 (forward-line -1)
1296 (python-nav-beginning-of-statement))))
1291 (point-marker)) 1297 (point-marker))
1292 1298
1293(defun python-nav-end-of-statement (&optional noend) 1299(defun python-nav-end-of-statement (&optional noend)
@@ -1418,25 +1424,36 @@ backward to previous block."
1418 (and (goto-char starting-pos) nil) 1424 (and (goto-char starting-pos) nil)
1419 (and (not (= (point) starting-pos)) (point-marker))))) 1425 (and (not (= (point) starting-pos)) (point-marker)))))
1420 1426
1421(defun python-nav-lisp-forward-sexp-safe (&optional arg) 1427(defun python-nav--lisp-forward-sexp (&optional arg)
1422 "Safe version of standard `forward-sexp'. 1428 "Standard version `forward-sexp'.
1423When ARG > 0 move forward, else if ARG is < 0." 1429It ignores completely the value of `forward-sexp-function' by
1424 (or arg (setq arg 1)) 1430setting it to nil before calling `forward-sexp'. With positive
1431ARG move forward only one sexp, else move backwards."
1425 (let ((forward-sexp-function) 1432 (let ((forward-sexp-function)
1426 (paren-regexp 1433 (arg (if (or (not arg) (> arg 0)) 1 -1)))
1427 (if (> arg 0) (python-rx close-paren) (python-rx open-paren))) 1434 (forward-sexp arg)))
1428 (search-fn 1435
1429 (if (> arg 0) #'re-search-forward #'re-search-backward))) 1436(defun python-nav--lisp-forward-sexp-safe (&optional arg)
1437 "Safe version of standard `forward-sexp'.
1438When at end of sexp (i.e. looking at a opening/closing paren)
1439skips it instead of throwing an error. With positive ARG move
1440forward only one sexp, else move backwards."
1441 (let* ((arg (if (or (not arg) (> arg 0)) 1 -1))
1442 (paren-regexp
1443 (if (> arg 0) (python-rx close-paren) (python-rx open-paren)))
1444 (search-fn
1445 (if (> arg 0) #'re-search-forward #'re-search-backward)))
1430 (condition-case nil 1446 (condition-case nil
1431 (forward-sexp arg) 1447 (python-nav--lisp-forward-sexp arg)
1432 (error 1448 (error
1433 (while (and (funcall search-fn paren-regexp nil t) 1449 (while (and (funcall search-fn paren-regexp nil t)
1434 (python-syntax-context 'paren))))))) 1450 (python-syntax-context 'paren)))))))
1435 1451
1436(defun python-nav--forward-sexp (&optional dir) 1452(defun python-nav--forward-sexp (&optional dir safe)
1437 "Move to forward sexp. 1453 "Move to forward sexp.
1438With positive Optional argument DIR direction move forward, else 1454With positive optional argument DIR direction move forward, else
1439backwards." 1455backwards. When optional argument SAFE is non-nil do not throw
1456errors when at end of sexp, skip it instead."
1440 (setq dir (or dir 1)) 1457 (setq dir (or dir 1))
1441 (unless (= dir 0) 1458 (unless (= dir 0)
1442 (let* ((forward-p (if (> dir 0) 1459 (let* ((forward-p (if (> dir 0)
@@ -1454,7 +1471,9 @@ backwards."
1454 (eq (syntax-class (syntax-after (1- (point)))) 1471 (eq (syntax-class (syntax-after (1- (point))))
1455 (car (string-to-syntax ")"))))) 1472 (car (string-to-syntax ")")))))
1456 ;; Inside a paren or looking at it, lisp knows what to do. 1473 ;; Inside a paren or looking at it, lisp knows what to do.
1457 (python-nav-lisp-forward-sexp-safe dir)) 1474 (if safe
1475 (python-nav--lisp-forward-sexp-safe dir)
1476 (python-nav--lisp-forward-sexp dir)))
1458 (t 1477 (t
1459 ;; This part handles the lispy feel of 1478 ;; This part handles the lispy feel of
1460 ;; `python-nav-forward-sexp'. Knowing everything about the 1479 ;; `python-nav-forward-sexp'. Knowing everything about the
@@ -1468,7 +1487,9 @@ backwards."
1468 ((python-info-end-of-statement-p) 'statement-end))) 1487 ((python-info-end-of-statement-p) 'statement-end)))
1469 (next-sexp-pos 1488 (next-sexp-pos
1470 (save-excursion 1489 (save-excursion
1471 (python-nav-lisp-forward-sexp-safe dir) 1490 (if safe
1491 (python-nav--lisp-forward-sexp-safe dir)
1492 (python-nav--lisp-forward-sexp dir))
1472 (point))) 1493 (point)))
1473 (next-sexp-context 1494 (next-sexp-context
1474 (save-excursion 1495 (save-excursion
@@ -1522,23 +1543,48 @@ backwards."
1522 (python-nav-beginning-of-statement)) 1543 (python-nav-beginning-of-statement))
1523 (t (goto-char next-sexp-pos)))))))))) 1544 (t (goto-char next-sexp-pos))))))))))
1524 1545
1525(defun python-nav--backward-sexp ()
1526 "Move to backward sexp."
1527 (python-nav--forward-sexp -1))
1528
1529(defun python-nav-forward-sexp (&optional arg) 1546(defun python-nav-forward-sexp (&optional arg)
1530 "Move forward across one block of code. 1547 "Move forward across expressions.
1531With ARG, do it that many times. Negative arg -N means 1548With ARG, do it that many times. Negative arg -N means move
1532move backward N times." 1549backward N times."
1533 (interactive "^p") 1550 (interactive "^p")
1534 (or arg (setq arg 1)) 1551 (or arg (setq arg 1))
1535 (while (> arg 0) 1552 (while (> arg 0)
1536 (python-nav--forward-sexp) 1553 (python-nav--forward-sexp 1)
1537 (setq arg (1- arg))) 1554 (setq arg (1- arg)))
1538 (while (< arg 0) 1555 (while (< arg 0)
1539 (python-nav--backward-sexp) 1556 (python-nav--forward-sexp -1)
1540 (setq arg (1+ arg)))) 1557 (setq arg (1+ arg))))
1541 1558
1559(defun python-nav-backward-sexp (&optional arg)
1560 "Move backward across expressions.
1561With ARG, do it that many times. Negative arg -N means move
1562backward N times."
1563 (interactive "^p")
1564 (or arg (setq arg 1))
1565 (python-nav-forward-sexp (- arg)))
1566
1567(defun python-nav-forward-sexp-safe (&optional arg)
1568 "Move forward safely across expressions.
1569With ARG, do it that many times. Negative arg -N means move
1570backward N times."
1571 (interactive "^p")
1572 (or arg (setq arg 1))
1573 (while (> arg 0)
1574 (python-nav--forward-sexp 1 t)
1575 (setq arg (1- arg)))
1576 (while (< arg 0)
1577 (python-nav--forward-sexp -1 t)
1578 (setq arg (1+ arg))))
1579
1580(defun python-nav-backward-sexp-safe (&optional arg)
1581 "Move backward safely across expressions.
1582With ARG, do it that many times. Negative arg -N means move
1583backward N times."
1584 (interactive "^p")
1585 (or arg (setq arg 1))
1586 (python-nav-forward-sexp-safe (- arg)))
1587
1542(defun python-nav--up-list (&optional dir) 1588(defun python-nav--up-list (&optional dir)
1543 "Internal implementation of `python-nav-up-list'. 1589 "Internal implementation of `python-nav-up-list'.
1544DIR is always 1 or -1 and comes sanitized from 1590DIR is always 1 or -1 and comes sanitized from
@@ -2206,7 +2252,7 @@ the python shell:
2206 (save-excursion 2252 (save-excursion
2207 (when (python-nav-if-name-main) 2253 (when (python-nav-if-name-main)
2208 (cons (point) 2254 (cons (point)
2209 (progn (python-nav-forward-sexp) 2255 (progn (python-nav-forward-sexp-safe)
2210 (point))))))) 2256 (point)))))))
2211 ;; Oh destructuring bind, how I miss you. 2257 ;; Oh destructuring bind, how I miss you.
2212 (if-name-main-start (car if-name-main-start-end)) 2258 (if-name-main-start (car if-name-main-start-end))
diff --git a/lisp/window.el b/lisp/window.el
index 3b841747205..b58f8b85815 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4681,12 +4681,12 @@ specific buffers."
4681 ;; (assert (eq next (or (cadr (member win wins)) (car wins)))) 4681 ;; (assert (eq next (or (cadr (member win wins)) (car wins))))
4682 (let* ((horiz 4682 (let* ((horiz
4683 (< (car (window-pixel-edges win)) (car (window-pixel-edges next)))) 4683 (< (car (window-pixel-edges win)) (car (window-pixel-edges next))))
4684 (areadiff (/ (- (* (window-height next pixelwise) 4684 (areadiff (/ (- (* (window-size next nil pixelwise)
4685 (window-width next pixelwise) 4685 (window-size next t pixelwise)
4686 (buffer-local-value 'window-area-factor 4686 (buffer-local-value 'window-area-factor
4687 (window-buffer next))) 4687 (window-buffer next)))
4688 (* (window-height win pixelwise) 4688 (* (window-size win nil pixelwise)
4689 (window-width win pixelwise) 4689 (window-size win t pixelwise)
4690 (buffer-local-value 'window-area-factor 4690 (buffer-local-value 'window-area-factor
4691 (window-buffer win)))) 4691 (window-buffer win))))
4692 (max (buffer-local-value 'window-area-factor 4692 (max (buffer-local-value 'window-area-factor
@@ -4694,10 +4694,10 @@ specific buffers."
4694 (buffer-local-value 'window-area-factor 4694 (buffer-local-value 'window-area-factor
4695 (window-buffer next))))) 4695 (window-buffer next)))))
4696 (edgesize (if horiz 4696 (edgesize (if horiz
4697 (+ (window-height win pixelwise) 4697 (+ (window-size win nil pixelwise)
4698 (window-height next pixelwise)) 4698 (window-size next nil pixelwise))
4699 (+ (window-width win pixelwise) 4699 (+ (window-size win t pixelwise)
4700 (window-width next pixelwise)))) 4700 (window-size next t pixelwise))))
4701 (diff (/ areadiff edgesize))) 4701 (diff (/ areadiff edgesize)))
4702 (when (zerop diff) 4702 (when (zerop diff)
4703 ;; Maybe diff is actually closer to 1 than to 0. 4703 ;; Maybe diff is actually closer to 1 than to 0.