comparison lisp/startup.el @ 38463:2e3306c6ed15

(command-line-1): Add support for +LINE:COLUMN command line argument.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 17 Jul 2001 10:56:35 +0000
parents efc03a2c216e
children e3a84598fe88
comparison
equal deleted inserted replaced
38462:a7043adf8855 38463:2e3306c6ed15
1434 ("--directory") ("--eval") ("--execute") 1434 ("--directory") ("--eval") ("--execute")
1435 ("--find-file") ("--visit") ("--file")) 1435 ("--find-file") ("--visit") ("--file"))
1436 (mapcar (lambda (elt) 1436 (mapcar (lambda (elt)
1437 (list (concat "-" (car elt)))) 1437 (list (concat "-" (car elt))))
1438 command-switch-alist))) 1438 command-switch-alist)))
1439 (line 0)) 1439 (line 0)
1440 (column 0))
1440 1441
1441 ;; Add the long X options to longopts. 1442 ;; Add the long X options to longopts.
1442 (setq tem command-line-x-option-alist) 1443 (setq tem command-line-x-option-alist)
1443 (while tem 1444 (while tem
1444 (if (string-match "^--" (car (car tem))) 1445 (if (string-match "^--" (car (car tem)))
1543 (kill-emacs t)) 1544 (kill-emacs t))
1544 1545
1545 ((string-match "^\\+[0-9]+\\'" argi) 1546 ((string-match "^\\+[0-9]+\\'" argi)
1546 (setq line (string-to-int argi))) 1547 (setq line (string-to-int argi)))
1547 1548
1549 ((string-match "^\\+\\([0-9]+\\):\\([0-9]+\\)\\'" argi)
1550 (setq line (string-to-int (match-string 1 argi))
1551 column (string-to-int (match-string 2 argi))))
1552
1548 ((setq tem (assoc argi command-line-x-option-alist)) 1553 ((setq tem (assoc argi command-line-x-option-alist))
1549 ;; Ignore X-windows options and their args if not using X. 1554 ;; Ignore X-windows options and their args if not using X.
1550 (setq command-line-args-left 1555 (setq command-line-args-left
1551 (nthcdr (nth 1 tem) command-line-args-left))) 1556 (nthcdr (nth 1 tem) command-line-args-left)))
1552 1557
1566 (if (= file-count 1) 1571 (if (= file-count 1)
1567 (setq first-file-buffer (find-file file)) 1572 (setq first-file-buffer (find-file file))
1568 (find-file-other-window file))) 1573 (find-file-other-window file)))
1569 (or (zerop line) 1574 (or (zerop line)
1570 (goto-line line)) 1575 (goto-line line))
1571 (setq line 0)) 1576 (setq line 0)
1577 (unless (< column 1)
1578 (move-to-column (1- column)))
1579 (setq column 0))
1572 1580
1573 ((equal argi "--") 1581 ((equal argi "--")
1574 (setq just-files t)) 1582 (setq just-files t))
1575 (t 1583 (t
1576 ;; We have almost exhausted our options. See if the 1584 ;; We have almost exhausted our options. See if the
1593 (if (= file-count 1) 1601 (if (= file-count 1)
1594 (setq first-file-buffer (find-file file)) 1602 (setq first-file-buffer (find-file file))
1595 (find-file-other-window file))) 1603 (find-file-other-window file)))
1596 (or (zerop line) 1604 (or (zerop line)
1597 (goto-line line)) 1605 (goto-line line))
1598 (setq line 0)))))))) 1606 (setq line 0)
1607 (unless (< column 1)
1608 (move-to-column (1- column)))
1609 (setq column 0))))))))
1599 ;; If 3 or more files visited, and not all visible, 1610 ;; If 3 or more files visited, and not all visible,
1600 ;; show user what they all are. But leave the last one current. 1611 ;; show user what they all are. But leave the last one current.
1601 (and (> file-count 2) 1612 (and (> file-count 2)
1602 (not noninteractive) 1613 (not noninteractive)
1603 (or (get-buffer-window first-file-buffer) 1614 (or (get-buffer-window first-file-buffer)