Skip to content

Commit

Permalink
Disable command-line processing for Emacs 24.
Browse files Browse the repository at this point in the history
There is no longer access to file-count/line/column after lexical
binding was introduced in Emacs 24 and enabled for startup.el, which
means the current implementation no longer works.

Probably it could be reimplemented using advice, but I personally
don't need the feature so I'm just leaving it disabled.
  • Loading branch information
knu committed Mar 23, 2012
1 parent b2e1eea commit c3ba585
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions elscreen.el
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,17 @@ buffer-name and corresponding screen-name."
(elscreen-rebuild-buffer-to-nickname-alist)))
:group 'elscreen)

(static-when (>= emacs-major-version 24)

(defcustom elscreen-startup-command-line-processing t
"*If non-nil, ElScreen processes command line when Emacsen
starts up, and opens files with new screen if needed."
:type 'boolean
:tag "Enable/Disable ElScreen to Process Command Line Arguments"
:group 'elscreen)

) ; (>= emacs-major-version 24)

(defcustom elscreen-display-screen-number t
"*Non-nil to display the number of current screen in the mode line."
:tag "Show/Hide Screen Number on the mode-line"
Expand Down Expand Up @@ -1649,6 +1653,10 @@ Use \\[toggle-read-only] to permit editing."

;;; Command-line processing at startup time

; In Emacs 24 or later there is no access to file-count, line, column,
; etc., so we cannot implement command-line processing this way.
(static-when (>= emacs-major-version 24)

(defun elscreen-command-line-funcall (switch-string)
(let ((argval (intern (car command-line-args-left)))
screen elscreen-window-configuration)
Expand Down Expand Up @@ -1728,24 +1736,6 @@ Use \\[toggle-read-only] to permit editing."
(add-hook 'after-init-hook (lambda ()
(add-to-list 'command-line-functions
'elscreen-e23-command-line t))))
((> emacs-major-version 23) ; Emacs 24 or later
(defun elscreen-e24-command-line ()
(when (string-match "\\`-" cl1-argi)
(error "Unknown option `%s'" cl1-argi))
(setq file-count (1+ file-count))
(setq inhibit-startup-buffer-menu t)
(let* ((file
(expand-file-name
(command-line-normalize-file-name orig-argi)
cl1-dir)))
(elscreen-command-line-find-file file file-count cl1-line cl1-column))
(setq cl1-line 0)
(setq cl1-column 0)
t)

(add-hook 'after-init-hook (lambda ()
(add-to-list 'command-line-functions
'elscreen-e24-command-line t))))
))

(static-when elscreen-on-xemacs
Expand Down Expand Up @@ -1783,6 +1773,8 @@ Use \\[toggle-read-only] to permit editing."
(expand-file-name arg dir) file-count line)
(setq line nil)))))))))

) ; (>= emacs-major-version 24)

;;; Unsupported Functions...

(defun elscreen-link ()
Expand Down

0 comments on commit c3ba585

Please sign in to comment.